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

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

Issue 1156573005: bluetooth: Browser-side implementation of getCharacteristic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-get-primary-service-initial
Patch Set: Fix histograms.xml and bad_messages.h merge conflict Created 5 years, 6 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_gatt_service.h
diff --git a/device/bluetooth/test/mock_bluetooth_gatt_service.h b/device/bluetooth/test/mock_bluetooth_gatt_service.h
index b03adfae16b6c22e65a3a948203add3eaee28661..1ba3deaf58410bc9448d9a7c1e05d0302dbae543 100644
--- a/device/bluetooth/test/mock_bluetooth_gatt_service.h
+++ b/device/bluetooth/test/mock_bluetooth_gatt_service.h
@@ -8,8 +8,10 @@
#include <string>
#include <vector>
+#include "base/memory/scoped_vector.h"
#include "device/bluetooth/bluetooth_gatt_service.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace device {
@@ -41,7 +43,23 @@ class MockBluetoothGattService : public BluetoothGattService {
MOCK_METHOD2(Register, void(const base::Closure&, const ErrorCallback&));
MOCK_METHOD2(Unregister, void(const base::Closure&, const ErrorCallback&));
+ // BluetoothGattService manages the lifetime of its
+ // BluetoothGATTCharacteristics.
+ // This method takes ownership of the MockBluetoothGATTCharacteristics. This
+ // is only for convenience as far as testing is concerned, and it's possible
+ // to write test cases without using these functions.
+ // Example:
+ // ON_CALL(*mock_service, GetCharacteristics))
+ // .WillByDefault(Invoke(
+ // *mock_service,
+ // &MockBluetoothGattService::GetMockCharacteristics));
+ void AddMockCharacteristic(
+ scoped_ptr<MockBluetoothGattCharacteristic> mock_characteristic);
+ std::vector<BluetoothGattCharacteristic*> GetMockCharacteristics() const;
+
private:
+ ScopedVector<MockBluetoothGattCharacteristic> mock_characteristics_;
+
DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattService);
};
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_device.cc ('k') | device/bluetooth/test/mock_bluetooth_gatt_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698