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

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/connectGATT.html

Issue 1611773002: bluetooth: Disconnect if the page becomes hidden or is closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Address jyasskin's comments Created 4 years, 11 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: 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']}]})

Powered by Google App Engine
This is Rietveld 408576698