OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ |
6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/scoped_vector.h" |
11 #include "device/bluetooth/bluetooth_adapter.h" | 12 #include "device/bluetooth/bluetooth_adapter.h" |
12 #include "device/bluetooth/bluetooth_audio_sink.h" | 13 #include "device/bluetooth/bluetooth_audio_sink.h" |
13 #include "device/bluetooth/bluetooth_device.h" | 14 #include "device/bluetooth/bluetooth_device.h" |
14 #include "device/bluetooth/bluetooth_discovery_session.h" | 15 #include "device/bluetooth/bluetooth_discovery_session.h" |
| 16 #include "device/bluetooth/test/mock_bluetooth_device.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
16 | 18 |
17 namespace device { | 19 namespace device { |
18 | 20 |
19 class MockBluetoothAdapter : public BluetoothAdapter { | 21 class MockBluetoothAdapter : public BluetoothAdapter { |
20 public: | 22 public: |
21 class Observer : public BluetoothAdapter::Observer { | 23 class Observer : public BluetoothAdapter::Observer { |
22 public: | 24 public: |
23 Observer(); | 25 Observer(); |
24 virtual ~Observer(); | 26 virtual ~Observer(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 MOCK_METHOD3(RegisterAudioSink, | 94 MOCK_METHOD3(RegisterAudioSink, |
93 void(const BluetoothAudioSink::Options& options, | 95 void(const BluetoothAudioSink::Options& options, |
94 const AcquiredCallback& callback, | 96 const AcquiredCallback& callback, |
95 const BluetoothAudioSink::ErrorCallback& error_callback)); | 97 const BluetoothAudioSink::ErrorCallback& error_callback)); |
96 | 98 |
97 void StartDiscoverySessionWithFilter( | 99 void StartDiscoverySessionWithFilter( |
98 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, | 100 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, |
99 const DiscoverySessionCallback& callback, | 101 const DiscoverySessionCallback& callback, |
100 const ErrorCallback& error_callback); | 102 const ErrorCallback& error_callback); |
101 | 103 |
| 104 // BluetoothAdapter is supposed to manage the lifetime of BluetoothDevices. |
| 105 // This methods takes ownership of the BluetoothDevices. |
| 106 void AddMockDevice(scoped_ptr<MockBluetoothDevice> mock_device); |
| 107 BluetoothAdapter::ConstDeviceList GetMockDevices(); |
| 108 |
102 protected: | 109 protected: |
103 void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, | 110 void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, |
104 const base::Closure& callback, | 111 const base::Closure& callback, |
105 const ErrorCallback& error_callback) override; | 112 const ErrorCallback& error_callback) override; |
106 void RemoveDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, | 113 void RemoveDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, |
107 const base::Closure& callback, | 114 const base::Closure& callback, |
108 const ErrorCallback& error_callback) override; | 115 const ErrorCallback& error_callback) override; |
109 void SetDiscoveryFilter(scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, | 116 void SetDiscoveryFilter(scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, |
110 const base::Closure& callback, | 117 const base::Closure& callback, |
111 const ErrorCallback& error_callback) override; | 118 const ErrorCallback& error_callback) override; |
112 void RegisterAdvertisement( | 119 void RegisterAdvertisement( |
113 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, | 120 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, |
114 const CreateAdvertisementCallback& callback, | 121 const CreateAdvertisementCallback& callback, |
115 const CreateAdvertisementErrorCallback& error_callback) override; | 122 const CreateAdvertisementErrorCallback& error_callback) override; |
116 virtual ~MockBluetoothAdapter(); | 123 virtual ~MockBluetoothAdapter(); |
117 | 124 |
118 MOCK_METHOD1(RemovePairingDelegateInternal, | 125 MOCK_METHOD1(RemovePairingDelegateInternal, |
119 void(BluetoothDevice::PairingDelegate* pairing_delegate)); | 126 void(BluetoothDevice::PairingDelegate* pairing_delegate)); |
| 127 |
| 128 ScopedVector<MockBluetoothDevice> mock_devices_; |
120 }; | 129 }; |
121 | 130 |
122 } // namespace device | 131 } // namespace device |
123 | 132 |
124 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ | 133 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ |
OLD | NEW |