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.
5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
9 #include "base/callback.h"
10 #include "base/observer_list.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/dbus_client_implementation_type.h"
13 #include "chromeos/dbus/experimental_bluetooth_agent_service_provider.h"
14 #include "dbus/object_path.h"
15 #include "dbus/property.h"
19 class FakeBluetoothAgentManagerClient
;
21 // FakeBluetoothAgentServiceProvider simulates the behavior of a local
22 // Bluetooth agent object and is used both in test cases in place of a
23 // mock and on the Linux desktop.
24 class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider
25 : public ExperimentalBluetoothAgentServiceProvider
{
27 FakeBluetoothAgentServiceProvider(const dbus::ObjectPath
& object_path
,
29 virtual ~FakeBluetoothAgentServiceProvider();
31 // Each of these calls the equivalent BluetoothAgentServiceProvider::Delegate
32 // method on the object passed on construction.
33 virtual void Release();
34 virtual void RequestPinCode(const dbus::ObjectPath
& device_path
,
35 const Delegate::PinCodeCallback
& callback
);
36 virtual void DisplayPinCode(const dbus::ObjectPath
& device_path
,
37 const std::string
& pincode
);
38 virtual void RequestPasskey(const dbus::ObjectPath
& device_path
,
39 const Delegate::PasskeyCallback
& callback
);
40 virtual void DisplayPasskey(const dbus::ObjectPath
& device_path
,
41 uint32 passkey
, int16 entered
);
42 virtual void RequestConfirmation(
43 const dbus::ObjectPath
& device_path
,
45 const Delegate::ConfirmationCallback
& callback
);
46 virtual void RequestAuthorization(
47 const dbus::ObjectPath
& device_path
,
48 const Delegate::ConfirmationCallback
& callback
);
49 virtual void AuthorizeService(
50 const dbus::ObjectPath
& device_path
,
51 const std::string
& uuid
,
52 const Delegate::ConfirmationCallback
& callback
);
53 virtual void Cancel();
56 friend class FakeBluetoothAgentManagerClient
;
58 // D-Bus object path we are faking.
59 dbus::ObjectPath object_path_
;
61 // All incoming method calls are passed on to the Delegate and a callback
62 // passed to generate the reply. |delegate_| is generally the object that
63 // owns this one, and must outlive it.
67 } // namespace chromeos
69 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_