Index: device/bluetooth/test/bluetooth_test_mac.mm |
diff --git a/device/bluetooth/test/bluetooth_test_mac.mm b/device/bluetooth/test/bluetooth_test_mac.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cfe666634043369e9edaf581a41920a9bfedc55d |
--- /dev/null |
+++ b/device/bluetooth/test/bluetooth_test_mac.mm |
@@ -0,0 +1,51 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "device/bluetooth/bluetooth_adapter_mac.h" |
+#include "device/bluetooth/test/bluetooth_test_mac.h" |
+#include "device/bluetooth/test/mock_bluetooth_central_manager_mac.h" |
+ |
+namespace device { |
+ |
+BluetoothTestMac::BluetoothTestMac() {} |
+ |
+BluetoothTestMac::~BluetoothTestMac() {} |
+ |
+void BluetoothTestMac::SetUp() {} |
+ |
+void BluetoothTestMac::InitWithDefaultAdapter() { |
+ ui_task_runner_ = new base::TestSimpleTaskRunner(); |
+ adapter_ = |
+ 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
|
+ adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get()); |
+} |
+ |
+void BluetoothTestMac::InitWithoutDefaultAdapter() { |
+ ui_task_runner_ = new base::TestSimpleTaskRunner(); |
+ adapter_ = |
+ BluetoothAdapterMac::CreateAdapterForTest("", "", ui_task_runner_).get(); |
+ 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.
|
+ |
+ if (BluetoothAdapterMac::IsLowEnergyAvailable()) { |
+ id low_energy_central_manager = [[MockCentralManager alloc] init]; |
+ [low_energy_central_manager setState:CBCentralManagerStateUnsupported]; |
+ adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager); |
+ } |
+} |
+ |
+void BluetoothTestMac::InitWithFakeAdapter() { |
+ ui_task_runner_ = new base::TestSimpleTaskRunner(); |
+ adapter_ = BluetoothAdapterMac::CreateAdapterForTest( |
+ kTestAdapterName, kTestAdapterAddress, ui_task_runner_) |
+ .get(); |
+ adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get()); |
+ |
+ if (BluetoothAdapterMac::IsLowEnergyAvailable()) { |
+ id low_energy_central_manager = [[MockCentralManager alloc] init]; |
+ [low_energy_central_manager setState:CBCentralManagerStatePoweredOn]; |
+ adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager); |
+ } |
+} |
+ |
+} // namespace device |