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

Unified Diff: device/bluetooth/test/bluetooth_test_mac.mm

Issue 1232613004: The first 3 BluetoothTest.* unit tests now running on Mac as well. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movCBCM
Patch Set: pulling in origin/master so hopefully the patch will patch.. Created 5 years, 5 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_mac.mm
diff --git a/device/bluetooth/test/bluetooth_test_mac.mm b/device/bluetooth/test/bluetooth_test_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..cfe666634043369e9edaf581a41920a9bfedc55d
--- /dev/null
+++ b/device/bluetooth/test/bluetooth_test_mac.mm
@@ -0,0 +1,51 @@
+// Copyright 2015 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/bluetooth_adapter_mac.h"
+#include "device/bluetooth/test/bluetooth_test_mac.h"
+#include "device/bluetooth/test/mock_bluetooth_central_manager_mac.h"
+
+namespace device {
+
+BluetoothTestMac::BluetoothTestMac() {}
+
+BluetoothTestMac::~BluetoothTestMac() {}
+
+void BluetoothTestMac::SetUp() {}
+
+void BluetoothTestMac::InitWithDefaultAdapter() {
+ ui_task_runner_ = new base::TestSimpleTaskRunner();
+ adapter_ =
+ BluetoothAdapterMac::CreateAdapterForTest("", "", ui_task_runner_).get();
scheib 2015/07/17 21:26:05 The intent of "InitWithDefaultAdapter" is to creat
krstnmnlsn 2015/07/17 23:14:50 So for some reason I thought there was a problem w
+ adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get());
+}
+
+void BluetoothTestMac::InitWithoutDefaultAdapter() {
+ ui_task_runner_ = new base::TestSimpleTaskRunner();
+ adapter_ =
+ BluetoothAdapterMac::CreateAdapterForTest("", "", ui_task_runner_).get();
+ adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get());
scheib 2015/07/17 21:26:05 Seems silly to static_cast. Have CreateAdapterForT
krstnmnlsn 2015/07/17 23:14:50 Done.
+
+ if (BluetoothAdapterMac::IsLowEnergyAvailable()) {
+ id low_energy_central_manager = [[MockCentralManager alloc] init];
+ [low_energy_central_manager setState:CBCentralManagerStateUnsupported];
+ adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager);
+ }
+}
+
+void BluetoothTestMac::InitWithFakeAdapter() {
+ ui_task_runner_ = new base::TestSimpleTaskRunner();
+ adapter_ = BluetoothAdapterMac::CreateAdapterForTest(
+ kTestAdapterName, kTestAdapterAddress, ui_task_runner_)
+ .get();
+ adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get());
+
+ if (BluetoothAdapterMac::IsLowEnergyAvailable()) {
+ id low_energy_central_manager = [[MockCentralManager alloc] init];
+ [low_energy_central_manager setState:CBCentralManagerStatePoweredOn];
+ adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager);
+ }
+}
+
+} // namespace device

Powered by Google App Engine
This is Rietveld 408576698