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

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: Using FAILED instead of UNKNOWN error code Created 4 years, 10 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 8d0cf366671eb7fbf90f692356861bae5d6b97af..1df5a76cbc3e205f534cf766a7904dc47ad4b1c6 100644
--- a/device/bluetooth/test/bluetooth_test_mac.mm
+++ b/device/bluetooth/test/bluetooth_test_mac.mm
@@ -202,7 +202,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();
@@ -210,14 +212,14 @@ void BluetoothTestMac::SimulateGattDisconnection(BluetoothDevice* device) {
[mockPeripheral setState:CBPeripheralStateDisconnected];
CBCentralManager* centralManager =
static_cast<CBCentralManager*>(mock_central_manager_);
+ NSError* error =
+ BluetoothAdapterMac::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();
@@ -225,14 +227,9 @@ void BluetoothTestMac::SimulateGattConnectionError(
[mockPeripheral setState:CBPeripheralStateDisconnected];
CBCentralManager* centralManager =
static_cast<CBCentralManager*>(mock_central_manager_);
- // 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