OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script src="../../http/tests/inspector/console-test.js"></script> |
| 6 |
| 7 <script> |
| 8 function simpleTestFunction() |
| 9 { |
| 10 return 0; |
| 11 } |
| 12 </script> |
| 13 |
| 14 <script> |
| 15 function simpleTestFunction1() { return 0; } function simpleTestFunction2() { re
turn 0; } |
| 16 </script> |
| 17 |
| 18 <script> |
| 19 function simpleTestFunction3() { Math.random(); debugger; } |
| 20 </script> |
| 21 |
| 22 <script> |
| 23 var test = function() |
| 24 { |
| 25 var currentSourceFrame; |
| 26 InspectorTest.setQuiet(true); |
| 27 InspectorTest.runDebuggerTestSuite([ |
| 28 function testSetSimpleBreakpoint(next) |
| 29 { |
| 30 setBreakpointAndRun(next, "simpleTestFunction", "simpleTestFunction(
);"); |
| 31 }, |
| 32 |
| 33 function testSetBreakpointOnFirstFunctionInLine(next) |
| 34 { |
| 35 setBreakpointAndRun(next, "simpleTestFunction1", "simpleTestFunction
2(); simpleTestFunction1();"); |
| 36 }, |
| 37 |
| 38 function testSetBreakpointOnLastFunctionInLine(next) |
| 39 { |
| 40 setBreakpointAndRun(next, "simpleTestFunction2", "simpleTestFunction
1(); simpleTestFunction2();"); |
| 41 }, |
| 42 |
| 43 function testRemoveBreakpoint(next) |
| 44 { |
| 45 InspectorTest.evaluateInConsole("debug(simpleTestFunction3); undebug
(simpleTestFunction3);"); |
| 46 InspectorTest.evaluateInConsole("setTimeout(simpleTestFunction3, 0)"
); |
| 47 InspectorTest.waitUntilPaused(didPause1); |
| 48 |
| 49 function didPause1(callFrames, reason) |
| 50 { |
| 51 InspectorTest.addResult("Script execution paused."); |
| 52 InspectorTest.addResult("Reason for pause: " + (reason == WebIns
pector.DebuggerModel.BreakReason.DebugCommand ? "debug command" : "debugger stat
ement") + "."); |
| 53 next(); |
| 54 } |
| 55 } |
| 56 ]); |
| 57 |
| 58 function setBreakpointAndRun(next, functionName, runCmd) |
| 59 { |
| 60 InspectorTest.evaluateInConsole("debug(" + functionName + ")"); |
| 61 |
| 62 InspectorTest.addResult("Breakpoint added."); |
| 63 InspectorTest.evaluateInConsole("setTimeout(function() { " + runCmd + "
}, 0)"); |
| 64 InspectorTest.addResult("Set timer for test function."); |
| 65 InspectorTest.waitUntilPaused(didPause); |
| 66 |
| 67 function didPause(callFrames, reason) |
| 68 { |
| 69 InspectorTest.addResult("Script execution paused."); |
| 70 InspectorTest.captureStackTrace(callFrames); |
| 71 InspectorTest.evaluateInConsole("undebug(" + functionName + ")"); |
| 72 InspectorTest.addResult("Breakpoint removed."); |
| 73 InspectorTest.assertEquals(reason, WebInspector.DebuggerModel.BreakR
eason.DebugCommand); |
| 74 InspectorTest.resumeExecution(didResume); |
| 75 } |
| 76 |
| 77 function didResume() |
| 78 { |
| 79 InspectorTest.addResult("Script execution resumed."); |
| 80 next(); |
| 81 } |
| 82 } |
| 83 } |
| 84 |
| 85 </script> |
| 86 </head> |
| 87 |
| 88 <body onload="runTest()"> |
| 89 <p> |
| 90 Tests debug(fn) console command. |
| 91 </p> |
| 92 |
| 93 </body> |
| 94 </html> |
OLD | NEW |