Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
|
scheib
2016/01/26 20:13:47
2016
gogerald1
2016/01/26 20:25:10
Done.
| |
| 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 BluetoothTestWin::BluetoothTestWin() | |
| 13 : ui_task_runner_(new base::TestSimpleTaskRunner()), | |
| 14 bluetooth_task_runner_(new base::TestSimpleTaskRunner()) {} | |
| 15 BluetoothTestWin::~BluetoothTestWin() {} | |
| 16 | |
| 17 void BluetoothTestWin::SetUp() {} | |
| 18 void BluetoothTestWin::TearDown() {} | |
| 19 | |
| 20 bool BluetoothTestWin::PlatformSupportsLowEnergy() { | |
| 21 return win::IsBluetoothLowEnergySupported(); | |
| 22 } | |
| 23 | |
| 24 void BluetoothTestWin::AdapterInitCallback() {} | |
| 25 | |
| 26 void BluetoothTestWin::InitWithDefaultAdapter() { | |
| 27 adapter_ = new BluetoothAdapterWin(base::Bind( | |
| 28 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this))); | |
| 29 adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get()); | |
| 30 adapter_win_->Init(); | |
| 31 } | |
| 32 | |
| 33 void BluetoothTestWin::InitWithoutDefaultAdapter() { | |
| 34 adapter_ = new BluetoothAdapterWin(base::Bind( | |
| 35 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this))); | |
| 36 adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get()); | |
| 37 adapter_win_->InitForTest(ui_task_runner_, bluetooth_task_runner_); | |
| 38 } | |
| 39 | |
| 40 void BluetoothTestWin::InitWithFakeAdapter() { | |
| 41 adapter_ = new BluetoothAdapterWin(base::Bind( | |
| 42 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this))); | |
| 43 adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get()); | |
| 44 adapter_win_->InitForTest(ui_task_runner_, bluetooth_task_runner_); | |
| 45 BluetoothTaskManagerWin::AdapterState* adapter_state = | |
| 46 new BluetoothTaskManagerWin::AdapterState(); | |
| 47 adapter_state->name = kTestAdapterName; | |
| 48 adapter_state->address = kTestAdapterAddress; | |
| 49 adapter_state->powered = true; | |
| 50 adapter_win_->AdapterStateChanged(*adapter_state); | |
| 51 } | |
| 52 | |
| 53 bool BluetoothTestWin::DenyPermission() { | |
| 54 return false; | |
| 55 } | |
| 56 } | |
| OLD | NEW |