Index: device/bluetooth/test/mock_bluetooth_gatt_characteristic.cc |
diff --git a/device/bluetooth/test/mock_bluetooth_gatt_characteristic.cc b/device/bluetooth/test/mock_bluetooth_gatt_characteristic.cc |
index b2147d958144c4512e938b30708f788aa779212b..8e6c71132dddaa359932d40bba1518c4c3df7820 100644 |
--- a/device/bluetooth/test/mock_bluetooth_gatt_characteristic.cc |
+++ b/device/bluetooth/test/mock_bluetooth_gatt_characteristic.cc |
@@ -3,7 +3,7 @@ |
// found in the LICENSE file. |
#include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" |
- |
+#include "device/bluetooth/test/mock_bluetooth_gatt_descriptor.h" |
#include "device/bluetooth/test/mock_bluetooth_gatt_service.h" |
using testing::Return; |
@@ -35,4 +35,29 @@ MockBluetoothGattCharacteristic::MockBluetoothGattCharacteristic( |
MockBluetoothGattCharacteristic::~MockBluetoothGattCharacteristic() { |
} |
+void MockBluetoothGattCharacteristic::AddMockDescriptor( |
+ std::unique_ptr<MockBluetoothGattDescriptor> mock_descriptor) { |
+ mock_descriptors_.push_back(std::move(mock_descriptor)); |
+} |
+ |
+std::vector<BluetoothRemoteGattDescriptor*> |
+MockBluetoothGattCharacteristic::GetMockDescriptors() const { |
+ std::vector<BluetoothRemoteGattDescriptor*> descriptors; |
+ for (auto& descriptor : mock_descriptors_) { |
+ descriptors.push_back(descriptor.get()); |
+ } |
+ return descriptors; |
+} |
+ |
+BluetoothRemoteGattDescriptor* |
+MockBluetoothGattCharacteristic::GetMockDescriptor( |
+ const std::string& identifier) const { |
+ for (auto& descriptor : mock_descriptors_) { |
+ if (descriptor->GetIdentifier() == identifier) { |
+ return descriptor.get(); |
+ } |
+ } |
+ return nullptr; |
+} |
+ |
} // namespace device |