Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / security / frameNavigation / resources / frame-with-link-to-navigate.html
1 <html>
2 <head>
3     <script src="../../resources/cross-frame-access.js"></script>
4     <script>
5         window.onload = function()
6         {
7             document.getElementsByTagName('h4')[0].innerHTML = document.domain;
8             window.addEventListener('message', runTest);
9         }
10
11         runTest = function()
12         {
13             if (!window.testRunner)
14                 return;
15
16             var event = document.createEvent('MouseEvent');
17             event.initEvent( 'click', true, true );
18             document.getElementById('anchorLink').dispatchEvent(event);
19
20             start = new Date();
21             myInterval = setInterval(checkIfDone, 1);
22         }
23
24         checkIfDone = function()
25         {
26             var numOpenWindows = testRunner.windowCount();
27             var now = new Date();
28             if (numOpenWindows == 2) {
29                 log("Test PASSED");
30                 clearInterval(myInterval);
31                 testRunner.notifyDone();            
32             } else if (now - start > 10000) {
33                 log('TEST FAILED: Window count ' + numOpenWindows);
34                 clearInterval(myInterval);
35                 testRunner.notifyDone();
36             }
37         }
38     </script>
39 </head>
40 <body>
41     <h3>Frame-with-link-to-navigate</h3>
42     <h4>DOMAIN</h4>
43     <pre id='console'></pre>
44     <a id="anchorLink" href="navigation-happened.html" target="toNavigate">Click me</a>
45 </body>
46 </html>