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

Side by Side Diff: test/inspector/debugger/get-possible-breakpoints-master.js

Issue 2728563002: [inspector] added type of break location into getPossibleBreakpoints output (Closed)
Patch Set: added DCHECK 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
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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.log('Checks Debugger.getPossibleBreakpoints'); 5 InspectorTest.log('Checks Debugger.getPossibleBreakpoints');
6 6
7 var source = utils.read('test/inspector/debugger/resources/break-locations.js'); 7 var source = utils.read('test/inspector/debugger/resources/break-locations.js');
8 InspectorTest.addScript(source); 8 InspectorTest.addScript(source);
9 9
10 Protocol.Debugger.onceScriptParsed() 10 Protocol.Debugger.onceScriptParsed()
11 .then(message => Protocol.Debugger.getPossibleBreakpoints({ start: { lineNumbe r: 0, columnNumber : 0, scriptId: message.params.scriptId }})) 11 .then(message => Protocol.Debugger.getPossibleBreakpoints({ start: { lineNumbe r: 0, columnNumber : 0, scriptId: message.params.scriptId }}))
12 .then(dumpAllLocations) 12 .then(dumpAllLocations)
13 .then(InspectorTest.completeTest); 13 .then(InspectorTest.completeTest);
14 Protocol.Debugger.enable(); 14 Protocol.Debugger.enable();
15 15
16 function dumpAllLocations(message) { 16 function dumpAllLocations(message) {
17 if (message.error) { 17 if (message.error) {
18 InspectorTest.logMessage(message); 18 InspectorTest.logMessage(message);
19 return; 19 return;
20 } 20 }
21 var lines = source.split('\n'); 21 var lines = source.split('\n');
22 var locations = message.result.locations.sort((loc1, loc2) => { 22 var locations = message.result.locations.sort((loc1, loc2) => {
23 if (loc2.lineNumber !== loc1.lineNumber) return loc2.lineNumber - loc1.lineN umber; 23 if (loc2.lineNumber !== loc1.lineNumber) return loc2.lineNumber - loc1.lineN umber;
24 return loc2.columnNumber - loc1.columnNumber; 24 return loc2.columnNumber - loc1.columnNumber;
25 }); 25 });
26 for (var location of locations) { 26 for (var location of locations) {
27 var line = lines[location.lineNumber]; 27 var line = lines[location.lineNumber];
28 line = line.slice(0, location.columnNumber) + '#' + line.slice(location.colu mnNumber); 28 line = line.slice(0, location.columnNumber) + locationMark(location.type) + line.slice(location.columnNumber);
29 lines[location.lineNumber] = line; 29 lines[location.lineNumber] = line;
30 } 30 }
31 lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1); 31 lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1);
32 InspectorTest.log(lines.join('\n')); 32 InspectorTest.log(lines.join('\n'));
33 return message; 33 return message;
34 } 34 }
35
36 function locationMark(type) {
37 if (type === 'return') return '|R|';
38 if (type === 'call') return '|C|';
39 if (type === 'debuggerStatement') return '|D|';
40 return '|_|';
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698