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

Unified Diff: device/bluetooth/bluetooth_device_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/bluetooth_device_mac.h ('k') | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_mac.mm
diff --git a/device/bluetooth/bluetooth_device_mac.mm b/device/bluetooth/bluetooth_device_mac.mm
index 2725faeab07dcecbf5806b9799fee147ece7b549..a2f3274dbf8ec525f52ebfb4acbf25b68012020b 100644
--- a/device/bluetooth/bluetooth_device_mac.mm
+++ b/device/bluetooth/bluetooth_device_mac.mm
@@ -6,6 +6,8 @@
#include "device/bluetooth/bluetooth_adapter_mac.h"
+static NSString* const kErrorDomain = @"ConnectErrorCode";
+
namespace device {
BluetoothDeviceMac::BluetoothDeviceMac(BluetoothAdapterMac* adapter)
@@ -14,4 +16,26 @@ BluetoothDeviceMac::BluetoothDeviceMac(BluetoothAdapterMac* adapter)
BluetoothDeviceMac::~BluetoothDeviceMac() {
}
+NSError* BluetoothDeviceMac::GetNSErrorFromConnectErrorCode(
+ BluetoothDevice::ConnectErrorCode error_code) {
+ // TODO(http://crbug.com/585894): Need to convert the error.
+ return [NSError errorWithDomain:kErrorDomain code:error_code userInfo:nil];
+}
+
+BluetoothDevice::ConnectErrorCode
+BluetoothDeviceMac::GetConnectErrorCodeFromNSError(NSError* error) {
+ if ([error.domain isEqualToString:kErrorDomain]) {
+ BluetoothDevice::ConnectErrorCode connect_error_code =
+ (BluetoothDevice::ConnectErrorCode)error.code;
+ if (connect_error_code >= 0 ||
+ connect_error_code < BluetoothDevice::NUM_CONNECT_ERROR_CODES) {
+ return connect_error_code;
+ }
+ DCHECK(false);
+ return BluetoothDevice::ERROR_FAILED;
+ }
+ // TODO(http://crbug.com/585894): Need to convert the error.
+ return BluetoothDevice::ERROR_FAILED;
+}
+
} // namespace device
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.h ('k') | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698