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

Side by Side Diff: device/bluetooth/test/mock_bluetooth_central_manager_mac.mm

Issue 2242833002: Bluetooth: mac: add connected BLE devices at startup Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Device: bluetooth: use untyped containers 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 unified diff | Download patch
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_central_manager_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11
12 @synthesize scanForPeripheralsCallCount = _scanForPeripheralsCallCount; 12 @synthesize scanForPeripheralsCallCount = _scanForPeripheralsCallCount;
13 @synthesize stopScanCallCount = _stopScanCallCount; 13 @synthesize stopScanCallCount = _stopScanCallCount;
14 @synthesize delegate = _delegate; 14 @synthesize delegate = _delegate;
15 @synthesize state = _state; 15 @synthesize state = _state;
16 @synthesize bluetoothTestMac = _bluetoothTestMac; 16 @synthesize bluetoothTestMac = _bluetoothTestMac;
17 @synthesize connected_peripherals = _connected_peripherals;
17 18
18 - (BOOL)isKindOfClass:(Class)aClass { 19 - (BOOL)isKindOfClass:(Class)aClass {
19 if (aClass == [CBCentralManager class] || 20 if (aClass == [CBCentralManager class] ||
20 [aClass isSubclassOfClass:[CBCentralManager class]]) { 21 [aClass isSubclassOfClass:[CBCentralManager class]]) {
21 return YES; 22 return YES;
22 } 23 }
23 return [super isKindOfClass:aClass]; 24 return [super isKindOfClass:aClass];
24 } 25 }
25 26
26 - (BOOL)isMemberOfClass:(Class)aClass { 27 - (BOOL)isMemberOfClass:(Class)aClass {
27 if (aClass == [CBCentralManager class] || 28 if (aClass == [CBCentralManager class] ||
28 [aClass isSubclassOfClass:[CBCentralManager class]]) { 29 [aClass isSubclassOfClass:[CBCentralManager class]]) {
29 return YES; 30 return YES;
30 } 31 }
31 return [super isKindOfClass:aClass]; 32 return [super isKindOfClass:aClass];
32 } 33 }
33 34
35 - (NSArray*)retrieveConnectedPeripheralsWithServices:(NSArray*)serviceUUIDs {
36 return _connected_peripherals;
37 }
38
34 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs 39 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs
35 options:(NSDictionary*)options { 40 options:(NSDictionary*)options {
36 _scanForPeripheralsCallCount++; 41 _scanForPeripheralsCallCount++;
37 } 42 }
38 43
39 - (void)stopScan { 44 - (void)stopScan {
40 _stopScanCallCount++; 45 _stopScanCallCount++;
41 } 46 }
42 47
43 - (void)connectPeripheral:(CBPeripheral*)peripheral 48 - (void)connectPeripheral:(CBPeripheral*)peripheral
44 options:(NSDictionary*)options { 49 options:(NSDictionary*)options {
45 if (_bluetoothTestMac) { 50 if (_bluetoothTestMac) {
46 _bluetoothTestMac->OnFakeBluetoothDeviceConnectGattCalled(); 51 _bluetoothTestMac->OnFakeBluetoothDeviceConnectGattCalled();
47 } 52 }
48 } 53 }
49 54
50 - (void)cancelPeripheralConnection:(CBPeripheral*)peripheral { 55 - (void)cancelPeripheralConnection:(CBPeripheral*)peripheral {
51 if (_bluetoothTestMac) { 56 if (_bluetoothTestMac) {
52 _bluetoothTestMac->OnFakeBluetoothGattDisconnect(); 57 _bluetoothTestMac->OnFakeBluetoothGattDisconnect();
53 } 58 }
54 } 59 }
55 60
56 @end 61 @end
OLDNEW
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_central_manager_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698