Process Alt-Svc headers.
[chromium-blink-merge.git] / device / bluetooth / test / bluetooth_test_mac.mm
blob3f9f72f833a7cb6a13cdbf6aed93c5268a8dfe59
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"
9 namespace device {
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())
25                      .get();
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);
32   }
35 void BluetoothTestMac::InitWithFakeAdapter() {
36   adapter_mac_ =
37       BluetoothAdapterMac::CreateAdapterForTest(
38           kTestAdapterName, kTestAdapterAddress, message_loop_.task_runner())
39           .get();
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);
46   }
49 }  // namespace device