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..3f9f72f833a7cb6a13cdbf6aed93c5268a8dfe59 |
--- /dev/null |
+++ b/device/bluetooth/test/bluetooth_test_mac.mm |
@@ -0,0 +1,49 @@ |
+// 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() { |
+ adapter_mac_ = BluetoothAdapterMac::CreateAdapter().get(); |
+ adapter_ = adapter_mac_; |
+} |
+ |
+void BluetoothTestMac::InitWithoutDefaultAdapter() { |
+ adapter_mac_ = BluetoothAdapterMac::CreateAdapterForTest( |
+ "", "", message_loop_.task_runner()) |
+ .get(); |
+ adapter_ = adapter_mac_; |
+ |
+ 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() { |
+ adapter_mac_ = |
+ BluetoothAdapterMac::CreateAdapterForTest( |
+ kTestAdapterName, kTestAdapterAddress, message_loop_.task_runner()) |
+ .get(); |
+ adapter_ = adapter_mac_; |
+ |
+ 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 |