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

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

Issue 2339253002: bluetooth: mac: add connected LE devices to chooser (Closed)
Patch Set: Cleanup Created 4 years, 2 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..12b4005406b5a5813b389a8cfbf6a2881f83f657 100644
--- a/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm
+++ b/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm
@@ -4,10 +4,15 @@
#import "device/bluetooth/test/mock_bluetooth_central_manager_mac.h"
+#import "base/mac/scoped_nsobject.h"
#import "device/bluetooth/test/bluetooth_test_mac.h"
#import "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h"
-@implementation MockCentralManager
+using base::scoped_nsobject;
+
+@implementation MockCentralManager {
+ scoped_nsobject<NSArray> _connectedMockPeripheral;
+}
@synthesize scanForPeripheralsCallCount = _scanForPeripheralsCallCount;
@synthesize stopScanCallCount = _stopScanCallCount;
@@ -15,6 +20,19 @@
@synthesize state = _state;
@synthesize bluetoothTestMac = _bluetoothTestMac;
+- (instancetype)init {
+ self = [super init];
+ if (self) {
+ _connectedMockPeripheral.reset([[NSArray alloc] init]);
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_connectedMockPeripheral release];
+ [super dealloc];
+}
+
- (BOOL)isKindOfClass:(Class)aClass {
if (aClass == [CBCentralManager class] ||
[aClass isSubclassOfClass:[CBCentralManager class]]) {
@@ -53,4 +71,12 @@
}
}
+- (NSArray*)retrieveConnectedPeripheralsWithServices:(NSArray*)services {
+ return _connectedMockPeripheral.get();
+}
+
+- (void)setConnectedMockPeripherals:(NSArray*)peripherals {
+ _connectedMockPeripheral.reset([peripherals copy]);
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698