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

Side by Side Diff: test/inspector/debugger/stepping-with-blackboxed-ranges.js

Issue 2379303002: Revert "[inspector] added inspector test runner [part 3-5]" (Closed)
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 InspectorTest.evaluateInPage(
6 `function blackboxedBoo()
7 {
8 var a = 42;
9 var b = foo();
10 return a + b;
11 }
12 //# sourceURL=blackboxed-script.js`);
13
14 InspectorTest.evaluateInPage(
15 `function notBlackboxedFoo()
16 {
17 var a = 42;
18 var b = blackboxedBoo();
19 return a + b;
20 }
21
22 function blackboxedFoo()
23 {
24 var a = 42;
25 var b = notBlackboxedFoo();
26 return a + b;
27 }
28
29 function notBlackboxedBoo()
30 {
31 var a = 42;
32 var b = blackboxedFoo();
33 return a + b;
34 }
35 //# sourceURL=mixed-source.js`);
36
37 InspectorTest.evaluateInPage(
38 `function testFunction()
39 {
40 notBlackboxedBoo(); // for setup ranges and stepOut
41 notBlackboxedBoo(); // for stepIn
42 }
43
44 function foo()
45 {
46 debugger;
47 return 239;
48 }`);
49
50 InspectorTest.eventHandler["Debugger.paused"] = setBlackboxedScriptRanges;
51 InspectorTest.sendCommandOrDie("Debugger.enable", {}, callTestFunction);
52
53 function callTestFunction(response)
54 {
55 InspectorTest.sendCommand("Runtime.evaluate", { expression: "setTimeout(testFu nction, 0);"});
56 }
57
58 function setBlackboxedScriptRanges(response)
59 {
60 var callFrames = response.params.callFrames;
61 printCallFrames(callFrames);
62 InspectorTest.sendCommand("Debugger.setBlackboxedRanges", {
63 scriptId: callFrames[1].location.scriptId,
64 positions: [ { lineNumber: 0, columnNumber: 0 } ] // blackbox ranges for bla ckboxed.js
65 }, setIncorrectRanges.bind(null, callFrames[2].location.scriptId));
66 }
67
68 var incorrectPositions = [
69 [ { lineNumber: 0, columnNumber: 0 }, { lineNumber: 0, columnNumber: 0 } ],
70 [ { lineNumber: 0, columnNumber: 1 }, { lineNumber: 0, columnNumber: 0 } ],
71 [ { lineNumber: 0, columnNumber: -1 } ],
72 ];
73
74 function setIncorrectRanges(scriptId, response)
75 {
76 if (response.error)
77 InspectorTest.log(response.error.message);
78 var positions = incorrectPositions.shift();
79 if (!positions) {
80 setMixedSourceRanges(scriptId);
81 return;
82 }
83 InspectorTest.log("Try to set positions: " + JSON.stringify(positions));
84 InspectorTest.sendCommand("Debugger.setBlackboxedRanges", {
85 scriptId: scriptId,
86 positions: positions
87 }, setIncorrectRanges.bind(null, scriptId));
88 }
89
90 function setMixedSourceRanges(scriptId)
91 {
92 InspectorTest.eventHandler["Debugger.paused"] = runAction;
93 InspectorTest.sendCommandOrDie("Debugger.setBlackboxedRanges", {
94 scriptId: scriptId,
95 positions: [ { lineNumber: 8, columnNumber: 0 }, { lineNumber: 15, columnNum ber: 0 } ] // blackbox ranges for mixed.js
96 }, runAction);
97 }
98
99 var actions = [ "stepOut", "print", "stepOut", "print", "stepOut", "print",
100 "stepInto", "print", "stepOver", "stepInto", "print", "stepOver", "stepInto" , "print",
101 "stepOver", "stepInto", "print" ];
102
103 function runAction(response)
104 {
105 var action = actions.shift();
106 if (!action)
107 InspectorTest.completeTest();
108
109 if (action === "print") {
110 printCallFrames(response.params.callFrames);
111 runAction({});
112 } else {
113 InspectorTest.log("action: " + action);
114 InspectorTest.sendCommandOrDie("Debugger." + action, {});
115 }
116 }
117
118 function printCallFrames(callFrames)
119 {
120 var topCallFrame = callFrames[0];
121 if (topCallFrame.functionName.startsWith("blackboxed"))
122 InspectorTest.log("FAIL: blackboxed function in top call frame");
123 for (var callFrame of callFrames)
124 InspectorTest.log(callFrame.functionName + ": " + callFrame.location.lineNum ber + ":" + callFrame.location.columnNumber);
125 InspectorTest.log("");
126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698