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

Unified Diff: third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-two-iframes.html

Issue 2729603006: Fix Web Bluetooth two iframes from same origin layout test (Closed)
Patch Set: updated test code Created 3 years, 10 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 | « third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-two-iframes.html
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-two-iframes.html b/third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-two-iframes.html
index fe4f46cd23556a7ca86d6ee0f1d3a727034633fc..91f7a9849689cd43dc2371a3c97a8c8a843e2ef4 100644
--- a/third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-two-iframes.html
+++ b/third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-two-iframes.html
@@ -10,23 +10,36 @@
.then(device => device.gatt.connect())
.then(gattServer => {
// iframe1 can access heart_rate service.
- gattServer.getPrimaryService('heart_rate');
+ return gattServer.getPrimaryService('heart_rate');
+ }).then(() => {
parent.postMessage('Iframe1Connected', '*');
}).catch(err => {
console.error(err);
parent.postMessage('FAIL: ' + err, '*');
});
+ } else if (messageEvent.data === 'Iframe1TryAccessGenericAccessService') {
+ navigator.bluetooth.requestDevice({
+ filters: [{services: ['heart_rate']}]
+ })
+ .then(device => device.gatt.connect())
+ .then(gattServer => {
+ // iframe1 can not access generic_access service.
+ return gattServer.getPrimaryService('generic_access');
+ }).catch(err => {
+ parent.postMessage('Iframe1AccessGenericAccessServiceFailed', '*');
+ });
} else if (messageEvent.data === 'Iframe2RequestAndConnect') {
navigator.bluetooth.requestDevice({
filters: [{services: ['generic_access']}]
})
.then(device => device.gatt.connect())
.then(gattServer => {
- gattServer.getPrimaryService('generic_access');
// Since iframe1 can access heart_rate service, and iframe2 has the
// same origin as iframe1, iframe2 should also be able to access
// heart_rate service.
- gattServer.getPrimaryService('heart_rate');
+ return Promise.all([gattServer.getPrimaryService('generic_access'),
+ gattServer.getPrimaryService('heart_rate')]);
+ }).then(() => {
parent.postMessage('Iframe2Connected', '*');
}).catch(err => {
console.error(err);
@@ -41,7 +54,8 @@
// Since iframe2 can access generic_access service, and iframe1 has the
// same origin as iframe2, iframe1 should also be able to access
// generic_access service.
- gattServer.getPrimaryService('generic_access');
+ return gattServer.getPrimaryService('generic_access');
+ }).then(() => {
parent.postMessage('DoneTest', '*');
}).catch(err => {
console.error(err);
« no previous file with comments | « third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698