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

Side by Side Diff: device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm

Issue 2009753002: bluetooth: Make public BluetoothDevice::GetName method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out name/alias Created 4 years, 5 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
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/test/mock_bluetooth_cbperipheral_mac.h" 5 #include "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "device/bluetooth/test/bluetooth_test_mac.h" 9 #include "device/bluetooth/test/bluetooth_test_mac.h"
10 #include "device/bluetooth/test/mock_bluetooth_cbservice_mac.h" 10 #include "device/bluetooth/test/mock_bluetooth_cbservice_mac.h"
(...skipping 15 matching lines...) Expand all
26 @synthesize state = _state; 26 @synthesize state = _state;
27 @synthesize delegate = _delegate; 27 @synthesize delegate = _delegate;
28 @synthesize bluetoothTestMac = _bluetoothTestMac; 28 @synthesize bluetoothTestMac = _bluetoothTestMac;
29 29
30 - (instancetype)init { 30 - (instancetype)init {
31 [self doesNotRecognizeSelector:_cmd]; 31 [self doesNotRecognizeSelector:_cmd];
32 return self; 32 return self;
33 } 33 }
34 34
35 - (instancetype)initWithUTF8StringIdentifier:(const char*)utf8Identifier { 35 - (instancetype)initWithUTF8StringIdentifier:(const char*)utf8Identifier {
36 return [self initWithUTF8StringIdentifier:utf8Identifier name:nil];
37 }
38
39 - (instancetype)initWithUTF8StringIdentifier:(const char*)utf8Identifier
40 name:(NSString*)name {
36 scoped_nsobject<NSUUID> identifier( 41 scoped_nsobject<NSUUID> identifier(
37 [[NSUUID alloc] initWithUUIDString:@(utf8Identifier)]); 42 [[NSUUID alloc] initWithUUIDString:@(utf8Identifier)]);
38 return [self initWithIdentifier:identifier name:nil]; 43 return [self initWithIdentifier:identifier name:name];
39 }
40
41 - (instancetype)initWithIdentifier:(NSUUID*)identifier {
42 return [self initWithIdentifier:identifier name:nil];
43 } 44 }
44 45
45 - (instancetype)initWithIdentifier:(NSUUID*)identifier name:(NSString*)name { 46 - (instancetype)initWithIdentifier:(NSUUID*)identifier name:(NSString*)name {
46 self = [super init]; 47 self = [super init];
47 if (self) { 48 if (self) {
48 _identifier.reset([identifier retain]); 49 _identifier.reset([identifier retain]);
49 if (name) { 50 if (name) {
50 _name.reset([name retain]); 51 _name.reset([name retain]);
51 } else {
52 _name.reset(
53 [@(device::BluetoothTestBase::kTestDeviceName.c_str()) retain]);
54 } 52 }
55 _state = CBPeripheralStateDisconnected; 53 _state = CBPeripheralStateDisconnected;
56 } 54 }
57 return self; 55 return self;
58 } 56 }
59 57
60 - (BOOL)isKindOfClass:(Class)aClass { 58 - (BOOL)isKindOfClass:(Class)aClass {
61 if (aClass == [CBPeripheral class] || 59 if (aClass == [CBPeripheral class] ||
62 [aClass isSubclassOfClass:[CBPeripheral class]]) { 60 [aClass isSubclassOfClass:[CBPeripheral class]]) {
63 return YES; 61 return YES;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 - (CBPeripheral*)peripheral { 167 - (CBPeripheral*)peripheral {
170 return ObjCCast<CBPeripheral>(self); 168 return ObjCCast<CBPeripheral>(self);
171 } 169 }
172 170
173 - (void)setNotifyValue:(BOOL)notification 171 - (void)setNotifyValue:(BOOL)notification
174 forCharacteristic:(CBCharacteristic*)characteristic { 172 forCharacteristic:(CBCharacteristic*)characteristic {
175 _bluetoothTestMac->OnFakeBluetoothGattSetCharacteristicNotification(); 173 _bluetoothTestMac->OnFakeBluetoothGattSetCharacteristicNotification();
176 } 174 }
177 175
178 @end 176 @end
OLDNEW
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h ('k') | device/bluetooth/test/mock_bluetooth_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698