Change fast/e* files to use pre and post js files in LayoutTests/resources.
[WebKit-https.git] / LayoutTests / fast / events / popup-blocked-from-fake-user-gesture.html
1 <html>
2     <head>
3         <script src="../../resources/js-test-pre.js"></script>
4     </head>
5     <body>
6         <button id="test" onclick="clickHandler()">Click Here</button>
7         <div id="console"></div>
8         <script>
9             var stolenEvent;
10             var win;
11             function clickHandler1()
12             {
13                 stolenEvent = window.event;
14                 win = window.open("about:blank", "blank");
15                 shouldBeNonNull("win");
16                 win.close();
17             }
18
19             function clickHandler2()
20             {
21                 window.event = stolenEvent;
22                 win = window.open("about:blank", "blank");
23                 shouldBeUndefined("win");
24             }
25
26             clickHandler = clickHandler1;
27
28             if (window.testRunner) {
29                 testRunner.dumpAsText();
30                 testRunner.setCanOpenWindows();
31                 testRunner.setPopupBlockingEnabled(true);
32                 testRunner.setCloseRemainingWindowsWhenComplete(true);
33                 testRunner.waitUntilDone();
34
35                 var button = document.getElementById("test");
36
37                 if (window.eventSender) {
38                     eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
39                     eventSender.mouseDown();
40                     eventSender.mouseUp();
41                 }
42
43                 clickHandler = clickHandler2;
44                 window.event = stolenEvent;
45                 button.click();
46
47                 testRunner.notifyDone();
48             }
49         </script>
50     </body>
51 </html>