OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "device/bluetooth/bluetooth_adapter_mac.h" | |
6 #include "device/bluetooth/test/bluetooth_test_mac.h" | |
7 #include "device/bluetooth/test/mock_bluetooth_central_manager_mac.h" | |
8 | |
9 namespace device { | |
10 | |
11 BluetoothTestMac::BluetoothTestMac() {} | |
12 | |
13 BluetoothTestMac::~BluetoothTestMac() {} | |
14 | |
15 void BluetoothTestMac::SetUp() {} | |
16 | |
17 void BluetoothTestMac::InitWithDefaultAdapter() { | |
18 adapter_ = BluetoothAdapterMac::CreateAdapter().get(); | |
19 adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get()); | |
scheib
2015/07/19 19:41:44
Please change the type for CreateAdapter() too, so
krstnmnlsn
2015/07/20 18:11:24
Done.
| |
20 } | |
21 | |
22 void BluetoothTestMac::InitWithoutDefaultAdapter() { | |
23 adapter_mac_ = BluetoothAdapterMac::CreateAdapterForTest( | |
24 "", "", message_loop_.task_runner()) | |
25 .get(); | |
26 adapter_ = adapter_mac_; | |
27 | |
28 if (BluetoothAdapterMac::IsLowEnergyAvailable()) { | |
29 id low_energy_central_manager = [[MockCentralManager alloc] init]; | |
30 [low_energy_central_manager setState:CBCentralManagerStateUnsupported]; | |
31 adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager); | |
32 } | |
33 } | |
34 | |
35 void BluetoothTestMac::InitWithFakeAdapter() { | |
36 adapter_mac_ = | |
37 BluetoothAdapterMac::CreateAdapterForTest( | |
38 kTestAdapterName, kTestAdapterAddress, message_loop_.task_runner()) | |
39 .get(); | |
40 adapter_ = adapter_mac_; | |
41 | |
42 if (BluetoothAdapterMac::IsLowEnergyAvailable()) { | |
43 id low_energy_central_manager = [[MockCentralManager alloc] init]; | |
44 [low_energy_central_manager setState:CBCentralManagerStatePoweredOn]; | |
45 adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager); | |
46 } | |
47 } | |
48 | |
49 } // namespace device | |
OLD | NEW |