| 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 0563fd431e50eabc4d9c14f067d2671b0ca38a68..f4046ef5ce54ab91e54597465d890990ac2e51d9 100644
|
| --- a/device/bluetooth/test/bluetooth_test_mac.mm
|
| +++ b/device/bluetooth/test/bluetooth_test_mac.mm
|
| @@ -187,7 +187,9 @@ void BluetoothTestMac::SimulateGattConnection(BluetoothDevice* device) {
|
| didConnectPeripheral:peripheral];
|
| }
|
|
|
| -void BluetoothTestMac::SimulateGattDisconnection(BluetoothDevice* device) {
|
| +void BluetoothTestMac::SimulateGattConnectionError(
|
| + BluetoothDevice* device,
|
| + BluetoothDevice::ConnectErrorCode errorCode) {
|
| BluetoothLowEnergyDeviceMac* lowEnergyDeviceMac =
|
| static_cast<BluetoothLowEnergyDeviceMac*>(device);
|
| CBPeripheral* peripheral = lowEnergyDeviceMac->GetPeripheral();
|
| @@ -195,14 +197,14 @@ void BluetoothTestMac::SimulateGattDisconnection(BluetoothDevice* device) {
|
| [mockPeripheral setState:CBPeripheralStateDisconnected];
|
| CBCentralManager* centralManager =
|
| ObjCCast<CBCentralManager>(mock_central_manager_->get());
|
| + NSError* error =
|
| + BluetoothDeviceMac::GetNSErrorFromConnectErrorCode(errorCode);
|
| [centralManager.delegate centralManager:centralManager
|
| - didDisconnectPeripheral:peripheral
|
| - error:nil];
|
| + didFailToConnectPeripheral:peripheral
|
| + error:error];
|
| }
|
|
|
| -void BluetoothTestMac::SimulateGattConnectionError(
|
| - BluetoothDevice* device,
|
| - BluetoothDevice::ConnectErrorCode errorCode) {
|
| +void BluetoothTestMac::SimulateGattDisconnection(BluetoothDevice* device) {
|
| BluetoothLowEnergyDeviceMac* lowEnergyDeviceMac =
|
| static_cast<BluetoothLowEnergyDeviceMac*>(device);
|
| CBPeripheral* peripheral = lowEnergyDeviceMac->GetPeripheral();
|
| @@ -210,14 +212,9 @@ void BluetoothTestMac::SimulateGattConnectionError(
|
| [mockPeripheral setState:CBPeripheralStateDisconnected];
|
| CBCentralManager* centralManager =
|
| ObjCCast<CBCentralManager>(mock_central_manager_->get());
|
| - // TODO(http://crbug.com/585894): Need to convert the connect error code into
|
| - // NSError
|
| - NSError* error = [NSError errorWithDomain:@"BluetoothDevice::ConnectErrorCode"
|
| - code:-1
|
| - userInfo:nil];
|
| [centralManager.delegate centralManager:centralManager
|
| - didFailToConnectPeripheral:peripheral
|
| - error:error];
|
| + didDisconnectPeripheral:peripheral
|
| + error:nil];
|
| }
|
|
|
| void BluetoothTestMac::OnFakeBluetoothDeviceConnectGattCalled() {
|
|
|