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

Unified Diff: device/bluetooth/test/bluetooth_test_mac.mm

Issue 2641133003: Bluetooth: macOS: Adding counter for service discovery callbacks. (Closed)
Patch Set: Adding comment Created 3 years, 9 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
« no previous file with comments | « device/bluetooth/test/bluetooth_test_mac.h ('k') | device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/bluetooth_test_mac.mm
diff --git a/device/bluetooth/test/bluetooth_test_mac.mm b/device/bluetooth/test/bluetooth_test_mac.mm
index 41b5748f1050c3bbc12e3a893f0c0867a43b604a..be4d037b1026c733f9fd0135b35c5ebd235f4633 100644
--- a/device/bluetooth/test/bluetooth_test_mac.mm
+++ b/device/bluetooth/test/bluetooth_test_mac.mm
@@ -467,6 +467,7 @@ void BluetoothTestMac::SimulateGattCharacteristicRemoved(
MockCBCharacteristic* characteristic_mock =
ObjCCast<MockCBCharacteristic>(cb_characteristic);
[service_mock removeCharacteristicMock:characteristic_mock];
+ [peripheral_mock didModifyServices:@[]];
[peripheral_mock mockDidDiscoverEvents];
}
@@ -487,6 +488,22 @@ void BluetoothTestMac::ExpectedNotifyValue(
}
}
+void BluetoothTestMac::SimulateDidDiscoverServices(
+ BluetoothDevice* device,
+ const std::vector<std::string>& uuids) {
+ BluetoothLowEnergyDeviceMac* device_mac =
+ static_cast<BluetoothLowEnergyDeviceMac*>(device);
+ CBPeripheral* peripheral = device_mac->GetPeripheral();
+ MockCBPeripheral* peripheral_mock = ObjCCast<MockCBPeripheral>(peripheral);
+ scoped_nsobject<NSMutableArray> services([[NSMutableArray alloc] init]);
+ for (auto uuid : uuids) {
+ CBUUID* cb_service_uuid = [CBUUID UUIDWithString:@(uuid.c_str())];
+ [services addObject:cb_service_uuid];
+ }
+ [peripheral_mock addServices:services];
+ [peripheral_mock mockDidDiscoverServices];
+}
+
void BluetoothTestMac::OnFakeBluetoothDeviceConnectGattCalled() {
gatt_connection_attempts_++;
}
@@ -499,6 +516,10 @@ void BluetoothTestMac::OnFakeBluetoothServiceDiscovery() {
gatt_discovery_attempts_++;
}
+void BluetoothTestMac::OnFakeBluetoothCharacteristicDiscovery() {
+ gatt_characteristic_discovery_attempts_++;
+}
+
void BluetoothTest::OnFakeBluetoothCharacteristicReadValue() {
gatt_read_characteristic_attempts_++;
}
« no previous file with comments | « device/bluetooth/test/bluetooth_test_mac.h ('k') | device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698