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 type="text/javascript" src="resources/statements.js"></script> | 4 <script type="text/javascript" src="resources/statements.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function test() | 7 function test() |
8 { | 8 { |
9 var scenario = [ | 9 var scenario = [ |
10 // requested line number, insterstatement location, expected control par
ameter 'step', expected line number | 10 // requested line number, expected control parameter 'step', expected li
ne number |
11 [ 8, false, 1, 8 ], | 11 [ 8, 1, 8 ], |
12 [ 8, true, 1, 8 ], | 12 [ 8, 1, 8 ], |
13 [ 12, false, 6, 17 ], | 13 [ 12, 6, 17 ], |
14 [ 13, false, 6, 17 ], | 14 [ 13, 6, 17 ], |
15 [ 17, false, 6, 17 ], | 15 [ 17, 6, 17 ], |
16 [ 17, true, 6, 17 ], | 16 [ 17, 6, 17 ], |
17 ]; | 17 ]; |
18 | 18 |
19 InspectorTest.sendCommand("Debugger.enable", {}); | 19 InspectorTest.sendCommand("Debugger.enable", {}); |
20 | 20 |
21 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "statementsExa
mple" }, callbackEvalFunctionObject); | 21 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "statementsExa
mple" }, callbackEvalFunctionObject); |
22 | 22 |
23 function callbackEvalFunctionObject(response) | 23 function callbackEvalFunctionObject(response) |
24 { | 24 { |
25 var functionObjectId = response.result.result.objectId; | 25 var functionObjectId = response.result.result.objectId; |
26 InspectorTest.sendCommand("Runtime.getProperties", { objectId: functionO
bjectId }, callbackFunctionDetails); | 26 InspectorTest.sendCommand("Runtime.getProperties", { objectId: functionO
bjectId }, callbackFunctionDetails); |
27 } | 27 } |
28 | 28 |
29 function callbackFunctionDetails(response) | 29 function callbackFunctionDetails(response) |
30 { | 30 { |
31 var result = response.result; | 31 var result = response.result; |
32 var scriptId; | 32 var scriptId; |
33 for (var prop of result.internalProperties) { | 33 for (var prop of result.internalProperties) { |
34 if (prop.name === "[[FunctionLocation]]") | 34 if (prop.name === "[[FunctionLocation]]") |
35 scriptId = prop.value.value.scriptId; | 35 scriptId = prop.value.value.scriptId; |
36 } | 36 } |
37 | 37 |
38 nextScenarioStep(0); | 38 nextScenarioStep(0); |
39 | 39 |
40 function nextScenarioStep(pos) | 40 function nextScenarioStep(pos) |
41 { | 41 { |
42 if (pos < scenario.length) | 42 if (pos < scenario.length) |
43 gotoSinglePassChain(scriptId, scenario[pos][0], scenario[pos][1]
, scenario[pos][2], scenario[pos][3], nextScenarioStep.bind(this, pos + 1)); | 43 gotoSinglePassChain(scriptId, scenario[pos][0], scenario[pos][1]
, scenario[pos][2], nextScenarioStep.bind(this, pos + 1)); |
44 else | 44 else |
45 InspectorTest.completeTest(); | 45 InspectorTest.completeTest(); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 function gotoSinglePassChain(scriptId, lineNumber, interstatement, expectedR
esult, expectedLineNumber, next) | 49 function gotoSinglePassChain(scriptId, lineNumber, expectedResult, expectedL
ineNumber, next) |
50 { | 50 { |
51 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne; | 51 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne; |
52 | 52 |
53 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeou
t(statementsExample, 0)" }); | 53 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeou
t(statementsExample, 0)" }); |
54 | 54 |
55 function handleDebuggerPausedOne(messageObject) | 55 function handleDebuggerPausedOne(messageObject) |
56 { | 56 { |
57 InspectorTest.log("Paused on debugger statement"); | 57 InspectorTest.log("Paused on debugger statement"); |
58 | 58 |
59 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused
Two; | 59 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused
Two; |
60 | 60 |
61 InspectorTest.sendCommand("Debugger.continueToLocation", { location:
{ scriptId: scriptId, lineNumber: lineNumber, columnNumber: 0}, interstatementL
ocation: interstatement }, logContinueToLocation); | 61 InspectorTest.sendCommand("Debugger.continueToLocation", { location:
{ scriptId: scriptId, lineNumber: lineNumber, columnNumber: 0} }, logContinueTo
Location); |
62 | 62 |
63 function logContinueToLocation(response) | 63 function logContinueToLocation(response) |
64 { | 64 { |
65 if (response.error) { | 65 if (response.error) { |
66 InspectorTest.log("Failed to execute continueToLocation " +
JSON.stringify(response.error)); | 66 InspectorTest.log("Failed to execute continueToLocation " +
JSON.stringify(response.error)); |
67 InspectorTest.completeTest(); | 67 InspectorTest.completeTest(); |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
71 function handleDebuggerPausedTwo(messageObject) | 71 function handleDebuggerPausedTwo(messageObject) |
72 { | 72 { |
73 InspectorTest.log("Paused after continueToLocation (insterstatement=
" + interstatement + ")"); | 73 InspectorTest.log("Paused after continueToLocation"); |
74 var actualLineNumber = messageObject.params.callFrames[0].location.l
ineNumber; | 74 var actualLineNumber = messageObject.params.callFrames[0].location.l
ineNumber; |
75 | 75 |
76 InspectorTest.log("Stopped on line " + actualLineNumber + ", expecte
d " + expectedLineNumber + ", requested " + lineNumber + ", (0-based numbers).")
; | 76 InspectorTest.log("Stopped on line " + actualLineNumber + ", expecte
d " + expectedLineNumber + ", requested " + lineNumber + ", (0-based numbers).")
; |
77 | 77 |
78 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused
Unexpected; | 78 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused
Unexpected; |
79 | 79 |
80 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "state
mentsExample.step" }, callbackStepEvaluate); | 80 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "state
mentsExample.step" }, callbackStepEvaluate); |
81 } | 81 } |
82 | 82 |
83 function callbackStepEvaluate(response) | 83 function callbackStepEvaluate(response) |
(...skipping 10 matching lines...) Expand all Loading... |
94 InspectorTest.log("Unexpected debugger pause"); | 94 InspectorTest.log("Unexpected debugger pause"); |
95 InspectorTest.completeTest(); | 95 InspectorTest.completeTest(); |
96 } | 96 } |
97 } | 97 } |
98 } | 98 } |
99 </script> | 99 </script> |
100 </head> | 100 </head> |
101 <body onLoad="runTest();"> | 101 <body onLoad="runTest();"> |
102 </body> | 102 </body> |
103 </html> | 103 </html> |
OLD | NEW |