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

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

Issue 1685963003: Adding the last test related with connect/disconnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@connectdisconnect
Patch Set: adding DEVICE_BLUETOOTH_EXPORT to BluetoothDeviceMac Created 4 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') | no next file » | 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 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() {
« no previous file with comments | « device/bluetooth/test/bluetooth_test_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698