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

Side by Side Diff: test/inspector/runtime/coverage.js

Issue 2700743002: [inspector] extend protocol for code coverage. (Closed)
Patch Set: comments Created 3 years, 10 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 // 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
3 // found in the LICENSE file.
4
5 var source =
6 `
7 function fib(x) {
8 if (x < 2) return 1;
9 return fib(x-1) + fib(x-2);
10 }
11 fib(5);
12 `;
13
14 var url = "fib.js"
15
16 print("Test collecting code coverage data with Runtime.collectCoverage.");
17
18 InspectorTest.runTestSuite([
19 function testCoverage(next)
20 {
21 Protocol.Runtime.enable()
22 .then(() => Protocol.Runtime.startPreciseCoverage())
23 .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL : url, persistScript: true }))
kozy 2017/02/16 16:47:19 You can just add //# sourceURL=fib.js to your sour
Yang 2017/02/20 11:24:42 I also like to pass the URL though.
24 .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scr iptId }))
25 .then((result) => InspectorTest.logMessage(result))
26 .then(() => Protocol.Runtime.collectCoverage())
27 .then((result) => InspectorTest.logMessage(result))
28 .then(() => Protocol.Runtime.stopPreciseCoverage())
29 .then(() => Protocol.Runtime.disable())
30 .then(() => next());
31 }
32 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698