Chromium Code Reviews| 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..88a929aab4ce6ee407e98624b029ea91d8120a25 |
| --- /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_ = BluetoothAdapterMac::CreateAdapter().get(); |
| + 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.
|
| +} |
| + |
| +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 |