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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "device/bluetooth/test/mock_bluetooth_central_manager_mac.h" 5 #import "device/bluetooth/test/mock_bluetooth_central_manager_mac.h"
6 6
7 #import "device/bluetooth/test/bluetooth_test_mac.h" 7 #import "device/bluetooth/test/bluetooth_test_mac.h"
8 #import "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h" 8 #import "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h"
9 9
10 @implementation MockCentralManager 10 @implementation MockCentralManager {
11 NSMutableArray* _connectedMockPeripheral;
12 }
11 13
12 @synthesize scanForPeripheralsCallCount = _scanForPeripheralsCallCount; 14 @synthesize scanForPeripheralsCallCount = _scanForPeripheralsCallCount;
13 @synthesize stopScanCallCount = _stopScanCallCount; 15 @synthesize stopScanCallCount = _stopScanCallCount;
14 @synthesize delegate = _delegate; 16 @synthesize delegate = _delegate;
15 @synthesize state = _state; 17 @synthesize state = _state;
16 @synthesize bluetoothTestMac = _bluetoothTestMac; 18 @synthesize bluetoothTestMac = _bluetoothTestMac;
17 19
20 - (instancetype)init {
21 self = [super init];
22 if (self) {
23 _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.
24 }
25 return self;
26 }
27
28 - (void)dealloc {
29 [_connectedMockPeripheral release];
30 [super dealloc];
31 }
32
18 - (BOOL)isKindOfClass:(Class)aClass { 33 - (BOOL)isKindOfClass:(Class)aClass {
19 if (aClass == [CBCentralManager class] || 34 if (aClass == [CBCentralManager class] ||
20 [aClass isSubclassOfClass:[CBCentralManager class]]) { 35 [aClass isSubclassOfClass:[CBCentralManager class]]) {
21 return YES; 36 return YES;
22 } 37 }
23 return [super isKindOfClass:aClass]; 38 return [super isKindOfClass:aClass];
24 } 39 }
25 40
26 - (BOOL)isMemberOfClass:(Class)aClass { 41 - (BOOL)isMemberOfClass:(Class)aClass {
27 if (aClass == [CBCentralManager class] || 42 if (aClass == [CBCentralManager class] ||
(...skipping 18 matching lines...) Expand all
46 _bluetoothTestMac->OnFakeBluetoothDeviceConnectGattCalled(); 61 _bluetoothTestMac->OnFakeBluetoothDeviceConnectGattCalled();
47 } 62 }
48 } 63 }
49 64
50 - (void)cancelPeripheralConnection:(CBPeripheral*)peripheral { 65 - (void)cancelPeripheralConnection:(CBPeripheral*)peripheral {
51 if (_bluetoothTestMac) { 66 if (_bluetoothTestMac) {
52 _bluetoothTestMac->OnFakeBluetoothGattDisconnect(); 67 _bluetoothTestMac->OnFakeBluetoothGattDisconnect();
53 } 68 }
54 } 69 }
55 70
71 - (NSArray*)retrieveConnectedPeripheralsWithServices:(NSArray*)services {
72 return [[_connectedMockPeripheral copy] autorelease];
73 }
74
75 - (void)addConnectedMockPeripheral:(MockCBPeripheral*)peripheral {
76 [_connectedMockPeripheral addObject:peripheral];
77 }
78
56 @end 79 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698