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

Unified Diff: device/bluetooth/bluetooth_adapter_unittest.cc

Issue 2032273002: If location services are turned off, have the BT chooser prompt the user to turn them on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Sync Created 4 years, 6 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/bluetooth_adapter_unittest.cc
diff --git a/device/bluetooth/bluetooth_adapter_unittest.cc b/device/bluetooth/bluetooth_adapter_unittest.cc
index 834859c101e2acced911bb14a508fec27da19422..9914f4967b852f31c235ff594b2a44aeca570873 100644
--- a/device/bluetooth/bluetooth_adapter_unittest.cc
+++ b/device/bluetooth/bluetooth_adapter_unittest.cc
@@ -558,6 +558,28 @@ TEST_F(BluetoothTest, NoPermissions) {
}
#endif // defined(OS_ANDROID) || defined(OS_MACOSX)
+// Android-only: Only Android requires location services to be turned on to scan
+// for Bluetooth devices.
+#if defined(OS_ANDROID)
+// Checks that discovery fails (instead of hanging) when location services are
+// turned off.
+TEST_F(BluetoothTest, NoLocationServices) {
+ if (!PlatformSupportsLowEnergy()) {
+ LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
+ return;
+ }
+ InitWithFakeAdapter();
+ TestBluetoothAdapterObserver observer(adapter_);
+
+ SimulateLocationServicesOff();
+
+ StartLowEnergyDiscoverySessionExpectedToFail();
+
+ EXPECT_EQ(0, callback_count_);
+ EXPECT_EQ(1, error_callback_count_);
+}
+#endif // defined(OS_ANDROID)
+
#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
// Discovers a device.
TEST_F(BluetoothTest, DiscoverLowEnergyDevice) {

Powered by Google App Engine
This is Rietveld 408576698