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

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

Issue 2658473002: Refactor BluetoothAllowedDevicesMap (Closed)
Patch Set: cleaned up layout 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script>
5 <script>
6 "use strict";
7 var firstIframe = true;
8 var iframe1 = document.createElement('iframe');
9 iframe1.src = '../../../resources/bluetooth/heart-rate-two-iframes.html';
10 iframe1.id = 'iframe1';
11 var iframe2 = document.createElement('iframe');
12 iframe2.src = '../../../resources/bluetooth/heart-rate-two-iframes.html';
13 iframe2.id = 'iframe2';
14 async_test(test => {
15 window.onmessage = messageEvent => test.step(() => {
16 if (messageEvent.data === 'Ready') {
17 if (firstIframe) {
18 callWithKeyDown(() => {
19 iframe1.contentWindow.postMessage('Iframe1RequestAndConnect', '*');
20 });
21 } else {
22 callWithKeyDown(() => {
23 iframe2.contentWindow.postMessage('Iframe2RequestAndConnect', '*');
24 });
25 }
26 firstIframe = false;
27 } else if (messageEvent.data === 'Iframe1Connected') {
28 document.body.appendChild(iframe2);
29 } else if (messageEvent.data === 'Iframe2Connected') {
30 callWithKeyDown(() => {
31 iframe1.contentWindow.postMessage('TestIframe1HasGenericAccessService' , '*');
32 });
33 }
34 else if (messageEvent.data === 'DoneTest') {
35 test.done();
36 } else {
37 assert_unreached('iframe sent invalid data: ' + messageEvent.data);
38 }
39 });
40
41 setBluetoothFakeAdapter('HeartRateAdapter')
42 .then(() => {
43 document.body.appendChild(iframe1);
44 });
45 }, 'Two iframes in the same origin should be able to access each other\'s serv ices');
46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698