Home | History | Annotate | Download | only in dbus
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
      6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
      7 
      8 #include "base/bind.h"
      9 #include "base/callback.h"
     10 #include "base/observer_list.h"
     11 #include "chromeos/chromeos_export.h"
     12 #include "chromeos/dbus/bluetooth_agent_manager_client.h"
     13 #include "chromeos/dbus/dbus_client_implementation_type.h"
     14 #include "dbus/object_path.h"
     15 #include "dbus/property.h"
     16 
     17 namespace chromeos {
     18 
     19 class FakeBluetoothAgentServiceProvider;
     20 
     21 // FakeBluetoothAgentManagerClient simulates the behavior of the Bluetooth
     22 // Daemon's agent manager object and is used both in test cases in place of a
     23 // mock and on the Linux desktop.
     24 class CHROMEOS_EXPORT FakeBluetoothAgentManagerClient
     25     : public BluetoothAgentManagerClient {
     26  public:
     27   FakeBluetoothAgentManagerClient();
     28   virtual ~FakeBluetoothAgentManagerClient();
     29 
     30   // BluetoothAgentManagerClient override
     31   virtual void RegisterAgent(const dbus::ObjectPath& agent_path,
     32                              const std::string& capability,
     33                              const base::Closure& callback,
     34                              const ErrorCallback& error_callback) OVERRIDE;
     35   virtual void UnregisterAgent(const dbus::ObjectPath& agent_path,
     36                                const base::Closure& callback,
     37                                const ErrorCallback& error_callback) OVERRIDE;
     38   virtual void RequestDefaultAgent(const dbus::ObjectPath& agent_path,
     39                                    const base::Closure& callback,
     40                                    const ErrorCallback& error_callback)
     41       OVERRIDE;
     42 
     43   // Register, unregister and retrieve pointers to agent service providers.
     44   void RegisterAgentServiceProvider(
     45       FakeBluetoothAgentServiceProvider* service_provider);
     46   void UnregisterAgentServiceProvider(
     47       FakeBluetoothAgentServiceProvider* service_provider);
     48   FakeBluetoothAgentServiceProvider* GetAgentServiceProvider();
     49 
     50  private:
     51   // The single agent service provider we permit, owned by the application
     52   // using it.
     53   FakeBluetoothAgentServiceProvider* service_provider_;
     54 };
     55 
     56 }  // namespace chromeos
     57 
     58 #endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
     59