Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / bluetooth / iframeRequestDevice.html
blob161a164e3c63dd68fac84bd18497c58c7ea4c7ea
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/bluetooth-helpers.js"></script>
5 <body>
6 <script>
7 "use strict";
9 const numIframes = 5;
11 async_test(test => {
12 let readiesReceived = 0;
13 window.onmessage = messageEvent => test.step(() => {
14 if (messageEvent.data === 'Ready') {
15 readiesReceived++;
17 if (readiesReceived < numIframes) {
18 return;
21 let iframesFinished = 0;
22 window.onmessage = messageEvent => test.step(() => {
23 if (messageEvent.data !== 'Success') {
24 console.error(messageEvent.data);
26 iframesFinished++;
27 if (iframesFinished === numIframes) {
28 test.done();
30 });
32 Array.prototype.forEach.call(document.querySelectorAll('iframe'), iframe => {
33 callWithKeyDown(() => {
34 iframe.contentWindow.postMessage('Go', '*');
35 });
36 });
37 });
39 testRunner.setBluetoothMockDataSet('GenericAccessAdapter');
40 for (let i = 0; i < numIframes; i++) {
41 let iframe = document.createElement('iframe');
42 iframe.src = 'resources/requestDevice-in-iframe.html';
43 document.body.appendChild(iframe);
45 }, 'Concurrent requestDevice calls in iframes work.');
46 </script>
47 </body>