Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / set-event-in-another-frame.html
blobcf137338b55ed9ed315df6d7bc190347b8ce0584
1 <html>
2 <head>
3 <script>
4 if (window.testRunner) {
5 testRunner.dumpAsText();
6 testRunner.waitUntilDone();
9 function log(msg) {
10 var line = document.createElement('div');
11 line.appendChild(document.createTextNode(msg));
12 document.getElementById('console').appendChild(line);
15 function getEvent() {
16 var target = frames[1].window;
17 var newEvent = frames[1].document.createEvent("MouseEvent");
18 newEvent.initMouseEvent("mouseover", false, false, window, 0, 10, 10, 10, 10, false, false, false, false, 0, target);
19 target.dispatchEvent(newEvent);
23 var testStarted = false;
24 function doTest() {
25 if (testStarted)
26 return;
28 testStarted = true;
29 frames[0].location = "javascript:" +
30 "window.myeventnull = function() { parent.frames[1].window.event = null; };" +
31 "window.myeventreal = function() { parent.frames[1].window.event = parent.getEvent(); };" +
32 "parent.log('Helpers loaded!\\n');" +
33 "parent.setTimeout('continueTest()', 10);";
36 function continueTest() {
37 log('--- Test begins ---\n');
38 log('window.event = ' + frames[1].window.event + '\n');
39 log('--- After window.event = null ---\n');
40 frames[0].myeventnull();
41 log('window.event = ' + frames[1].window.event + '\n');
42 log('--- After MouseEvent completes ---\n');
43 frames[0].myeventreal();
44 log('window.event = ' + frames[1].window.event + '\n');
45 log('--- Test ends ---\n');
47 testRunner.notifyDone();
49 </script>
50 </head>
51 <body onload="doTest()">
52 <iframe src="about:blank"></iframe>
53 <iframe src=""></iframe>
54 <div id="console"></div>
55 </body>
56 </html>