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

Unified Diff: device/bluetooth/bluetooth_adapter_mac_unittest.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: comment edit 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
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | device/bluetooth/bluetooth_adapter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_mac_unittest.mm
diff --git a/device/bluetooth/bluetooth_adapter_mac_unittest.mm b/device/bluetooth/bluetooth_adapter_mac_unittest.mm
index 49fc30becd972a0a7f68eb7928f99658baf77e3e..81b3a6cae82dbad313521e08f42707e67f07ed5c 100644
--- a/device/bluetooth/bluetooth_adapter_mac_unittest.mm
+++ b/device/bluetooth/bluetooth_adapter_mac_unittest.mm
@@ -107,12 +107,13 @@ class BluetoothAdapterMacTest : public testing::Test {
void RemoveTimedOutDevices() { adapter_mac_->RemoveTimedOutDevices(); }
- bool SetMockCentralManager() {
+ bool SetMockCentralManager(CBCentralManagerState desired_state) {
if (!BluetoothAdapterMac::IsLowEnergyAvailable()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return false;
}
mock_central_manager_ = [[MockCentralManager alloc] init];
+ [mock_central_manager_ setState:desired_state];
adapter_mac_->SetCentralManagerForTesting(mock_central_manager_);
return true;
}
@@ -157,7 +158,7 @@ TEST_F(BluetoothAdapterMacTest, Poll) {
}
TEST_F(BluetoothAdapterMacTest, AddDiscoverySessionWithLowEnergyFilter) {
- if (!SetMockCentralManager())
+ if (!SetMockCentralManager(CBCentralManagerStatePoweredOn))
return;
EXPECT_EQ(0, [mock_central_manager_ scanForPeripheralsCallCount]);
EXPECT_EQ(0, NumDiscoverySessions());
@@ -178,7 +179,7 @@ TEST_F(BluetoothAdapterMacTest, AddDiscoverySessionWithLowEnergyFilter) {
// TODO(krstnmnlsn): Test changing the filter when adding the second discovery
// session (once we have that ability).
TEST_F(BluetoothAdapterMacTest, AddSecondDiscoverySessionWithLowEnergyFilter) {
- if (!SetMockCentralManager())
+ if (!SetMockCentralManager(CBCentralManagerStatePoweredOn))
return;
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(
new BluetoothDiscoveryFilter(
@@ -200,7 +201,7 @@ TEST_F(BluetoothAdapterMacTest, AddSecondDiscoverySessionWithLowEnergyFilter) {
}
TEST_F(BluetoothAdapterMacTest, RemoveDiscoverySessionWithLowEnergyFilter) {
- if (!SetMockCentralManager())
+ if (!SetMockCentralManager(CBCentralManagerStatePoweredOn))
return;
EXPECT_EQ(0, [mock_central_manager_ scanForPeripheralsCallCount]);
@@ -224,7 +225,7 @@ TEST_F(BluetoothAdapterMacTest, RemoveDiscoverySessionWithLowEnergyFilter) {
}
TEST_F(BluetoothAdapterMacTest, RemoveDiscoverySessionWithLowEnergyFilterFail) {
- if (!SetMockCentralManager())
+ if (!SetMockCentralManager(CBCentralManagerStatePoweredOn))
return;
EXPECT_EQ(0, [mock_central_manager_ scanForPeripheralsCallCount]);
EXPECT_EQ(0, [mock_central_manager_ stopScanCallCount]);
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | device/bluetooth/bluetooth_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698