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.
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"
11 BluetoothTestMac::BluetoothTestMac() {}
13 BluetoothTestMac::~BluetoothTestMac() {}
15 void BluetoothTestMac::SetUp() {}
17 void BluetoothTestMac::InitWithDefaultAdapter() {
18 adapter_mac_ = BluetoothAdapterMac::CreateAdapter().get();
19 adapter_ = adapter_mac_;
22 void BluetoothTestMac::InitWithoutDefaultAdapter() {
23 adapter_mac_ = BluetoothAdapterMac::CreateAdapterForTest(
24 "", "", message_loop_.task_runner())
26 adapter_ = adapter_mac_;
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);
35 void BluetoothTestMac::InitWithFakeAdapter() {
37 BluetoothAdapterMac::CreateAdapterForTest(
38 kTestAdapterName, kTestAdapterAddress, message_loop_.task_runner())
40 adapter_ = adapter_mac_;
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);