Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / events / show-modal-dialog-onblur-onfocus.html
1 <html>
2 <head>
3 <script>
4     function runTests()
5     {
6         window.onfocus = onFocusFunc;
7         window.onblur = onBlurFunc;
8         if (window.testRunner) {
9             testRunner.dumpAsText();
10             testRunner.setCanOpenWindows();
11             testRunner.waitUntilDone();
12
13             // DumpRenderTreeWindow does not respond to focus events.  Forcing onblur event so
14             // that the results matches what you'll see in the browser.
15             testRunner.setWindowIsKey(false);
16         }
17         showModalDialog("resources/modal-dialog.html");
18     }
19
20     function log(message)
21     {
22         var console = document.getElementById("console");
23         var li = document.createElement("li");
24         var text = document.createTextNode(message);
25     
26         console.appendChild(li);
27         li.appendChild(text);
28     }
29
30     function onBlurFunc()
31     {
32         log("onblur fired.  Should see this exactly once.");
33     }
34
35     function onFocusFunc()
36     {
37         log("ERROR: onfocus fired.");
38     }
39 </script>
40 </head>
41
42 <body onload="runTests()">
43     <p>Pop up a modal dialog.  Verifies that focus events are not fired while inside the message loop.</p><br/>
44     <p>You need to disable pop-up blocker for this test to run successfully in the browser.</p>
45     <ul id="console"></ul>
46 </body>
47 </html>