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); |
}; |