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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/webmessaging/postMessage_asterisk_xorigin.sub.htm

Issue 2558423002: Import wpt/webmessaging tests (Closed)
Patch Set: rebase again Created 3 years, 11 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 <html>
3 <head>
4 <title> Cross-origin postMessage with targetOrigin == "*" </title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <div id=log></div>
10
11 <div style="display:none">
12 <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{ {domains[www]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.h tm"></iframe>
13 <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPos tMessage.htm"></iframe>
14 </div>
15
16 <script>
17
18
19 var description = "Test Description: To send the message to the target regar dless of origin, set the target origin to '*'.";
20
21 var t = async_test(description);
22
23 var PORT = location.port !== "" ? ":" + location.port : "";
24 var TARGET1 = document.querySelectorAll("iframe")[0];
25 var TARGET2 = document.querySelectorAll("iframe")[1];
26 var XORIGIN = "{{location[scheme]}}://{{domains[www]}}" + PORT;
27 var SORIGIN = "{{location[scheme]}}://{{host}}" + PORT;
28 var ExpectedResult = ["#1", XORIGIN, "#2", SORIGIN];
29 var ActualResult = [];
30 var loaded = 0;
31
32 function PostMessageTest()
33 {
34 loaded++;
35
36 if (loaded == 2)
37 {
38 TARGET1.contentWindow.postMessage("#1", "*");
39 TARGET2.contentWindow.postMessage("#2", "*");
40 }
41 }
42
43 window.onmessage = t.step_func(function(e)
44 {
45 ActualResult.push(e.data, e.origin);
46
47 if (ActualResult.length >= ExpectedResult.length)
48 {
49 assert_array_equals(ActualResult, ExpectedResult, "ActualResult");
50 t.done();
51 }
52 });
53 </script>
54 </body>
55 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698