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

Side by Side Diff: test/inspector/protocol-test.js

Issue 2720813002: [wasm] Fix importing wasm functions which are being debugged (Closed)
Patch Set: Awesome inspector test now :) Created 3 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
« no previous file with comments | « test/inspector/debugger/wasm-imports-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = {}; 5 InspectorTest = {};
6 InspectorTest._dispatchTable = new Map(); 6 InspectorTest._dispatchTable = new Map();
7 InspectorTest._requestId = 0; 7 InspectorTest._requestId = 0;
8 InspectorTest._dumpInspectorProtocolMessages = false; 8 InspectorTest._dumpInspectorProtocolMessages = false;
9 InspectorTest._eventHandler = {}; 9 InspectorTest._eventHandler = {};
10 10
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 { 131 {
132 for (var frame of callFrames) { 132 for (var frame of callFrames) {
133 var functionName = frame.functionName || '(anonymous)'; 133 var functionName = frame.functionName || '(anonymous)';
134 var url = frame.url ? frame.url : InspectorTest._scriptMap.get(frame.locatio n.scriptId).url; 134 var url = frame.url ? frame.url : InspectorTest._scriptMap.get(frame.locatio n.scriptId).url;
135 var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumb er; 135 var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumb er;
136 var columnNumber = frame.location ? frame.location.columnNumber : frame.colu mnNumber; 136 var columnNumber = frame.location ? frame.location.columnNumber : frame.colu mnNumber;
137 InspectorTest.log(`${functionName} (${url}:${lineNumber}:${columnNumber})`); 137 InspectorTest.log(`${functionName} (${url}:${lineNumber}:${columnNumber})`);
138 } 138 }
139 } 139 }
140 140
141 InspectorTest.logCallFrameSourceLocation = function(callFrame) 141 InspectorTest.logSourceLocation = function(location)
142 { 142 {
143 var scriptId = callFrame.location.scriptId; 143 var scriptId = location.scriptId;
144 if (!InspectorTest._scriptMap || !InspectorTest._scriptMap.has(scriptId)) { 144 if (!InspectorTest._scriptMap || !InspectorTest._scriptMap.has(scriptId)) {
145 InspectorTest.log("InspectorTest.setupScriptMap should be called before Prot ocol.Debugger.enable."); 145 InspectorTest.log("InspectorTest.setupScriptMap should be called before Prot ocol.Debugger.enable.");
146 InspectorTest.completeTest(); 146 InspectorTest.completeTest();
147 } 147 }
148 var script = InspectorTest._scriptMap.get(scriptId); 148 var script = InspectorTest._scriptMap.get(scriptId);
149 if (!script.scriptSource) { 149 if (!script.scriptSource) {
150 return Protocol.Debugger.getScriptSource({ scriptId }) 150 return Protocol.Debugger.getScriptSource({ scriptId })
151 .then(message => script.scriptSource = message.result.scriptSource) 151 .then(message => script.scriptSource = message.result.scriptSource)
152 .then(dumpSourceWithLocation); 152 .then(dumpSourceWithLocation);
153 } 153 }
154 return Promise.resolve().then(dumpSourceWithLocation); 154 return Promise.resolve().then(dumpSourceWithLocation);
155 155
156 function dumpSourceWithLocation() { 156 function dumpSourceWithLocation() {
157 var location = callFrame.location;
158 var lines = script.scriptSource.split('\n'); 157 var lines = script.scriptSource.split('\n');
159 var line = lines[location.lineNumber]; 158 var line = lines[location.lineNumber];
160 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col umnNumber) || ''); 159 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col umnNumber) || '');
161 lines[location.lineNumber] = line; 160 lines[location.lineNumber] = line;
162 InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location .lineNumber + 2).join('\n')); 161 InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location .lineNumber + 2).join('\n'));
163 InspectorTest.log(''); 162 InspectorTest.log('');
164 } 163 }
165 } 164 }
166 165
166 InspectorTest.logSourceLocations = function(locations) {
167 if (locations.length == 0) return Promise.resolve();
kozy 2017/03/02 21:31:10 We recently allow async-await syntax in tests, so:
168 return InspectorTest.logSourceLocation(locations[0])
169 .then(() => InspectorTest.logSourceLocations(locations.splice(1)));
170 }
171
167 InspectorTest.logAsyncStackTrace = function(asyncStackTrace) 172 InspectorTest.logAsyncStackTrace = function(asyncStackTrace)
168 { 173 {
169 while (asyncStackTrace) { 174 while (asyncStackTrace) {
170 if (asyncStackTrace.promiseCreationFrame) { 175 if (asyncStackTrace.promiseCreationFrame) {
171 var frame = asyncStackTrace.promiseCreationFrame; 176 var frame = asyncStackTrace.promiseCreationFrame;
172 InspectorTest.log(`-- ${asyncStackTrace.description} (${frame.url 177 InspectorTest.log(`-- ${asyncStackTrace.description} (${frame.url
173 }:${frame.lineNumber}:${frame.columnNumber})--`); 178 }:${frame.lineNumber}:${frame.columnNumber})--`);
174 } else { 179 } else {
175 InspectorTest.log(`-- ${asyncStackTrace.description} --`); 180 InspectorTest.log(`-- ${asyncStackTrace.description} --`);
176 } 181 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 293 }
289 } catch (e) { 294 } catch (e) {
290 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac k + "\n message = " + JSON.stringify(messageObject, null, 2)); 295 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac k + "\n message = " + JSON.stringify(messageObject, null, 2));
291 InspectorTest.completeTest(); 296 InspectorTest.completeTest();
292 } 297 }
293 } 298 }
294 299
295 InspectorTest.loadScript = function(fileName) { 300 InspectorTest.loadScript = function(fileName) {
296 InspectorTest.addScript(utils.read(fileName)); 301 InspectorTest.addScript(utils.read(fileName));
297 } 302 }
OLDNEW
« no previous file with comments | « test/inspector/debugger/wasm-imports-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698