OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "device/bluetooth/test/bluetooth_test_win.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "device/bluetooth/bluetooth_adapter_win.h" | |
9 #include "device/bluetooth/bluetooth_low_energy_win.h" | |
10 | |
11 namespace device { | |
12 | |
13 void BluetoothTestWin::SetUp() {} | |
scheib
2016/01/26 05:29:26
Remove Setup & TearDown if unneeded.
gogerald1
2016/01/26 19:33:26
The reason I override these interfaces is to expli
| |
14 void BluetoothTestWin::TearDown() {} | |
15 | |
16 BluetoothTestWin::BluetoothTestWin() | |
17 : ui_task_runner_(new base::TestSimpleTaskRunner()), | |
18 bluetooth_task_runner_(new base::TestSimpleTaskRunner()) {} | |
19 BluetoothTestWin::~BluetoothTestWin() {} | |
20 | |
21 bool BluetoothTestWin::PlatformSupportsLowEnergy() { | |
22 return device::win::IsBluetoothLowEnergySupported(); | |
23 } | |
24 | |
25 void BluetoothTestWin::AdapterInitCallback() {} | |
26 | |
27 void BluetoothTestWin::InitWithDefaultAdapter() { | |
28 adapter_ = new BluetoothAdapterWin(base::Bind( | |
29 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this))); | |
30 adapter_Win_ = static_cast<BluetoothAdapterWin*>(adapter_.get()); | |
31 adapter_Win_->Init(); | |
32 } | |
33 | |
34 void BluetoothTestWin::InitWithoutDefaultAdapter() { | |
35 adapter_ = new BluetoothAdapterWin(base::Bind( | |
36 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this))); | |
37 adapter_Win_ = static_cast<BluetoothAdapterWin*>(adapter_.get()); | |
38 adapter_Win_->InitForTest(ui_task_runner_, bluetooth_task_runner_); | |
39 } | |
40 | |
41 void BluetoothTestWin::InitWithFakeAdapter() { | |
42 adapter_ = new BluetoothAdapterWin(base::Bind( | |
43 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this))); | |
44 adapter_Win_ = static_cast<BluetoothAdapterWin*>(adapter_.get()); | |
45 adapter_Win_->InitForTest(ui_task_runner_, bluetooth_task_runner_); | |
46 BluetoothTaskManagerWin::AdapterState* adapter_state = | |
47 new BluetoothTaskManagerWin::AdapterState(); | |
48 adapter_state->name = kTestAdapterName; | |
49 adapter_state->address = kTestAdapterAddress; | |
50 adapter_state->powered = true; | |
51 adapter_Win_->AdapterStateChanged(*adapter_state); | |
52 } | |
53 | |
54 bool BluetoothTestWin::DenyPermission() { | |
55 return false; | |
56 } | |
57 } | |
OLD | NEW |