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

Unified Diff: device/bluetooth/test/mock_bluetooth_gatt_characteristic.cc

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Implement WebBluetooth getDescriptor[s] Created 3 years, 11 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_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

Powered by Google App Engine
This is Rietveld 408576698