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

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
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..2c05ff10dabe26ca279955dcd0f443e60a187363
--- /dev/null
+++ b/device/bluetooth/test/bluetooth_test_win.cc
@@ -0,0 +1,56 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
scheib 2016/01/26 20:13:47 2016
gogerald1 2016/01/26 20:25:10 Done.
+// 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() {}
+
+void BluetoothTestWin::SetUp() {}
+void BluetoothTestWin::TearDown() {}
+
+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;
+}
+}

Powered by Google App Engine
This is Rietveld 408576698