Mark //testing/perf target testonly.
[chromium-blink-merge.git] / device / bluetooth / test / mock_bluetooth_adapter.h
blobfd679361b8bf02fc3e72d3ce9725d2650339e979
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_audio_sink.h"
13 #include "device/bluetooth/bluetooth_device.h"
14 #include "testing/gmock/include/gmock/gmock.h"
16 namespace device {
18 class MockBluetoothAdapter : public BluetoothAdapter {
19 public:
20 class Observer : public BluetoothAdapter::Observer {
21 public:
22 Observer();
23 virtual ~Observer();
25 MOCK_METHOD2(AdapterPresentChanged, void(BluetoothAdapter*, bool));
26 MOCK_METHOD2(AdapterPoweredChanged, void(BluetoothAdapter*, bool));
27 MOCK_METHOD2(AdapterDiscoveringChanged, void(BluetoothAdapter*, bool));
28 MOCK_METHOD2(DeviceAdded, void(BluetoothAdapter*, BluetoothDevice*));
29 MOCK_METHOD2(DeviceChanged, void(BluetoothAdapter*, BluetoothDevice*));
30 MOCK_METHOD2(DeviceRemoved, void(BluetoothAdapter*, BluetoothDevice*));
33 MockBluetoothAdapter();
35 virtual bool IsInitialized() const { return true; }
37 #if defined(OS_CHROMEOS)
38 void Shutdown() override;
39 #endif
40 MOCK_METHOD1(AddObserver, void(BluetoothAdapter::Observer*));
41 MOCK_METHOD1(RemoveObserver, void(BluetoothAdapter::Observer*));
42 MOCK_CONST_METHOD0(GetAddress, std::string());
43 MOCK_CONST_METHOD0(GetName, std::string());
44 MOCK_METHOD3(SetName,
45 void(const std::string& name,
46 const base::Closure& callback,
47 const ErrorCallback& error_callback));
48 MOCK_CONST_METHOD0(IsPresent, bool());
49 MOCK_CONST_METHOD0(IsPowered, bool());
50 MOCK_METHOD3(SetPowered,
51 void(bool powered,
52 const base::Closure& callback,
53 const ErrorCallback& error_callback));
54 MOCK_CONST_METHOD0(IsDiscoverable, bool());
55 MOCK_METHOD3(SetDiscoverable,
56 void(bool discoverable,
57 const base::Closure& callback,
58 const ErrorCallback& error_callback));
59 MOCK_CONST_METHOD0(IsDiscovering, bool());
60 MOCK_METHOD2(StartDiscoverySession,
61 void(const DiscoverySessionCallback& callback,
62 const ErrorCallback& error_callback));
63 MOCK_CONST_METHOD0(GetDevices, BluetoothAdapter::ConstDeviceList());
64 MOCK_METHOD1(GetDevice, BluetoothDevice*(const std::string& address));
65 MOCK_CONST_METHOD1(GetDevice,
66 const BluetoothDevice*(const std::string& address));
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*());
73 MOCK_METHOD4(CreateRfcommService,
74 void(const BluetoothUUID& uuid,
75 const ServiceOptions& options,
76 const CreateServiceCallback& callback,
77 const CreateServiceErrorCallback& error_callback));
78 MOCK_METHOD4(CreateL2capService,
79 void(const BluetoothUUID& uuid,
80 const ServiceOptions& options,
81 const CreateServiceCallback& callback,
82 const CreateServiceErrorCallback& error_callback));
83 MOCK_METHOD3(RegisterAudioSink,
84 void(const BluetoothAudioSink::Options& options,
85 const AcquiredCallback& callback,
86 const BluetoothAudioSink::ErrorCallback& error_callback));
88 protected:
89 void DeleteOnCorrectThread() const override;
90 virtual void AddDiscoverySession(const base::Closure& callback,
91 const ErrorCallback& error_callback);
92 virtual void RemoveDiscoverySession(const base::Closure& callback,
93 const ErrorCallback& error_callback);
94 virtual ~MockBluetoothAdapter();
96 MOCK_METHOD1(RemovePairingDelegateInternal,
97 void(BluetoothDevice::PairingDelegate* pairing_delegate));
100 } // namespace device
102 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_