Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector-protocol / page / javascriptDialogEvents.html
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
4 <script>
5
6 window.onbeforeunload = onBeforeUnload;
7
8 function onBeforeUnload()
9 {
10     window.removeEventListener("beforeunload", onBeforeUnload);
11     return "beforeunload in javascriptDialogEvents";
12 }
13
14 function test()
15 {
16     InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening;
17     InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed;
18     InspectorTest.sendCommand("Page.enable", {});
19
20     function onOpening(event)
21     {
22         InspectorTest.log("Opening with message: " + event.params.message);
23     }
24     function onClosed()
25     {
26         InspectorTest.log("Closed");
27     }
28
29     InspectorTest.sendCommand("Page.navigate", { "url": "nosuchurl" });
30     InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert')" }, onDoneAlert);
31
32     function onDoneAlert()
33     {
34         InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm('confirm')" }, onDoneConfirm);
35     }
36
37     function onDoneConfirm()
38     {
39         InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('prompt')" }, onDone);
40     }
41
42     function onDone()
43     {
44         InspectorTest.completeTest();
45     }
46 }
47
48 </script>
49 </head>
50 <body onload="runTest()">
51 </body>
52 </html>