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_
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"
17 class MockBluetoothAdapter
: public BluetoothAdapter
{
19 class Observer
: public BluetoothAdapter::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());
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
,
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
));
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
));
93 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_