Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/protocol-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 window.addEventListener("beforeunload", onBeforeUnload); | 6 window.addEventListener("beforeunload", onBeforeUnload); |
| 7 | 7 |
| 8 function onBeforeUnload() | 8 function onBeforeUnload() |
| 9 { | 9 { |
| 10 window.removeEventListener("beforeunload", onBeforeUnload); | 10 window.removeEventListener("beforeunload", onBeforeUnload); |
| 11 return "beforeunload in javascriptDialogEvents"; | 11 return "beforeunload in javascriptDialogEvents"; |
| 12 } | 12 } |
| 13 | 13 |
| 14 function test() | 14 function test() |
| 15 { | 15 { |
| 16 InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening; | 16 InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening; |
| 17 InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed; | 17 InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed; |
| 18 InspectorTest.sendCommand("Page.enable", {}); | 18 InspectorTest.sendCommand("Page.enable", {}); |
| 19 | 19 |
| 20 function onOpening(event) | 20 function onOpening(event) |
| 21 { | 21 { |
| 22 InspectorTest.log("Opening with message: " + event.params.message); | 22 InspectorTest.log("Opening with message: " + event.params.message); |
| 23 } | 23 } |
| 24 function onClosed() | 24 function onClosed() |
| 25 { | 25 { |
| 26 InspectorTest.log("Closed"); | 26 InspectorTest.log("Closed"); |
| 27 } | 27 } |
| 28 | 28 |
| 29 InspectorTest.sendCommand("Page.navigate", { "url": "nosuchurl" }); | 29 InspectorTest.sendCommand("Page.navigate", { "url": "nosuchurl" }); |
| 30 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert' )" }); | 30 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert' )" }, onDoneAlert); |
| 31 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm('conf irm')" }); | 31 |
| 32 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('promp t')" }, onDone); | 32 function onDoneAlert() |
|
Peter.Rybin
2013/07/10 23:33:58
With a new message loop runner, dialogs starts to
| |
| 33 { | |
| 34 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm(' confirm')" }, onDoneConfirm); | |
| 35 } | |
| 36 | |
| 37 function onDoneConfirm() | |
| 38 { | |
| 39 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('p rompt')" }, onDone); | |
| 40 } | |
| 33 | 41 |
| 34 function onDone() | 42 function onDone() |
| 35 { | 43 { |
| 36 InspectorTest.completeTest(); | 44 InspectorTest.completeTest(); |
| 37 } | 45 } |
| 38 } | 46 } |
| 39 | 47 |
| 40 </script> | 48 </script> |
| 41 </head> | 49 </head> |
| 42 <body onload="runTest()"> | 50 <body onload="runTest()"> |
| 43 </body> | 51 </body> |
| 44 </html> | 52 </html> |
| OLD | NEW |