Revert of Revert of Revert of Revert of Revert of Enable ServiceWorkerPerfTest (servi...
[chromium-blink-merge.git] / chromeos / dbus / fake_bluetooth_agent_service_provider.h
blob9de89bf1a22ba73f968ff6b765bfa56879a80634
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_
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_service_provider.h"
13 #include "dbus/object_path.h"
14 #include "dbus/property.h"
16 namespace chromeos {
18 class FakeBluetoothAgentManagerClient;
20 // FakeBluetoothAgentServiceProvider simulates the behavior of a local
21 // Bluetooth agent object and is used both in test cases in place of a
22 // mock and on the Linux desktop.
23 class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider
24 : public BluetoothAgentServiceProvider {
25 public:
26 FakeBluetoothAgentServiceProvider(const dbus::ObjectPath& object_path,
27 Delegate *delegate);
28 ~FakeBluetoothAgentServiceProvider() override;
30 // Each of these calls the equivalent BluetoothAgentServiceProvider::Delegate
31 // method on the object passed on construction.
32 virtual void Release();
33 virtual void RequestPinCode(const dbus::ObjectPath& device_path,
34 const Delegate::PinCodeCallback& callback);
35 virtual void DisplayPinCode(const dbus::ObjectPath& device_path,
36 const std::string& pincode);
37 virtual void RequestPasskey(const dbus::ObjectPath& device_path,
38 const Delegate::PasskeyCallback& callback);
39 virtual void DisplayPasskey(const dbus::ObjectPath& device_path,
40 uint32 passkey, int16 entered);
41 virtual void RequestConfirmation(
42 const dbus::ObjectPath& device_path,
43 uint32 passkey,
44 const Delegate::ConfirmationCallback& callback);
45 virtual void RequestAuthorization(
46 const dbus::ObjectPath& device_path,
47 const Delegate::ConfirmationCallback& callback);
48 virtual void AuthorizeService(
49 const dbus::ObjectPath& device_path,
50 const std::string& uuid,
51 const Delegate::ConfirmationCallback& callback);
52 virtual void Cancel();
54 private:
55 friend class FakeBluetoothAgentManagerClient;
57 // D-Bus object path we are faking.
58 dbus::ObjectPath object_path_;
60 // All incoming method calls are passed on to the Delegate and a callback
61 // passed to generate the reply. |delegate_| is generally the object that
62 // owns this one, and must outlive it.
63 Delegate* delegate_;
66 } // namespace chromeos
68 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_