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

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

Issue 2715833003: [inspector] move coverage related methods to profiler (Closed)
Patch Set: rebased 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 (function iife() {
12 return 1;
13 })();
14 fib(5);
15 `;
16
17 print("Test collecting code coverage data with Runtime.collectCoverage.");
18
19 function ClearAndGC() {
20 return Protocol.Runtime.evaluate({ expression: "fib = null;" })
21 .then(() => Protocol.HeapProfiler.enable())
22 .then(() => Protocol.HeapProfiler.collectGarbage())
23 .then(() => Protocol.HeapProfiler.disable());
24 }
25
26 function LogSorted(message) {
27 message.result.result.sort((a, b) => parseInt(a.scriptId) - parseInt(b.scriptI d));
28 return InspectorTest.logMessage(message);
29 }
30
31 InspectorTest.runTestSuite([
32 function testPreciseCoverage(next)
33 {
34 Protocol.Runtime.enable()
35 .then(Protocol.Runtime.startPreciseCoverage)
36 .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL : "1", persistScript: true }))
37 .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scr iptId }))
38 .then(ClearAndGC)
39 .then(InspectorTest.logMessage)
40 .then(Protocol.Runtime.takePreciseCoverage)
41 .then(LogSorted)
42 .then(Protocol.Runtime.takePreciseCoverage)
43 .then(LogSorted)
44 .then(ClearAndGC)
45 .then(Protocol.Runtime.stopPreciseCoverage)
46 .then(Protocol.Runtime.disable)
47 .then(next);
48 },
49 function testPreciseCoverageFail(next)
50 {
51 Protocol.Runtime.enable()
52 .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL : "2", persistScript: true }))
53 .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scr iptId }))
54 .then(InspectorTest.logMessage)
55 .then(ClearAndGC)
56 .then(Protocol.Runtime.takePreciseCoverage)
57 .then(InspectorTest.logMessage)
58 .then(ClearAndGC)
59 .then(Protocol.Runtime.disable)
60 .then(next);
61 },
62 function testBestEffortCoverage(next)
63 {
64 Protocol.Runtime.enable()
65 .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL : "3", persistScript: true }))
66 .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scr iptId }))
67 .then(InspectorTest.logMessage)
68 .then(ClearAndGC)
69 .then(Protocol.Runtime.getBestEffortCoverage)
70 .then(LogSorted)
71 .then(Protocol.Runtime.getBestEffortCoverage)
72 .then(LogSorted)
73 .then(ClearAndGC)
74 .then(Protocol.Runtime.disable)
75 .then(next);
76 },
77 function testBestEffortCoveragePrecise(next)
78 {
79 Protocol.Runtime.enable()
80 .then(Protocol.Runtime.startPreciseCoverage)
81 .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL : "4", persistScript: true }))
82 .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scr iptId }))
83 .then(InspectorTest.logMessage)
84 .then(ClearAndGC)
85 .then(Protocol.Runtime.getBestEffortCoverage)
86 .then(LogSorted)
87 .then(Protocol.Runtime.getBestEffortCoverage)
88 .then(LogSorted)
89 .then(ClearAndGC)
90 .then(Protocol.Runtime.stopPreciseCoverage)
91 .then(Protocol.Runtime.disable)
92 .then(next);
93 },
94 ]);
OLDNEW
« no previous file with comments | « test/inspector/cpu-profiler/coverage-expected.txt ('k') | test/inspector/runtime/coverage-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698