Roll breakpad a513e85:7caf028 (svn 1384:1385)
[chromium-blink-merge.git] / device / bluetooth / test / mock_bluetooth_adapter.h
blob2208bfd5b38325082e90ef0a33c6d0bf431e0b7c
1 // Copyright (c) 2012 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 DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_
6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "device/bluetooth/bluetooth_adapter.h"
12 #include "device/bluetooth/bluetooth_device.h"
13 #include "testing/gmock/include/gmock/gmock.h"
15 namespace device {
17 class MockBluetoothAdapter : public BluetoothAdapter {
18 public:
19 class Observer : public BluetoothAdapter::Observer {
20 public:
21 Observer();
22 virtual ~Observer();
24 MOCK_METHOD2(AdapterPresentChanged, void(BluetoothAdapter*, bool));
25 MOCK_METHOD2(AdapterPoweredChanged, void(BluetoothAdapter*, bool));
26 MOCK_METHOD2(AdapterDiscoveringChanged, void(BluetoothAdapter*, bool));
27 MOCK_METHOD2(DeviceAdded, void(BluetoothAdapter*, BluetoothDevice*));
28 MOCK_METHOD2(DeviceChanged, void(BluetoothAdapter*, BluetoothDevice*));
29 MOCK_METHOD2(DeviceRemoved, void(BluetoothAdapter*, BluetoothDevice*));
32 MockBluetoothAdapter();
34 virtual bool IsInitialized() const { return true; }
36 MOCK_METHOD1(AddObserver, void(BluetoothAdapter::Observer*));
37 MOCK_METHOD1(RemoveObserver, void(BluetoothAdapter::Observer*));
38 MOCK_CONST_METHOD0(GetAddress, std::string());
39 MOCK_CONST_METHOD0(GetName, std::string());
40 MOCK_METHOD3(SetName,
41 void(const std::string& name,
42 const base::Closure& callback,
43 const ErrorCallback& error_callback));
44 MOCK_CONST_METHOD0(IsPresent, bool());
45 MOCK_CONST_METHOD0(IsPowered, bool());
46 MOCK_METHOD3(SetPowered,
47 void(bool powered,
48 const base::Closure& callback,
49 const ErrorCallback& error_callback));
50 MOCK_CONST_METHOD0(IsDiscoverable, bool());
51 MOCK_METHOD3(SetDiscoverable,
52 void(bool discoverable,
53 const base::Closure& callback,
54 const ErrorCallback& error_callback));
55 MOCK_CONST_METHOD0(IsDiscovering, bool());
56 MOCK_METHOD2(StartDiscoverySession,
57 void(const DiscoverySessionCallback& callback,
58 const ErrorCallback& error_callback));
59 MOCK_CONST_METHOD0(GetDevices, BluetoothAdapter::ConstDeviceList());
60 MOCK_METHOD1(GetDevice, BluetoothDevice*(const std::string& address));
61 MOCK_CONST_METHOD1(GetDevice,
62 const BluetoothDevice*(const std::string& address));
63 MOCK_METHOD2(AddPairingDelegate,
64 void(BluetoothDevice::PairingDelegate* pairing_delegate,
65 enum PairingDelegatePriority priority));
66 MOCK_METHOD1(RemovePairingDelegate,
67 void(BluetoothDevice::PairingDelegate* pairing_delegate));
68 MOCK_METHOD0(DefaultPairingDelegate, BluetoothDevice::PairingDelegate*());
69 MOCK_METHOD4(CreateRfcommService,
70 void(const BluetoothUUID& uuid,
71 const ServiceOptions& options,
72 const CreateServiceCallback& callback,
73 const CreateServiceErrorCallback& error_callback));
74 MOCK_METHOD4(CreateL2capService,
75 void(const BluetoothUUID& uuid,
76 const ServiceOptions& options,
77 const CreateServiceCallback& callback,
78 const CreateServiceErrorCallback& error_callback));
80 protected:
81 virtual void AddDiscoverySession(const base::Closure& callback,
82 const ErrorCallback& error_callback);
83 virtual void RemoveDiscoverySession(const base::Closure& callback,
84 const ErrorCallback& error_callback);
85 virtual ~MockBluetoothAdapter();
87 MOCK_METHOD1(RemovePairingDelegateInternal,
88 void(BluetoothDevice::PairingDelegate* pairing_delegate));
91 } // namespace device
93 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_