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

Side by Side Diff: test/inspector/debugger/get-possible-breakpoints-restrict-to-function.js

Issue 2891213002: [inspector] Refactor protocol-test.js (Closed)
Patch Set: comments addressed Created 3 years, 7 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.log('Checks Debugger.getPossibleBreakpoints with ignoreNestedFunct ions'); 5 let {session, contextGroup, Protocol} = InspectorTest.start('Checks Debugger.get PossibleBreakpoints with ignoreNestedFunctions');
6 6
7 var source = ` 7 var source = `
8 function test() { 8 function test() {
9 Array.from([1,2]).map(() => 1).filter(() => true); 9 Array.from([1,2]).map(() => 1).filter(() => true);
10 function nested1() { 10 function nested1() {
11 Array.from([1,2]).map(() => 1).filter(() => true); 11 Array.from([1,2]).map(() => 1).filter(() => true);
12 } 12 }
13 function nested2() { 13 function nested2() {
14 Array.from([1,2]).map(() => 1).filter(() => true); 14 Array.from([1,2]).map(() => 1).filter(() => true);
15 } 15 }
16 nested1(); 16 nested1();
17 nested2(); 17 nested2();
18 } 18 }
19 //# sourceURL=test.js`; 19 //# sourceURL=test.js`;
20 InspectorTest.addScript(source); 20 contextGroup.addScript(source);
21 21
22 var scriptId; 22 var scriptId;
23 Protocol.Debugger.onceScriptParsed().then(message => { 23 Protocol.Debugger.onceScriptParsed().then(message => {
24 if (message.params.url === 'test.js') 24 if (message.params.url === 'test.js')
25 scriptId = message.params.scriptId; 25 scriptId = message.params.scriptId;
26 }).then(() => InspectorTest.runTestSuite(tests)); 26 }).then(() => InspectorTest.runTestSuite(tests));
27 27
28 InspectorTest.setupScriptMap(); 28 session.setupScriptMap();
29 Protocol.Debugger.onPaused(dumpBreakLocationInSourceAndResume); 29 Protocol.Debugger.onPaused(dumpBreakLocationInSourceAndResume);
30 30
31 Protocol.Debugger.enable(); 31 Protocol.Debugger.enable();
32 var tests = [ 32 var tests = [
33 function testWholeFunction(next) { 33 function testWholeFunction(next) {
34 Protocol.Debugger.getPossibleBreakpoints({ start: location(1, 18), ignoreNes tedFunctions: false }) 34 Protocol.Debugger.getPossibleBreakpoints({ start: location(1, 18), ignoreNes tedFunctions: false })
35 .then(dumpAllLocations) 35 .then(dumpAllLocations)
36 .then(next); 36 .then(next);
37 }, 37 },
38 38
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 var offset = lineOffsets[lineNumber]; 96 var offset = lineOffsets[lineNumber];
97 line = line.slice(0, columnNumber + offset) + '#' + line.slice(columnNumber + offset); 97 line = line.slice(0, columnNumber + offset) + '#' + line.slice(columnNumber + offset);
98 ++lineOffsets[lineNumber]; 98 ++lineOffsets[lineNumber];
99 sourceLines[lineNumber] = line; 99 sourceLines[lineNumber] = line;
100 } 100 }
101 InspectorTest.log(sourceLines.join('\n')); 101 InspectorTest.log(sourceLines.join('\n'));
102 return message; 102 return message;
103 } 103 }
104 104
105 function dumpBreakLocationInSourceAndResume(message) { 105 function dumpBreakLocationInSourceAndResume(message) {
106 InspectorTest.logCallFrames([ message.params.callFrames[0] ]); 106 session.logCallFrames([ message.params.callFrames[0] ]);
107 107
108 var location = message.params.callFrames[0].location; 108 var location = message.params.callFrames[0].location;
109 var sourceLines = source.split('\n') 109 var sourceLines = source.split('\n')
110 110
111 var lineNumber = location.lineNumber 111 var lineNumber = location.lineNumber
112 var columnNumber = location.columnNumber; 112 var columnNumber = location.columnNumber;
113 113
114 var line = sourceLines[lineNumber]; 114 var line = sourceLines[lineNumber];
115 line = line.slice(0, columnNumber) + '^' + line.slice(columnNumber); 115 line = line.slice(0, columnNumber) + '^' + line.slice(columnNumber);
116 sourceLines[lineNumber] = line; 116 sourceLines[lineNumber] = line;
117 InspectorTest.log(sourceLines.join('\n')); 117 InspectorTest.log(sourceLines.join('\n'));
118 InspectorTest.log(''); 118 InspectorTest.log('');
119 Protocol.Debugger.resume(); 119 Protocol.Debugger.resume();
120 } 120 }
OLDNEW
« no previous file with comments | « test/inspector/debugger/get-possible-breakpoints-master.js ('k') | test/inspector/debugger/inspector-break-api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698