Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: device/bluetooth/test/mock_bluetooth_adapter.h

Issue 1132943002: bluetooth: Move mock creation out of BluetoothDispatcherHost to LayoutTestBluetoothAdapterProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-testing-layout-tests
Patch Set: Fix API tests failing Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/test/layouttest_support.cc ('k') | device/bluetooth/test/mock_bluetooth_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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. This is only for
106 // convenience as far testing is concerned and it's possible to write test
107 // cases without using these functions.
108 void AddMockDevice(scoped_ptr<MockBluetoothDevice> mock_device);
109 BluetoothAdapter::ConstDeviceList GetConstMockDevices();
110 BluetoothAdapter::DeviceList GetMockDevices();
111
102 protected: 112 protected:
103 void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, 113 void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter,
104 const base::Closure& callback, 114 const base::Closure& callback,
105 const ErrorCallback& error_callback) override; 115 const ErrorCallback& error_callback) override;
106 void RemoveDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, 116 void RemoveDiscoverySession(BluetoothDiscoveryFilter* discovery_filter,
107 const base::Closure& callback, 117 const base::Closure& callback,
108 const ErrorCallback& error_callback) override; 118 const ErrorCallback& error_callback) override;
109 void SetDiscoveryFilter(scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, 119 void SetDiscoveryFilter(scoped_ptr<BluetoothDiscoveryFilter> discovery_filter,
110 const base::Closure& callback, 120 const base::Closure& callback,
111 const ErrorCallback& error_callback) override; 121 const ErrorCallback& error_callback) override;
112 void RegisterAdvertisement( 122 void RegisterAdvertisement(
113 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, 123 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data,
114 const CreateAdvertisementCallback& callback, 124 const CreateAdvertisementCallback& callback,
115 const CreateAdvertisementErrorCallback& error_callback) override; 125 const CreateAdvertisementErrorCallback& error_callback) override;
116 virtual ~MockBluetoothAdapter(); 126 virtual ~MockBluetoothAdapter();
117 127
118 MOCK_METHOD1(RemovePairingDelegateInternal, 128 MOCK_METHOD1(RemovePairingDelegateInternal,
119 void(BluetoothDevice::PairingDelegate* pairing_delegate)); 129 void(BluetoothDevice::PairingDelegate* pairing_delegate));
130
131 ScopedVector<MockBluetoothDevice> mock_devices_;
120 }; 132 };
121 133
122 } // namespace device 134 } // namespace device
123 135
124 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ 136 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_
OLDNEW
« no previous file with comments | « content/test/layouttest_support.cc ('k') | device/bluetooth/test/mock_bluetooth_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698