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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-vs-shift-click.html

Issue 2689483007: Tests of ctrl-click can't postMessage to opener - using custom text instead. (Closed)
Patch Set: Rebasing... Created 3 years, 8 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
1 <head> 1 <head>
2 <meta http-equiv="Content-Security-Policy" content="frame-src 'none'"/> 2 <meta http-equiv="Content-Security-Policy" content="frame-src 'none'"/>
3 </head> 3 </head>
4 <div id="container"> 4 <div id="container">
5 <p>You should run this test in Test Runner</p> 5 <p>You should run this test in Test Runner</p>
6 <p>This is a regression test for https://crbug.com/658701</p> 6 <p>This is a regression test for https://crbug.com/658701</p>
7 </div> 7 </div>
8 <div id="log"></div> 8 <div id="log"></div>
9 <script src="/resources/testharness.js"></script>
10 <script src="/resources/testharnessreport.js"></script>
11 <iframe id="iframe" 9 <iframe id="iframe"
12 srcdoc=" 10 srcdoc="
13 &lt;p&gt;frame-src-vs-shift-click-FRAME.html: 11 &lt;p&gt;frame-src-vs-shift-click-FRAME.html:
14 &lt;a id=&quot;test-anchor&quot; 12 &lt;a id=&quot;test-anchor&quot;
15 href=&quot;resources/frame-src-vs-shift-click-target.html&quot; 13 href=&quot;resources/frame-src-vs-shift-click-target.html&quot;
16 &gt;Test anchor&lt;/a&gt; 14 &gt;Test anchor&lt;/a&gt;
17 &lt;/p&gt; 15 &lt;/p&gt;
18 "></iframe> 16 "></iframe>
19 <script> 17 <script>
20 var test = async_test("Testing frame-src vs shift-click");
21
22 function concludeTest(data)
23 {
24 test.step(function() {
25 assert_equals(
26 data["window.location.href"],
27 'http://127.0.0.1:8000/security/contentSecurityPolicy/resources/fram e-src-vs-shift-click-target.html',
28 "Test should be finished from frame-src-vs-shift-click-target.html") ;
29 assert_equals(
30 data["history.length"],
31 1,
32 "frame-src-vs-shift-click-target.html should be in a fresh window");
33 assert_true(
34 data["window.self == window.parent"],
35 "frame-src-vs-shift-click-target.html should be the main frame");
36 });
37
38 document.getElementById('container').outerHTML = '';
39 test.done();
40 }
41
42 if (window.testRunner) { 18 if (window.testRunner) {
19 testRunner.dumpAsText();
43 testRunner.setCanOpenWindows(true); 20 testRunner.setCanOpenWindows(true);
44 testRunner.setCloseRemainingWindowsWhenComplete(true); 21 testRunner.setCloseRemainingWindowsWhenComplete(true);
45 22 testRunner.waitUntilDone();
46 // Shift-clicking doesn't set window.opener, so we allow the new window
47 // to find the opener using the name being set below.
48 // TODO(lukasza): After fixing https://crbug.com/658386, the test will
49 // need to use another mechanism for communicating verification results
50 // (most likely OOPIF-replicated testRunner.setCustomTextOutput).
51 window.name = "mainTestWindow";
52 window.addEventListener('message', function(e) {
53 concludeTest(e.data);
54 });
55 23
56 window.onload = function() { 24 window.onload = function() {
57 var iframe = document.getElementById("iframe"); 25 var iframe = document.getElementById("iframe");
58 var anchor = iframe.contentWindow.document.getElementById('test-anchor') ; 26 var anchor = iframe.contentWindow.document.getElementById('test-anchor') ;
59 var x = iframe.offsetLeft + anchor.offsetLeft + 3; 27 var x = iframe.offsetLeft + anchor.offsetLeft + 3;
60 var y = iframe.offsetTop + anchor.offsetTop + 3; 28 var y = iframe.offsetTop + anchor.offsetTop + 3;
61 eventSender.dragMode = false; 29 eventSender.dragMode = false;
62 eventSender.mouseMoveTo(x, y); 30 eventSender.mouseMoveTo(x, y);
63 eventSender.mouseDown(0); 31 eventSender.mouseDown(0);
64 eventSender.mouseUp(0, ['shiftKey']); 32 eventSender.mouseUp(0, ['shiftKey']);
65 }; 33 };
66 } 34 }
67 35
68 </script> 36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698