| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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_cbservice_mac.h" |
| 6 |
| 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "device/bluetooth/test/bluetooth_test.h" |
| 10 |
| 11 using base::mac::ObjCCast; |
| 12 using base::scoped_nsobject; |
| 13 |
| 14 @interface MockCBService () { |
| 15 CBUUID* _UUID; |
| 16 BOOL _primary; |
| 17 } |
| 18 |
| 19 @end |
| 20 |
| 21 @implementation MockCBService |
| 22 |
| 23 @synthesize UUID = _UUID; |
| 24 @synthesize isPrimary = _primary; |
| 25 |
| 26 - (instancetype)initWithCBUUID:(CBUUID*)uuid primary:(BOOL)isPrimary { |
| 27 self = [super init]; |
| 28 if (self) { |
| 29 _UUID = [uuid retain]; |
| 30 _primary = isPrimary; |
| 31 } |
| 32 return self; |
| 33 } |
| 34 |
| 35 - (void)dealloc { |
| 36 [_UUID release]; |
| 37 [super dealloc]; |
| 38 } |
| 39 |
| 40 - (BOOL)isKindOfClass:(Class)aClass { |
| 41 if (aClass == [CBService class] || |
| 42 [aClass isSubclassOfClass:[CBService class]]) { |
| 43 return YES; |
| 44 } |
| 45 return [super isKindOfClass:aClass]; |
| 46 } |
| 47 |
| 48 - (BOOL)isMemberOfClass:(Class)aClass { |
| 49 if (aClass == [CBService class] || |
| 50 [aClass isSubclassOfClass:[CBService class]]) { |
| 51 return YES; |
| 52 } |
| 53 return [super isKindOfClass:aClass]; |
| 54 } |
| 55 |
| 56 - (CBService*)service { |
| 57 return ObjCCast<CBService>(self); |
| 58 } |
| 59 |
| 60 @end |
| OLD | NEW |