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

Unified Diff: device/bluetooth/bluetooth_adapter_unittest.cc

Issue 2248033006: bluetooth: Return false for IsPresent only when bluetooth is not supported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 4 years, 4 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_unittest.cc
diff --git a/device/bluetooth/bluetooth_adapter_unittest.cc b/device/bluetooth/bluetooth_adapter_unittest.cc
index ffd8467e19a0ed2a9a6ebe29ce92cbd8d482229b..79a3bbe20c3ed779e248214c2a591fb96fb6fe35 100644
--- a/device/bluetooth/bluetooth_adapter_unittest.cc
+++ b/device/bluetooth/bluetooth_adapter_unittest.cc
@@ -430,8 +430,16 @@ TEST_F(BluetoothTest, ConstructDefaultAdapter) {
LOG(WARNING) << "Bluetooth adapter not present; skipping unit test.";
return;
}
- EXPECT_GT(adapter_->GetAddress().length(), 0u);
- EXPECT_GT(adapter_->GetName().length(), 0u);
+
+ bool expected = false;
+// MacOS returns empty for name and address if the adapter is off.
+#if defined(OS_MACOSX)
+ expected = !adapter_->IsPowered();
+#endif // defined(OS_MACOSX)
+
+ EXPECT_EQ(expected, adapter_->GetAddress().empty());
+ EXPECT_EQ(expected, adapter_->GetName().empty());
+
EXPECT_TRUE(adapter_->IsPresent());
// Don't know on test machines if adapter will be powered or not, but
// the call should be safe to make and consistent.
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698