Implement chrome.bluetoothSocket.connect()
[chromium-blink-merge.git] / device / bluetooth / test / mock_bluetooth_adapter.h
blobee03353ad52d390173386e696d8bb72e83655824
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(
64 ReadLocalOutOfBandPairingData,
65 void(const BluetoothOutOfBandPairingDataCallback& callback,
66 const ErrorCallback& error_callback));
67 MOCK_METHOD2(AddPairingDelegate,
68 void(BluetoothDevice::PairingDelegate* pairing_delegate,
69 enum PairingDelegatePriority priority));
70 MOCK_METHOD1(RemovePairingDelegate,
71 void(BluetoothDevice::PairingDelegate* pairing_delegate));
72 MOCK_METHOD0(DefaultPairingDelegate, BluetoothDevice::PairingDelegate*());
74 protected:
75 virtual void AddDiscoverySession(const base::Closure& callback,
76 const ErrorCallback& error_callback);
77 virtual void RemoveDiscoverySession(const base::Closure& callback,
78 const ErrorCallback& error_callback);
79 virtual ~MockBluetoothAdapter();
81 MOCK_METHOD1(RemovePairingDelegateInternal,
82 void(BluetoothDevice::PairingDelegate* pairing_delegate));
85 } // namespace device
87 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_