Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/page/javascriptDialogEvents.html

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: Protocol -> dp Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script>
5
6 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
7
8 // JavaScript onbeforeunload dialogs require a user gesture.
9 if (window.eventSender) {
10 eventSender.mouseMoveTo(5, 5);
11 eventSender.mouseDown();
12 eventSender.mouseUp();
13 }
14
15 window.onbeforeunload = onBeforeUnload;
16
17 function onBeforeUnload()
18 {
19 window.removeEventListener("beforeunload", onBeforeUnload);
20 return "beforeunload in javascriptDialogEvents";
21 }
22
23 function test()
24 {
25 InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening;
26 InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed;
27 InspectorTest.sendCommand("Page.enable", {});
28
29 function onOpening(event)
30 {
31 InspectorTest.log("Opening dialog: type=" + event.params.type + "; messa ge=" + event.params.message);
32 }
33
34 function onClosed(event)
35 {
36 InspectorTest.log("Closed dialog: result=" + event.params.result);
37 }
38
39 InspectorTest.sendCommand("Page.navigate", { "url": "http://nosuchurl" });
40 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert' )" }, onDoneAlert);
41
42 function onDoneAlert()
43 {
44 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm(' confirm')" }, onDoneConfirm);
45 }
46
47 function onDoneConfirm()
48 {
49 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('p rompt')" }, onDone);
50 }
51
52 function onDone()
53 {
54 InspectorTest.completeTest();
55 }
56 }
57
58 </script>
59 </head>
60 <body onload="runTest()">
61 </body>
62 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698