OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
4 <script> | |
5 | |
6 var messageDispatched = false; | |
7 window.addEventListener("message", function(event) | |
8 { | |
9 messageDispatched = true; | |
10 debugger; | |
11 }, true); | |
12 | |
13 function testFunction() | |
14 { | |
15 window.postMessage("test", "*"); | |
16 debugger; | |
17 } | |
18 | |
19 function test() | |
20 { | |
21 InspectorTest.sendCommand("Debugger.enable", {}); | |
22 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedInTestFu
nction; | |
23 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunction(
)" }); | |
24 | |
25 function handleDebuggerPausedInTestFunction(messageObject) | |
26 { | |
27 InspectorTest.log("Paused on 'debugger;'"); | |
28 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "messageDi
spatched" }, didEvaluateOnPause1); | |
29 } | |
30 | |
31 function didEvaluateOnPause1(messageObject) | |
32 { | |
33 var r = messageObject.result.result; | |
34 if (r.type === "boolean" && r.value === false) | |
35 InspectorTest.log("PASS: message has not been dispatched yet."); | |
36 else | |
37 InspectorTest.log("FAIL: unexpected response " + JSON.stringify(mess
ageObject, null, 2)); | |
38 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "messageDi
spatched" }, didEvaluateOnPause2); | |
39 } | |
40 | |
41 function didEvaluateOnPause2(messageObject) | |
42 { | |
43 var r = messageObject.result.result; | |
44 if (r.type === "boolean" && r.value === false) | |
45 InspectorTest.log("PASS: message has not been dispatched yet."); | |
46 else | |
47 InspectorTest.log("FAIL: unexpected response " + JSON.stringify(mess
ageObject, null, 2)); | |
48 InspectorTest.sendCommand("Debugger.resume", { }, didResume); | |
49 } | |
50 | |
51 function didResume(messageObject) | |
52 { | |
53 InspectorTest.log("Resumed, now waiting for pause in the event listener.
.."); | |
54 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedInEv
entListener; | |
55 } | |
56 | |
57 function handleDebuggerPausedInEventListener(messageObject) | |
58 { | |
59 InspectorTest.log("PASS: pasued in the event listener."); | |
60 InspectorTest.sendCommand("Debugger.resume", { }, didResume2); | |
61 } | |
62 | |
63 function didResume2(messageObject) | |
64 { | |
65 InspectorTest.completeTest(); | |
66 } | |
67 } | |
68 </script> | |
69 </head> | |
70 <body onLoad="runTest();"> | |
71 </body> | |
72 </html> | |
OLD | NEW |