Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: device/bluetooth/test/bluetooth_test_win.cc

Issue 1632123003: Add cross platform Bluetooth testing fixture for Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/bluetooth/test/bluetooth_test_win.h ('k') | device/device_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 BluetoothTestWin::BluetoothTestWin()
13 : ui_task_runner_(new base::TestSimpleTaskRunner()),
14 bluetooth_task_runner_(new base::TestSimpleTaskRunner()) {}
15 BluetoothTestWin::~BluetoothTestWin() {}
16
17 bool BluetoothTestWin::PlatformSupportsLowEnergy() {
18 return win::IsBluetoothLowEnergySupported();
19 }
20
21 void BluetoothTestWin::AdapterInitCallback() {}
22
23 void BluetoothTestWin::InitWithDefaultAdapter() {
24 adapter_ = new BluetoothAdapterWin(base::Bind(
25 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this)));
26 adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get());
27 adapter_win_->Init();
28 }
29
30 void BluetoothTestWin::InitWithoutDefaultAdapter() {
31 adapter_ = new BluetoothAdapterWin(base::Bind(
32 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this)));
33 adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get());
34 adapter_win_->InitForTest(ui_task_runner_, bluetooth_task_runner_);
35 }
36
37 void BluetoothTestWin::InitWithFakeAdapter() {
38 adapter_ = new BluetoothAdapterWin(base::Bind(
39 &BluetoothTestWin::AdapterInitCallback, base::Unretained(this)));
40 adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get());
41 adapter_win_->InitForTest(ui_task_runner_, bluetooth_task_runner_);
42 BluetoothTaskManagerWin::AdapterState* adapter_state =
43 new BluetoothTaskManagerWin::AdapterState();
44 adapter_state->name = kTestAdapterName;
45 adapter_state->address = kTestAdapterAddress;
46 adapter_state->powered = true;
47 adapter_win_->AdapterStateChanged(*adapter_state);
48 }
49
50 bool BluetoothTestWin::DenyPermission() {
51 return false;
52 }
53 }
OLDNEW
« no previous file with comments | « device/bluetooth/test/bluetooth_test_win.h ('k') | device/device_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698