| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 InspectorTest.startDumpingProtocolMessages(); | 8 InspectorTest.startDumpingProtocolMessages(); |
| 9 InspectorTest.sendCommand("Debugger.enable", {}, setEventListenerBreakpoint)
; | 9 InspectorTest.sendCommand("Debugger.enable", {}, setEventListenerBreakpointW
henDOMDisabled); |
| 10 | 10 |
| 11 function finishIfError(message) | 11 function finishIfError(message) |
| 12 { | 12 { |
| 13 if (message.result) | 13 if (message.result) |
| 14 return; | 14 return; |
| 15 testRunner.logToStderr("FAIL: finishIfError"); | |
| 16 InspectorTest.log("FAIL: " + JSON.stringify(message)); | 15 InspectorTest.log("FAIL: " + JSON.stringify(message)); |
| 17 InspectorTest.completeTest(); | 16 InspectorTest.completeTest(); |
| 18 } | 17 } |
| 19 | 18 |
| 19 function setEventListenerBreakpointWhenDOMDisabled(message) |
| 20 { |
| 21 finishIfError(message); |
| 22 InspectorTest.log("PASS: Debugger was enabled"); |
| 23 InspectorTest.sendCommand("DOMDebugger.setEventListenerBreakpoint", {'ev
entName':'click'}, enableDOMAgent); |
| 24 } |
| 25 |
| 26 function enableDOMAgent(message) |
| 27 { |
| 28 InspectorTest.log("Error on attempt to set event listener breakpoint whe
n DOM is disabled: " + message.error.message); |
| 29 InspectorTest.sendCommand("DOM.enable", {}, setEventListenerBreakpoint); |
| 30 } |
| 31 |
| 20 function setEventListenerBreakpoint(message) | 32 function setEventListenerBreakpoint(message) |
| 21 { | 33 { |
| 22 finishIfError(message); | 34 finishIfError(message); |
| 23 InspectorTest.log("PASS: Debugger was enabled"); | 35 InspectorTest.log("PASS: DOM was enabled"); |
| 24 InspectorTest.sendCommand("DOMDebugger.setEventListenerBreakpoint", {'ev
entName':'click'}, disableDOMAgent); | 36 InspectorTest.sendCommand("DOMDebugger.setEventListenerBreakpoint", {'ev
entName':'click'}, disableDOMAgent); |
| 25 } | 37 } |
| 26 | 38 |
| 39 |
| 27 function disableDOMAgent(message) | 40 function disableDOMAgent(message) |
| 28 { | 41 { |
| 29 finishIfError(message); | 42 finishIfError(message); |
| 30 InspectorTest.log("PASS: Listener was set and we expect that DOM agent w
as silently enabled."); | 43 InspectorTest.log("PASS: Listener was set."); |
| 31 InspectorTest.sendCommand("DOM.disable", {}, disableDOMAgent2); | 44 InspectorTest.sendCommand("DOM.disable", {}, disableDOMAgent2); |
| 32 } | 45 } |
| 33 | 46 |
| 34 function disableDOMAgent2(message) | 47 function disableDOMAgent2(message) |
| 35 { | 48 { |
| 36 finishIfError(message); | 49 finishIfError(message); |
| 37 InspectorTest.log("PASS: DOM agent was disabled successfully."); | 50 InspectorTest.log("PASS: DOM agent was disabled successfully."); |
| 38 InspectorTest.sendCommand("DOM.disable", {}, finish); | 51 InspectorTest.sendCommand("DOM.disable", {}, finish); |
| 39 } | 52 } |
| 40 | 53 |
| 41 function finish(message) | 54 function finish(message) |
| 42 { | 55 { |
| 43 if (!message.error) { | 56 if (!message.error) { |
| 44 testRunner.logToStderr("FAIL: finish"); | |
| 45 InspectorTest.log("FAIL: we expected an error but it wasn't happen."
); | 57 InspectorTest.log("FAIL: we expected an error but it wasn't happen."
); |
| 46 InspectorTest.completeTest(); | 58 InspectorTest.completeTest(); |
| 47 return; | 59 return; |
| 48 } | 60 } |
| 49 | 61 |
| 50 InspectorTest.log("PASS: The second attempt to disable DOM agent failed
as expected."); | 62 InspectorTest.log("PASS: The second attempt to disable DOM agent failed
as expected."); |
| 51 InspectorTest.completeTest(); | 63 InspectorTest.completeTest(); |
| 52 } | 64 } |
| 53 } | 65 } |
| 54 </script> | 66 </script> |
| 55 </head> | 67 </head> |
| 56 <body onLoad="runTest();"> | 68 <body onLoad="runTest();"> |
| 57 </body> | 69 </body> |
| 58 </html> | 70 </html> |
| OLD | NEW |