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

Side by Side 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, 8 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_device_mac.h" 5 #include "device/bluetooth/bluetooth_device_mac.h"
6 6
7 #include "device/bluetooth/bluetooth_adapter_mac.h" 7 #include "device/bluetooth/bluetooth_adapter_mac.h"
8 8
9 static NSString* const kErrorDomain = @"ConnectErrorCode";
10
9 namespace device { 11 namespace device {
10 12
11 BluetoothDeviceMac::BluetoothDeviceMac(BluetoothAdapterMac* adapter) 13 BluetoothDeviceMac::BluetoothDeviceMac(BluetoothAdapterMac* adapter)
12 : BluetoothDevice(adapter) {} 14 : BluetoothDevice(adapter) {}
13 15
14 BluetoothDeviceMac::~BluetoothDeviceMac() { 16 BluetoothDeviceMac::~BluetoothDeviceMac() {
15 } 17 }
16 18
19 NSError* BluetoothDeviceMac::GetNSErrorFromConnectErrorCode(
20 BluetoothDevice::ConnectErrorCode error_code) {
21 // TODO(http://crbug.com/585894): Need to convert the error.
22 return [NSError errorWithDomain:kErrorDomain code:error_code userInfo:nil];
23 }
24
25 BluetoothDevice::ConnectErrorCode
26 BluetoothDeviceMac::GetConnectErrorCodeFromNSError(NSError* error) {
27 if ([error.domain isEqualToString:kErrorDomain]) {
28 BluetoothDevice::ConnectErrorCode connect_error_code =
29 (BluetoothDevice::ConnectErrorCode)error.code;
30 if (connect_error_code >= 0 ||
31 connect_error_code < BluetoothDevice::NUM_CONNECT_ERROR_CODES) {
32 return connect_error_code;
33 }
34 DCHECK(false);
35 return BluetoothDevice::ERROR_FAILED;
36 }
37 // TODO(http://crbug.com/585894): Need to convert the error.
38 return BluetoothDevice::ERROR_FAILED;
39 }
40
17 } // namespace device 41 } // namespace device
OLDNEW
« 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