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

Side by Side Diff: test/inspector/debugger/script-end-location.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 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 that we report correct endLine, endColumn and source f or scripts.'); 5 let {session, contextGroup, Protocol} = InspectorTest.start('Checks that we repo rt correct endLine, endColumn and source for scripts.');
6 6
7 var sources = [ 7 var sources = [
8 '', 8 '',
9 ' ', 9 ' ',
10 ' ', 10 ' ',
11 ` 11 `
12 `, 12 `,
13 ` 13 `
14 `, 14 `,
15 ` 15 `
16 `, 16 `,
17 ` 17 `
18 18
19 `, 19 `,
20 ` 20 `
21 21
22 `, 22 `,
23 ` 23 `
24 24
25 `]; 25 `];
26 26
27 (async function test() { 27 (async function test() {
28 Protocol.Debugger.enable(); 28 Protocol.Debugger.enable();
29 for (let source of sources) { 29 for (let source of sources) {
30 InspectorTest.addScript(source); 30 contextGroup.addScript(source);
31 var message = await Protocol.Debugger.onceScriptParsed(); 31 var message = await Protocol.Debugger.onceScriptParsed();
32 var inspectorSource = (await Protocol.Debugger.getScriptSource({ scriptId: m essage.params.scriptId })).result.scriptSource; 32 var inspectorSource = (await Protocol.Debugger.getScriptSource({ scriptId: m essage.params.scriptId })).result.scriptSource;
33 var lines = source.split('\n'); 33 var lines = source.split('\n');
34 var returned = { endLine: message.params.endLine, endColumn: message.params. endColumn }; 34 var returned = { endLine: message.params.endLine, endColumn: message.params. endColumn };
35 var compiled = { endLine: lines.length - 1, endColumn: lines[lines.length - 1].length }; 35 var compiled = { endLine: lines.length - 1, endColumn: lines[lines.length - 1].length };
36 InspectorTest.logObject({ returned, compiled }); 36 InspectorTest.logObject({ returned, compiled });
37 if (returned.endLine != compiled.endLine) { 37 if (returned.endLine != compiled.endLine) {
38 InspectorTest.log('error: incorrect endLine'); 38 InspectorTest.log('error: incorrect endLine');
39 } 39 }
40 if (returned.endColumn != compiled.endColumn) { 40 if (returned.endColumn != compiled.endColumn) {
41 InspectorTest.log('error: incorrect endColumn'); 41 InspectorTest.log('error: incorrect endColumn');
42 } 42 }
43 if (source !== inspectorSource) { 43 if (source !== inspectorSource) {
44 InspectorTest.log('error: incorrect source'); 44 InspectorTest.log('error: incorrect source');
45 } 45 }
46 } 46 }
47 InspectorTest.completeTest(); 47 InspectorTest.completeTest();
48 })(); 48 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698