Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.html

Issue 2968523003: [DevTools] Migrate inspector-protocol/debugger tests to new harness (Closed)
Patch Set: all tests Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/inspector-protocol-test.js"></script>
4 <script type="text/javascript" src="resources/statements.js"></script>
5 <script>
6
7 function test()
8 {
9 var scenario = [
10 // requested line number, expected control parameter 'step', expected li ne number
11 [ 8, 1, 8 ],
12 [ 8, 1, 8 ],
13 [ 12, 6, 17 ],
14 [ 13, 6, 17 ],
15 [ 17, 6, 17 ],
16 [ 17, 6, 17 ],
17 ];
18
19 InspectorTest.sendCommand("Debugger.enable", {});
20
21 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "statementsExa mple" }, callbackEvalFunctionObject);
22
23 function callbackEvalFunctionObject(response)
24 {
25 var functionObjectId = response.result.result.objectId;
26 InspectorTest.sendCommand("Runtime.getProperties", { objectId: functionO bjectId }, callbackFunctionDetails);
27 }
28
29 function callbackFunctionDetails(response)
30 {
31 var result = response.result;
32 var scriptId;
33 for (var prop of result.internalProperties) {
34 if (prop.name === "[[FunctionLocation]]")
35 scriptId = prop.value.value.scriptId;
36 }
37
38 nextScenarioStep(0);
39
40 function nextScenarioStep(pos)
41 {
42 if (pos < scenario.length)
43 gotoSinglePassChain(scriptId, scenario[pos][0], scenario[pos][1] , scenario[pos][2], nextScenarioStep.bind(this, pos + 1));
44 else
45 InspectorTest.completeTest();
46 }
47 }
48
49 function gotoSinglePassChain(scriptId, lineNumber, expectedResult, expectedL ineNumber, next)
50 {
51 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne;
52
53 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeou t(statementsExample, 0)" });
54
55 function handleDebuggerPausedOne(messageObject)
56 {
57 InspectorTest.log("Paused on debugger statement");
58
59 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused Two;
60
61 InspectorTest.sendCommand("Debugger.continueToLocation", { location: { scriptId: scriptId, lineNumber: lineNumber, columnNumber: 0} }, logContinueTo Location);
62
63 function logContinueToLocation(response)
64 {
65 if (response.error) {
66 InspectorTest.log("Failed to execute continueToLocation " + JSON.stringify(response.error));
67 InspectorTest.completeTest();
68 }
69 }
70 }
71 function handleDebuggerPausedTwo(messageObject)
72 {
73 InspectorTest.log("Paused after continueToLocation");
74 var actualLineNumber = messageObject.params.callFrames[0].location.l ineNumber;
75
76 InspectorTest.log("Stopped on line " + actualLineNumber + ", expecte d " + expectedLineNumber + ", requested " + lineNumber + ", (0-based numbers).") ;
77
78 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused Unexpected;
79
80 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "state mentsExample.step" }, callbackStepEvaluate);
81 }
82
83 function callbackStepEvaluate(response)
84 {
85 var resultValue = response.result.result.value;
86 InspectorTest.log("Control parameter 'step' calculation result: " + resultValue + ", expected: " + expectedResult);
87 InspectorTest.log(resultValue == expectedResult ? "SUCCESS" : "FAIL" );
88 InspectorTest.sendCommand("Debugger.resume", { });
89 next();
90 }
91
92 function handleDebuggerPausedUnexpected(messageObject)
93 {
94 InspectorTest.log("Unexpected debugger pause");
95 InspectorTest.completeTest();
96 }
97 }
98 }
99 </script>
100 </head>
101 <body onLoad="runTest();">
102 </body>
103 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698