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

Unified 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: Add non const method 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/test/mock_bluetooth_adapter.h
diff --git a/device/bluetooth/test/mock_bluetooth_adapter.h b/device/bluetooth/test/mock_bluetooth_adapter.h
index e1523f9a6eb5793153290d1814994da3e30ef026..3246de9e331356335ccda248cc88ae12bd77d02b 100644
--- a/device/bluetooth/test/mock_bluetooth_adapter.h
+++ b/device/bluetooth/test/mock_bluetooth_adapter.h
@@ -8,10 +8,12 @@
#include <string>
#include "base/callback.h"
+#include "base/memory/scoped_vector.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_audio_sink.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_discovery_session.h"
+#include "device/bluetooth/test/mock_bluetooth_device.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace device {
@@ -69,6 +71,7 @@ class MockBluetoothAdapter : public BluetoothAdapter {
void(const BluetoothDiscoveryFilter*,
const base::Closure& callback,
const ErrorCallback& error_callback));
+ MOCK_METHOD0(GetDevices, BluetoothAdapter::DeviceList());
MOCK_CONST_METHOD0(GetDevices, BluetoothAdapter::ConstDeviceList());
MOCK_METHOD1(GetDevice, BluetoothDevice*(const std::string& address));
MOCK_CONST_METHOD1(GetDevice,
@@ -99,6 +102,11 @@ class MockBluetoothAdapter : public BluetoothAdapter {
const DiscoverySessionCallback& callback,
const ErrorCallback& error_callback);
+ // BluetoothAdapter is supposed to manage the lifetime of BluetoothDevices.
+ // This methods takes ownership of the BluetoothDevices.
armansito 2015/05/19 20:18:33 I would mention here that this is only for conveni
ortuno 2015/05/19 22:25:00 Done.
+ void AddMockDevice(scoped_ptr<MockBluetoothDevice> mock_device);
+ BluetoothAdapter::DeviceList GetMockDevices();
+
protected:
void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter,
const base::Closure& callback,
@@ -117,6 +125,8 @@ class MockBluetoothAdapter : public BluetoothAdapter {
MOCK_METHOD1(RemovePairingDelegateInternal,
void(BluetoothDevice::PairingDelegate* pairing_delegate));
+
+ ScopedVector<MockBluetoothDevice> mock_devices_;
};
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698