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

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

Issue 1786243002: [DevTools] Move restartFrame and setCallFrameVariableValue to V8DebuggerAgent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dgozman-patch
Patch Set: Created 4 years, 9 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/inspecto r-protocol-test.js"></script>
pfeldman 2016/03/12 01:23:26 You are removing this test, but leaving the protoc
kozy 2016/03/12 01:30:15 I haven't changed coverage of this protocol method
4 <script>
5
6 function test()
7 {
8 // A general-purpose engine for sending a sequence of protocol commands.
9 // The clients provide requests and response handlers, while the engine catc hes
10 // errors and makes sure that once there's nothing to do completeTest() is c alled.
11 // @param step is an object with command, params and callback fields
12 function runRequestSeries(step) {
13 processStep(step);
14
15 function processStep(s) {
16 try {
17 processStepOrFail(s);
18 } catch (e) {
19 InspectorTest.log(e.stack);
20 InspectorTest.completeTest();
21 }
22 }
23
24 function processStepOrFail(s) {
25 if (!s) {
26 InspectorTest.completeTest();
27 return;
28 }
29 if (!s.command) {
30 // A simple loopback step.
31 var next = s.callback();
32 processStep(next);
33 return;
34 }
35
36 var innerCallback = function(response) {
37 var next;
38 if ("error" in response) {
39 if (!("errorHandler" in s)) {
40 // Error message is not logged intentionally, it may be platform-specific.
41 InspectorTest.log("Protocol command '" + s.command + "' failed");
42 InspectorTest.completeTest();
43 return;
44 }
45 try {
46 next = s.errorHandler(response.error);
47 } catch (e) {
48 InspectorTest.log(e.stack);
49 InspectorTest.completeTest();
50 return;
51 }
52 } else {
53 try {
54 next = s.callback(response.result);
55 } catch (e) {
56 InspectorTest.log(e.stack);
57 InspectorTest.completeTest();
58 return;
59 }
60 }
61 processStep(next);
62 }
63 InspectorTest.sendCommand(s.command, s.params, innerCallback);
64 }
65 }
66
67 var firstStep = { callback: enableDebugger };
68
69 runRequestSeries(firstStep);
70
71 function enableDebugger() {
72 return { command: "Debugger.enable", params: {}, callback: evalFunction };
73 }
74
75 // Testing function/closure scopes.
76
77 function evalFunction(response) {
78 var expression = "(function(p){var r=5;with({year:2013}){return function Closure(q){return p+q+r+year};}})('ttt')";
79 return { command: "Runtime.evaluate", params: {expression: expression}, callback: callbackEvalFunction };
80 }
81
82 function callbackEvalFunction(result) {
83 var id = result.result.objectId;
84 if (id === undefined)
85 throw new Error("objectId is expected");
86 return createCheckFunctionStepChain(id);
87 }
88
89 function createCheckFunctionStepChain(functionObjectId) {
90 var params = {
91 objectId: functionObjectId,
92 functionDeclaration: "function(){return this(true);}"
93 };
94 return {
95 command: "Runtime.callFunctionOn", params: params, callback: callbac kLogClosureEval
96 };
97
98 function callbackLogClosureEval(result) {
99 InspectorTest.log("Closure returns: " + JSON.stringify(result.re sult));
100 InspectorTest.log(" (expected: 'ttttrue52013')");
101
102 var params = {
103 functionObjectId: functionObjectId,
104 scopeNumber: 1,
105 variableName: "r",
106 newValue: { value: 4 }
107 };
108 return {
109 command: "Debugger.setVariableValue", params: params, callba ck: setVariableCallback
110 };
111 }
112
113 function setVariableCallback() {
114 InspectorTest.log("Debugger.setVariableValue OK");
115
116 var params = {
117 objectId: functionObjectId,
118 functionDeclaration: "function(){return this(true);}"
119 };
120 return {
121 command: "Runtime.callFunctionOn", params: params, callback: callbackLogClosureEval2
122 };
123
124 }
125
126 function callbackLogClosureEval2(result) {
127 InspectorTest.log("Closure returns: " + JSON.stringify(result.re sult));
128 InspectorTest.log(" (expected: 'ttttrue42013')");
129
130 var params = {
131 // No target is specified
132 scopeNumber: 1,
133 variableName: "r",
134 newValue: { value: 4 }
135 };
136 return {
137 command: "Debugger.setVariableValue", params: params, errorH andler: setVariableErrorCallback3
138 };
139 }
140
141 function setVariableErrorCallback3(error) {
142 InspectorTest.log("Expected error: " + JSON.stringify(error));
143
144 var params = {
145 functionObjectId: functionObjectId,
146 scopeNumber: 100, // Wrong scope number
147 variableName: "r",
148 newValue: { value: 4 }
149 };
150 return {
151 command: "Debugger.setVariableValue", params: params, errorH andler: setVariableErrorCallback4
152 };
153 }
154
155 function setVariableErrorCallback4(error) {
156 InspectorTest.log("Expected error");
157
158 var params = {
159 functionObjectId: functionObjectId,
160 scopeNumber: 1,
161 variableName: "bad", // Wrong variable name
162 newValue: { value: 4 }
163 };
164 return {
165 command: "Debugger.setVariableValue", params: params, errorH andler: setVariableErrorCallback5
166 };
167 }
168
169 function setVariableErrorCallback5(error) {
170 InspectorTest.log("Expected error");
171
172 // End of test.
173 return;
174 }
175 }
176 }
177 </script>
178 </head>
179 <body onLoad="runTest();">
180 </body>
181 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698