Chromium Code Reviews| 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 ui_task_runner_ = new base::TestSimpleTaskRunner(); | |
| 19 adapter_ = | |
| 20 BluetoothAdapterMac::CreateAdapterForTest("", "", ui_task_runner_).get(); | |
|
scheib
2015/07/17 21:26:05
The intent of "InitWithDefaultAdapter" is to creat
krstnmnlsn
2015/07/17 23:14:50
So for some reason I thought there was a problem w
| |
| 21 adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get()); | |
| 22 } | |
| 23 | |
| 24 void BluetoothTestMac::InitWithoutDefaultAdapter() { | |
| 25 ui_task_runner_ = new base::TestSimpleTaskRunner(); | |
| 26 adapter_ = | |
| 27 BluetoothAdapterMac::CreateAdapterForTest("", "", ui_task_runner_).get(); | |
| 28 adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get()); | |
|
scheib
2015/07/17 21:26:05
Seems silly to static_cast. Have CreateAdapterForT
krstnmnlsn
2015/07/17 23:14:50
Done.
| |
| 29 | |
| 30 if (BluetoothAdapterMac::IsLowEnergyAvailable()) { | |
| 31 id low_energy_central_manager = [[MockCentralManager alloc] init]; | |
| 32 [low_energy_central_manager setState:CBCentralManagerStateUnsupported]; | |
| 33 adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 void BluetoothTestMac::InitWithFakeAdapter() { | |
| 38 ui_task_runner_ = new base::TestSimpleTaskRunner(); | |
| 39 adapter_ = BluetoothAdapterMac::CreateAdapterForTest( | |
| 40 kTestAdapterName, kTestAdapterAddress, ui_task_runner_) | |
| 41 .get(); | |
| 42 adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get()); | |
| 43 | |
| 44 if (BluetoothAdapterMac::IsLowEnergyAvailable()) { | |
| 45 id low_energy_central_manager = [[MockCentralManager alloc] init]; | |
| 46 [low_energy_central_manager setState:CBCentralManagerStatePoweredOn]; | |
| 47 adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager); | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 } // namespace device | |
| OLD | NEW |