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

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

Issue 2595373003: Bluetooth: mac: Working on macOS descriptor implementation. (Closed)
Patch Set: Fixes Created 3 years, 11 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.h"
6
7 #include "base/mac/foundation_util.h"
8 #include "base/mac/scoped_nsobject.h"
9 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
10
11 using base::mac::ObjCCast;
12 using base::scoped_nsobject;
13
14 @interface MockCBDescriptor () {
15 // Owner of this instance.
16 CBCharacteristic* _characteristic;
17 scoped_nsobject<CBUUID> _UUID;
18 }
19 @end
20
21 @implementation MockCBDescriptor
22
23 - (instancetype)initWithCharacteristic:(CBCharacteristic*)characteristic
24 CBUUID:(CBUUID*)uuid {
25 self = [super init];
26 if (self) {
27 _characteristic = characteristic;
28 _UUID.reset([uuid retain]);
29 }
30 return self;
31 }
32
33 - (BOOL)isKindOfClass:(Class)aClass {
34 if (aClass == [CBDescriptor class] ||
35 [aClass isSubclassOfClass:[CBDescriptor class]]) {
36 return YES;
37 }
38 return [super isKindOfClass:aClass];
39 }
40
41 - (BOOL)isMemberOfClass:(Class)aClass {
42 if (aClass == [CBDescriptor class] ||
43 [aClass isSubclassOfClass:[CBDescriptor class]]) {
44 return YES;
45 }
46 return [super isKindOfClass:aClass];
47 }
48
49 - (CBUUID*)UUID {
50 return _UUID.get();
51 }
52
53 - (CBDescriptor*)descriptor {
54 return ObjCCast<CBDescriptor>(self);
55 }
56
57 - (CBCharacteristic*)characteristic {
58 return _characteristic;
59 }
60
61 @end
OLDNEW
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.h ('k') | device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698