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

Unified Diff: device/bluetooth/test/mock_bluetooth_device.h

Issue 1159523002: bluetooth: Browser side partial implementation of getPrimaryService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jyasskin comments 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_device.h
diff --git a/device/bluetooth/test/mock_bluetooth_device.h b/device/bluetooth/test/mock_bluetooth_device.h
index 039c8cec2b17e536ab5ef15e79c77bf720a826b5..98f66f9454b65b12ea2b3a1824a6bc5106f8c9aa 100644
--- a/device/bluetooth/test/mock_bluetooth_device.h
+++ b/device/bluetooth/test/mock_bluetooth_device.h
@@ -7,13 +7,16 @@
#include <string>
+#include "base/memory/scoped_vector.h"
#include "base/strings/string16.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/test/mock_bluetooth_gatt_service.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace device {
+class BluetoothGattService;
class MockBluetoothAdapter;
class MockBluetoothDevice : public BluetoothDevice {
@@ -79,11 +82,20 @@ class MockBluetoothDevice : public BluetoothDevice {
MOCK_CONST_METHOD0(GetGattServices, std::vector<BluetoothGattService*>());
MOCK_CONST_METHOD1(GetGattService, BluetoothGattService*(const std::string&));
+ // BluetoothDevice manages the lifetime of its BluetoothGATTServices.
+ // This methods takes ownership of the BluetoothGATTServices. This is only for
+ // convenience as far as testing is concerned, and it's possible to write test
+ // cases without using these functions.
+ void AddMockService(scoped_ptr<MockBluetoothGattService> mock_device);
+ std::vector<BluetoothGattService*> GetMockServices();
+
private:
uint32 bluetooth_class_;
std::string name_;
std::string address_;
BluetoothDevice::UUIDList uuids_;
+
+ ScopedVector<MockBluetoothGattService> mock_services_;
};
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698