Chromium Code Reviews| Index: device/bluetooth/test/mock_bluetooth_cbservice_mac.mm |
| diff --git a/device/bluetooth/test/mock_bluetooth_cbservice_mac.mm b/device/bluetooth/test/mock_bluetooth_cbservice_mac.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7dace34b7bf17a3fc5e2adca32d831b614768383 |
| --- /dev/null |
| +++ b/device/bluetooth/test/mock_bluetooth_cbservice_mac.mm |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
|
ortuno
2016/05/06 16:03:35
nit: 2016
jlebel
2016/05/07 00:16:12
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "device/bluetooth/test/mock_bluetooth_cbservice_mac.h" |
| + |
| +#include "base/mac/foundation_util.h" |
| +#include "base/mac/scoped_nsobject.h" |
| +#include "device/bluetooth/test/bluetooth_test.h" |
| + |
| +using base::mac::ObjCCast; |
| +using base::scoped_nsobject; |
| + |
| +@interface MockCBService () { |
| + CBUUID* _UUID; |
| + BOOL _primary; |
| +} |
| + |
| +@end |
| + |
| +@implementation MockCBService |
| + |
| +@synthesize UUID = _UUID; |
| +@synthesize isPrimary = _primary; |
| + |
| +- (instancetype)initWithCBUUID:(CBUUID*)uuid primary:(BOOL)isPrimary { |
| + self = [super init]; |
| + if (self) { |
| + _UUID = uuid; |
| + _primary = isPrimary; |
| + } |
| + return self; |
| +} |
| + |
| +- (BOOL)isKindOfClass:(Class)aClass { |
| + if (aClass == [CBService class] || |
| + [aClass isSubclassOfClass:[CBService class]]) { |
| + return YES; |
| + } |
| + return [super isKindOfClass:aClass]; |
| +} |
| + |
| +- (BOOL)isMemberOfClass:(Class)aClass { |
| + if (aClass == [CBService class] || |
| + [aClass isSubclassOfClass:[CBService class]]) { |
| + return YES; |
| + } |
| + return [super isKindOfClass:aClass]; |
| +} |
| + |
| +- (CBService*)service { |
| + return ObjCCast<CBService>(self); |
| +} |
| + |
| +@end |