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

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

Issue 2339253002: bluetooth: mac: add connected LE devices to chooser (Closed)
Patch Set: Adding BluetoothAdapter::RetrievedConnectedPeripherals() and the implementation in BluetoothAdapter… Created 4 years, 3 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_central_manager_mac.mm
diff --git a/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm b/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm
index fbb0dff41e75d315a5044a6e61dde508fe7382fd..ced601c5eb2649a0fc0bb8613dc6ec52b41cae7c 100644
--- a/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm
+++ b/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm
@@ -7,7 +7,9 @@
#import "device/bluetooth/test/bluetooth_test_mac.h"
#import "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h"
-@implementation MockCentralManager
+@implementation MockCentralManager {
+ NSMutableArray* _connectedMockPeripheral;
+}
@synthesize scanForPeripheralsCallCount = _scanForPeripheralsCallCount;
@synthesize stopScanCallCount = _stopScanCallCount;
@@ -15,6 +17,19 @@
@synthesize state = _state;
@synthesize bluetoothTestMac = _bluetoothTestMac;
+- (instancetype)init {
+ self = [super init];
+ if (self) {
+ _connectedMockPeripheral = [[NSMutableArray alloc] init];
ortuno 2016/09/28 23:15:52 What do you think of the following ideas: Instead
jlebel 2016/10/05 14:09:41 Done.
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_connectedMockPeripheral release];
+ [super dealloc];
+}
+
- (BOOL)isKindOfClass:(Class)aClass {
if (aClass == [CBCentralManager class] ||
[aClass isSubclassOfClass:[CBCentralManager class]]) {
@@ -53,4 +68,12 @@
}
}
+- (NSArray*)retrieveConnectedPeripheralsWithServices:(NSArray*)services {
+ return [[_connectedMockPeripheral copy] autorelease];
+}
+
+- (void)addConnectedMockPeripheral:(MockCBPeripheral*)peripheral {
+ [_connectedMockPeripheral addObject:peripheral];
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698