| 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);
|
|
|