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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/bluetooth_test_win.cc
diff --git a/device/bluetooth/test/bluetooth_test_win.cc b/device/bluetooth/test/bluetooth_test_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..13464937115aaaf1c84de0cb190dc1e77d1ab364
--- /dev/null
+++ b/device/bluetooth/test/bluetooth_test_win.cc
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/bluetooth/test/bluetooth_test_win.h"
+
+#include "base/bind.h"
+#include "device/bluetooth/bluetooth_adapter_win.h"
+#include "device/bluetooth/bluetooth_low_energy_win.h"
+
+namespace device {
+BluetoothTestWin::BluetoothTestWin()
+ : ui_task_runner_(new base::TestSimpleTaskRunner()),
+ bluetooth_task_runner_(new base::TestSimpleTaskRunner()) {}
+BluetoothTestWin::~BluetoothTestWin() {}
+
+bool BluetoothTestWin::PlatformSupportsLowEnergy() {
+ return win::IsBluetoothLowEnergySupported();
+}
+
+void BluetoothTestWin::AdapterInitCallback() {}
+
+void BluetoothTestWin::InitWithDefaultAdapter() {
+ adapter_ = new BluetoothAdapterWin(base::Bind(
+ &BluetoothTestWin::AdapterInitCallback, base::Unretained(this)));
+ adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get());
+ adapter_win_->Init();
+}
+
+void BluetoothTestWin::InitWithoutDefaultAdapter() {
+ adapter_ = new BluetoothAdapterWin(base::Bind(
+ &BluetoothTestWin::AdapterInitCallback, base::Unretained(this)));
+ adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get());
+ adapter_win_->InitForTest(ui_task_runner_, bluetooth_task_runner_);
+}
+
+void BluetoothTestWin::InitWithFakeAdapter() {
+ adapter_ = new BluetoothAdapterWin(base::Bind(
+ &BluetoothTestWin::AdapterInitCallback, base::Unretained(this)));
+ adapter_win_ = static_cast<BluetoothAdapterWin*>(adapter_.get());
+ adapter_win_->InitForTest(ui_task_runner_, bluetooth_task_runner_);
+ BluetoothTaskManagerWin::AdapterState* adapter_state =
+ new BluetoothTaskManagerWin::AdapterState();
+ adapter_state->name = kTestAdapterName;
+ adapter_state->address = kTestAdapterAddress;
+ adapter_state->powered = true;
+ adapter_win_->AdapterStateChanged(*adapter_state);
+}
+
+bool BluetoothTestWin::DenyPermission() {
+ return false;
+}
+}
« 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