Chromium Code Reviews| 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( |
|
ortuno
2017/03/06 09:49:55
Seems like we are repeating a lot of code from Sim
jlebel
2017/03/06 22:13:20
crrev.com/2738563002
|
| + 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_++; |
| } |