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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html

Issue 2729603006: Fix Web Bluetooth two iframes from same origin layout test (Closed)
Patch Set: updated test code Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-two-iframes.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script> 3 <script src="../../../resources/testharnessreport.js"></script>
4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> 4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script>
5 <script> 5 <script>
6 "use strict"; 6 "use strict";
7 var firstIframe = true; 7 var firstIframe = true;
8 var iframe1 = document.createElement('iframe'); 8 var iframe1 = document.createElement('iframe');
9 iframe1.src = '../../../resources/bluetooth/heart-rate-two-iframes.html'; 9 iframe1.src = '../../../resources/bluetooth/heart-rate-two-iframes.html';
10 iframe1.id = 'iframe1'; 10 iframe1.id = 'iframe1';
11 var iframe2 = document.createElement('iframe'); 11 var iframe2 = document.createElement('iframe');
12 iframe2.src = '../../../resources/bluetooth/heart-rate-two-iframes.html'; 12 iframe2.src = '../../../resources/bluetooth/heart-rate-two-iframes.html';
13 iframe2.id = 'iframe2'; 13 iframe2.id = 'iframe2';
14 async_test(test => { 14 async_test(test => {
15 window.onmessage = messageEvent => test.step(() => { 15 window.onmessage = messageEvent => test.step(() => {
16 if (messageEvent.data === 'Ready') { 16 if (messageEvent.data === 'Ready') {
17 if (firstIframe) { 17 if (firstIframe) {
18 callWithKeyDown(() => { 18 callWithKeyDown(() => {
19 iframe1.contentWindow.postMessage('Iframe1RequestAndConnect', '*'); 19 iframe1.contentWindow.postMessage('Iframe1RequestAndConnect', '*');
20 }); 20 });
21 } else { 21 } else {
22 callWithKeyDown(() => { 22 callWithKeyDown(() => {
23 iframe2.contentWindow.postMessage('Iframe2RequestAndConnect', '*'); 23 iframe2.contentWindow.postMessage('Iframe2RequestAndConnect', '*');
24 }); 24 });
25 } 25 }
26 firstIframe = false; 26 firstIframe = false;
27 } else if (messageEvent.data === 'Iframe1Connected') { 27 } else if (messageEvent.data === 'Iframe1Connected') {
28 callWithKeyDown(() => {
29 iframe1.contentWindow.postMessage('Iframe1TryAccessGenericAccessServic e', '*');
30 });
31 } else if (messageEvent.data === 'Iframe1AccessGenericAccessServiceFailed' ) {
28 document.body.appendChild(iframe2); 32 document.body.appendChild(iframe2);
29 } else if (messageEvent.data === 'Iframe2Connected') { 33 } else if (messageEvent.data === 'Iframe2Connected') {
30 callWithKeyDown(() => { 34 callWithKeyDown(() => {
31 iframe1.contentWindow.postMessage('TestIframe1HasGenericAccessService' , '*'); 35 iframe1.contentWindow.postMessage('TestIframe1HasGenericAccessService' , '*');
32 }); 36 });
33 } 37 }
34 else if (messageEvent.data === 'DoneTest') { 38 else if (messageEvent.data === 'DoneTest') {
35 test.done(); 39 test.done();
36 } else { 40 } else {
37 assert_unreached('iframe sent invalid data: ' + messageEvent.data); 41 assert_unreached('iframe sent invalid data: ' + messageEvent.data);
38 } 42 }
39 }); 43 });
40 44
41 setBluetoothFakeAdapter('HeartRateAdapter') 45 setBluetoothFakeAdapter('HeartRateAdapter')
42 .then(() => { 46 .then(() => {
43 document.body.appendChild(iframe1); 47 document.body.appendChild(iframe1);
44 }); 48 });
45 }, 'Two iframes in the same origin should be able to access each other\'s serv ices'); 49 }, 'Two iframes in the same origin should be able to access each other\'s serv ices');
46 </script> 50 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-two-iframes.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698