Index: third_party/WebKit/LayoutTests/bluetooth/connectGATT.html |
diff --git a/third_party/WebKit/LayoutTests/bluetooth/connectGATT.html b/third_party/WebKit/LayoutTests/bluetooth/connectGATT.html |
index 55c695bcdc297cbd79adcad08441a28f32e2fa27..6cebf378b8d0c9c42ac63a2fb604b76e124c7535 100644 |
--- a/third_party/WebKit/LayoutTests/bluetooth/connectGATT.html |
+++ b/third_party/WebKit/LayoutTests/bluetooth/connectGATT.html |
@@ -117,6 +117,30 @@ promise_test(() => { |
}, testSpec.testName); |
}); |
+// TODO(ortuno): Allow connections when the tab is in the background. |
+// This is a short term solution instead of implementing a tab indicator |
+// for bluetooth connections. |
+// https://crbug.com/579746 |
+promise_test(() => { |
+ testRunner.setBluetoothMockDataSet('HeartRateAdapter'); |
+ return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}) |
+ .then(device => { |
+ testRunner.setPageVisibility('hidden'); |
+ return assert_promise_rejects_with_message( |
+ device.connectGATT(), |
+ new DOMException('Connection is only allowed while the page is visible. ' + |
+ 'This is a temporary measure until we are able to ' + |
+ 'effectively communicate to the user that a page is ' + |
+ 'connected to a device.', |
+ 'SecurityError')); |
+ }) |
+ .then(() => testRunner.setPageVisibility('visible')) |
+ .catch(error => { |
+ testRunner.setPageVisibility('visible'); |
+ throw error; |
+ }); |
+}, 'Device should not be able to connect in background.'); |
+ |
promise_test(() => { |
testRunner.setBluetoothMockDataSet('HeartRateAdapter'); |
return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}) |