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

Unified Diff: device/bluetooth/test/mock_bluetooth_cbservice_mac.mm

Issue 1950033002: bluetooth: mac: Initial BluetoothRemoteGattCharacteristicMac implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@servicescan_cleanup
Patch Set: Fixing the build Created 4 years, 6 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
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbservice_mac.h ('k') | device/device_tests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 48337c8e95a47e31605d4d70dc1e1dd502f15133..4e06976fdb7707782d6708ce8a7cdde01f75a3c8 100644
--- a/device/bluetooth/test/mock_bluetooth_cbservice_mac.mm
+++ b/device/bluetooth/test/mock_bluetooth_cbservice_mac.mm
@@ -7,13 +7,17 @@
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "device/bluetooth/test/bluetooth_test.h"
+#include "device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h"
using base::mac::ObjCCast;
using base::scoped_nsobject;
@interface MockCBService () {
+ // Owner of this instance.
+ CBPeripheral* _peripheral;
scoped_nsobject<CBUUID> _UUID;
BOOL _primary;
+ scoped_nsobject<NSMutableArray> _characteristics;
}
@end
@@ -22,11 +26,15 @@ using base::scoped_nsobject;
@synthesize isPrimary = _primary;
-- (instancetype)initWithCBUUID:(CBUUID*)uuid primary:(BOOL)isPrimary {
+- (instancetype)initWithPeripheral:(CBPeripheral*)peripheral
+ CBUUID:(CBUUID*)uuid
+ primary:(BOOL)isPrimary {
self = [super init];
if (self) {
_UUID.reset([uuid retain]);
_primary = isPrimary;
+ _peripheral = peripheral;
+ _characteristics.reset([[NSMutableArray alloc] init]);
}
return self;
}
@@ -47,12 +55,31 @@ using base::scoped_nsobject;
return [super isKindOfClass:aClass];
}
+- (CBPeripheral*)peripheral {
+ return _peripheral;
+}
+
- (CBUUID*)UUID {
return _UUID.get();
}
+- (void)addCharacteristicWithUUID:(CBUUID*)cb_uuid properties:(int)properties {
+ scoped_nsobject<MockCBCharacteristic> characteristic_mock(
+ [[MockCBCharacteristic alloc] initWithCBUUID:cb_uuid
+ properties:properties]);
+ [_characteristics.get() addObject:characteristic_mock];
+}
+
+- (void)removeCharacteristicMock:(MockCBCharacteristic*)characteristic_mock {
+ [_characteristics.get() removeObject:characteristic_mock];
+}
+
- (CBService*)service {
return ObjCCast<CBService>(self);
}
+- (NSArray*)characteristics {
+ return _characteristics.get();
+}
+
@end
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbservice_mac.h ('k') | device/device_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698