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

Side by Side Diff: test/inspector/debugger/continue-to-location.js

Issue 2390733002: [inspector] Make InspectorTest.sendCommand* private (Closed)
Patch Set: addressed comments Created 4 years, 2 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
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 InspectorTest.evaluateInPage( 5 InspectorTest.addScript(
6 `function statementsExample() 6 `function statementsExample()
7 { 7 {
8 var self = arguments.callee; 8 var self = arguments.callee;
9 9
10 debugger; 10 debugger;
11 11
12 self.step = 1; 12 self.step = 1;
13 13
14 self.step = 2; 14 self.step = 2;
15 15
(...skipping 10 matching lines...) Expand all
26 var scenario = [ 26 var scenario = [
27 // requested line number, expected control parameter 'step', expected line num ber 27 // requested line number, expected control parameter 'step', expected line num ber
28 [ 8, 1, 8 ], 28 [ 8, 1, 8 ],
29 [ 8, 1, 8 ], 29 [ 8, 1, 8 ],
30 [ 12, 6, 17 ], 30 [ 12, 6, 17 ],
31 [ 13, 6, 17 ], 31 [ 13, 6, 17 ],
32 [ 17, 6, 17 ], 32 [ 17, 6, 17 ],
33 [ 17, 6, 17 ], 33 [ 17, 6, 17 ],
34 ]; 34 ];
35 35
36 InspectorTest.sendCommand("Debugger.enable", {}); 36 Protocol.Debugger.enable();
37 37
38 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "statementsExample " }, callbackEvalFunctionObject); 38 Protocol.Runtime.evaluate({ "expression": "statementsExample" }).then(callbackEv alFunctionObject);
39 39
40 function callbackEvalFunctionObject(response) 40 function callbackEvalFunctionObject(response)
41 { 41 {
42 var functionObjectId = response.result.result.objectId; 42 var functionObjectId = response.result.result.objectId;
43 InspectorTest.sendCommand("Runtime.getProperties", { objectId: functionObjectI d }, callbackFunctionDetails); 43 Protocol.Runtime.getProperties({ objectId: functionObjectId }).then(callbackFu nctionDetails);
44 } 44 }
45 45
46 function callbackFunctionDetails(response) 46 function callbackFunctionDetails(response)
47 { 47 {
48 var result = response.result; 48 var result = response.result;
49 var scriptId; 49 var scriptId;
50 for (var prop of result.internalProperties) { 50 for (var prop of result.internalProperties) {
51 if (prop.name === "[[FunctionLocation]]") 51 if (prop.name === "[[FunctionLocation]]")
52 scriptId = prop.value.value.scriptId; 52 scriptId = prop.value.value.scriptId;
53 } 53 }
54 54
55 nextScenarioStep(0); 55 nextScenarioStep(0);
56 56
57 function nextScenarioStep(pos) 57 function nextScenarioStep(pos)
58 { 58 {
59 if (pos < scenario.length) 59 if (pos < scenario.length)
60 gotoSinglePassChain(scriptId, scenario[pos][0], scenario[pos][1], scenario [pos][2], nextScenarioStep.bind(this, pos + 1)); 60 gotoSinglePassChain(scriptId, scenario[pos][0], scenario[pos][1], scenario [pos][2], nextScenarioStep.bind(this, pos + 1));
61 else 61 else
62 InspectorTest.completeTest(); 62 InspectorTest.completeTest();
63 } 63 }
64 } 64 }
65 65
66 function gotoSinglePassChain(scriptId, lineNumber, expectedResult, expectedLineN umber, next) 66 function gotoSinglePassChain(scriptId, lineNumber, expectedResult, expectedLineN umber, next)
67 { 67 {
68 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne; 68 Protocol.Debugger.oncePaused().then(handleDebuggerPausedOne);
69 69
70 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(stat ementsExample, 0)" }); 70 Protocol.Runtime.evaluate({ "expression": "setTimeout(statementsExample, 0)" } );
71 71
72 function handleDebuggerPausedOne(messageObject) 72 function handleDebuggerPausedOne(messageObject)
73 { 73 {
74 InspectorTest.log("Paused on debugger statement"); 74 InspectorTest.log("Paused on debugger statement");
75 75
76 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedTwo; 76 Protocol.Debugger.oncePaused().then(handleDebuggerPausedTwo);
77 77
78 InspectorTest.sendCommand("Debugger.continueToLocation", { location: { scrip tId: scriptId, lineNumber: lineNumber, columnNumber: 0} }, logContinueToLocation ); 78 Protocol.Debugger.continueToLocation({ location: { scriptId: scriptId, lineN umber: lineNumber, columnNumber: 0} }).then(logContinueToLocation);
79 79
80 function logContinueToLocation(response) 80 function logContinueToLocation(response)
81 { 81 {
82 if (response.error) { 82 if (response.error) {
83 InspectorTest.log("Failed to execute continueToLocation " + JSON.stringi fy(response.error)); 83 InspectorTest.log("Failed to execute continueToLocation " + JSON.stringi fy(response.error));
84 InspectorTest.completeTest(); 84 InspectorTest.completeTest();
85 } 85 }
86 } 86 }
87 } 87 }
88 function handleDebuggerPausedTwo(messageObject) 88 function handleDebuggerPausedTwo(messageObject)
89 { 89 {
90 InspectorTest.log("Paused after continueToLocation"); 90 InspectorTest.log("Paused after continueToLocation");
91 var actualLineNumber = messageObject.params.callFrames[0].location.lineNumbe r; 91 var actualLineNumber = messageObject.params.callFrames[0].location.lineNumbe r;
92 92
93 InspectorTest.log("Stopped on line " + actualLineNumber + ", expected " + ex pectedLineNumber + ", requested " + lineNumber + ", (0-based numbers)."); 93 InspectorTest.log("Stopped on line " + actualLineNumber + ", expected " + ex pectedLineNumber + ", requested " + lineNumber + ", (0-based numbers).");
94 94
95 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedUnexpect ed; 95 Protocol.Debugger.oncePaused(handleDebuggerPausedUnexpected);
96 96
97 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "statementsExa mple.step" }, callbackStepEvaluate); 97 Protocol.Runtime.evaluate({ "expression": "statementsExample.step" }).then(c allbackStepEvaluate);
98 } 98 }
99 99
100 function callbackStepEvaluate(response) 100 function callbackStepEvaluate(response)
101 { 101 {
102 var resultValue = response.result.result.value; 102 var resultValue = response.result.result.value;
103 InspectorTest.log("Control parameter 'step' calculation result: " + resultVa lue + ", expected: " + expectedResult); 103 InspectorTest.log("Control parameter 'step' calculation result: " + resultVa lue + ", expected: " + expectedResult);
104 InspectorTest.log(resultValue === expectedResult ? "SUCCESS" : "FAIL"); 104 InspectorTest.log(resultValue === expectedResult ? "SUCCESS" : "FAIL");
105 InspectorTest.sendCommand("Debugger.resume", { }); 105 Protocol.Debugger.resume();
106 next(); 106 next();
107 } 107 }
108 108
109 function handleDebuggerPausedUnexpected(messageObject) 109 function handleDebuggerPausedUnexpected(messageObject)
110 { 110 {
111 InspectorTest.log("Unexpected debugger pause"); 111 InspectorTest.log("Unexpected debugger pause");
112 InspectorTest.completeTest(); 112 InspectorTest.completeTest();
113 } 113 }
114 } 114 }
OLDNEW
« no previous file with comments | « test/inspector/debugger/call-frame-function-location.js ('k') | test/inspector/debugger/doesnt-step-into-injected-script.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698