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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm
diff --git a/device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm b/device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..9c8512b5142a99d2d765d2fdbfd5099525492e0e
--- /dev/null
+++ b/device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm
@@ -0,0 +1,61 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// 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_cbdescriptor_mac.h"
+
+#include "base/mac/foundation_util.h"
+#include "base/mac/scoped_nsobject.h"
+#include "device/bluetooth/bluetooth_gatt_characteristic.h"
+
+using base::mac::ObjCCast;
+using base::scoped_nsobject;
+
+@interface MockCBDescriptor () {
+ // Owner of this instance.
+ CBCharacteristic* _characteristic;
+ scoped_nsobject<CBUUID> _UUID;
+}
+@end
+
+@implementation MockCBDescriptor
+
+- (instancetype)initWithCharacteristic:(CBCharacteristic*)characteristic
+ CBUUID:(CBUUID*)uuid {
+ self = [super init];
+ if (self) {
+ _characteristic = characteristic;
+ _UUID.reset([uuid retain]);
+ }
+ return self;
+}
+
+- (BOOL)isKindOfClass:(Class)aClass {
+ if (aClass == [CBDescriptor class] ||
+ [aClass isSubclassOfClass:[CBDescriptor class]]) {
+ return YES;
+ }
+ return [super isKindOfClass:aClass];
+}
+
+- (BOOL)isMemberOfClass:(Class)aClass {
+ if (aClass == [CBDescriptor class] ||
+ [aClass isSubclassOfClass:[CBDescriptor class]]) {
+ return YES;
+ }
+ return [super isKindOfClass:aClass];
+}
+
+- (CBUUID*)UUID {
+ return _UUID.get();
+}
+
+- (CBDescriptor*)descriptor {
+ return ObjCCast<CBDescriptor>(self);
+}
+
+- (CBCharacteristic*)characteristic {
+ return _characteristic;
+}
+
+@end
« 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