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

Unified Diff: test/inspector/cpu-profiler/coverage.js

Issue 2764073004: [debug] do not report unnecessary coverage data. (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug/debug-coverage.cc ('k') | test/inspector/cpu-profiler/coverage-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/cpu-profiler/coverage.js
diff --git a/test/inspector/cpu-profiler/coverage.js b/test/inspector/cpu-profiler/coverage.js
index 00d9b3b09f3c0a7d6bd16b3d09ea6c2eaf9121ab..0d38087d239e61396248fbfaeef98da52173aa03 100644
--- a/test/inspector/cpu-profiler/coverage.js
+++ b/test/inspector/cpu-profiler/coverage.js
@@ -34,6 +34,22 @@ function h() {
f(3);
`;
+var nested =
+`
+var f = (function outer() {
+ function nested_0() {
+ return function nested_1() {
+ return function nested_2() {
+ return function nested_3() {}
+ }
+ }
+ }
+ function nested_4() {}
+ return nested_0();
+})();
+f()()();
+`;
+
InspectorTest.log("Test collecting code coverage data with Profiler.collectCoverage.");
function ClearAndGC() {
@@ -78,8 +94,8 @@ InspectorTest.runTestSuite([
.then(() => Protocol.Profiler.startPreciseCoverage({callCount: true}))
.then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
.then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
- .then(ClearAndGC)
.then(InspectorTest.logMessage)
+ .then(ClearAndGC)
.then(Protocol.Profiler.takePreciseCoverage)
.then(LogSorted)
.then(Protocol.Profiler.takePreciseCoverage)
@@ -208,4 +224,44 @@ InspectorTest.runTestSuite([
.then(ClearAndGC)
.then(next);
},
+ function testPreciseEmptyScriptCoverageEntries(next)
+ {
+ // Enabling the debugger holds onto script objects even though its
+ // functions can be garbage collected. We would get empty ScriptCoverage
+ // entires unless we remove them.
+ Protocol.Debugger.enable()
+ .then(Protocol.Runtime.enable)
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.enable)
+ .then(Protocol.Profiler.startPreciseCoverage)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(Protocol.Debugger.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testPreciseCountCoveragePartial(next)
+ {
+ Protocol.Runtime.enable()
+ .then(Protocol.Profiler.enable)
+ .then(() => Protocol.Profiler.startPreciseCoverage({callCount: true}))
+ .then(() => Protocol.Runtime.compileScript({ expression: nested, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(() => Protocol.Runtime.evaluate({ expression: "f()" }))
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
]);
« no previous file with comments | « src/debug/debug-coverage.cc ('k') | test/inspector/cpu-profiler/coverage-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698