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

Unified Diff: third_party/WebKit/LayoutTests/inspector/coverage/coverage-test.js

Issue 2763183002: DevTools: remove nesting depth tracking from coverage (Closed)
Patch Set: DevTools: remove nesting depth tracking from coverage 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
Index: third_party/WebKit/LayoutTests/inspector/coverage/coverage-test.js
diff --git a/third_party/WebKit/LayoutTests/inspector/coverage/coverage-test.js b/third_party/WebKit/LayoutTests/inspector/coverage/coverage-test.js
index 1f0b4947f9d1bd8f57c33e8f37a1022174d5bea5..73fa5bae16cd90408c8957b970d8b4a32fffcb5b 100644
--- a/third_party/WebKit/LayoutTests/inspector/coverage/coverage-test.js
+++ b/third_party/WebKit/LayoutTests/inspector/coverage/coverage-test.js
@@ -19,8 +19,36 @@ InspectorTest.sourceDecorated = async function(source)
{
await UI.inspectorView.showPanel("sources");
var decoratePromise = InspectorTest.addSnifferPromise(Coverage.CoverageView.LineDecorator.prototype, "decorate");
- await new Promise(fulfill => InspectorTest.showScriptSource(source, fulfill));
+ var sourceFrame = await new Promise(fulfill => InspectorTest.showScriptSource(source, fulfill));
await decoratePromise;
+ return sourceFrame;
}
+InspectorTest.dumpDecorations = async function(source)
+{
+ var sourceFrame = await InspectorTest.sourceDecorated(source);
+ InspectorTest.dumpDecorationsInSourceFrame(sourceFrame);
+}
+
+InspectorTest.dumpDecorationsInSourceFrame = function(sourceFrame)
+{
+ var markerMap = new Map([['used', '+'], ['unused', '-'], ['mixed', '*']]);
+
+ var codeMirror = sourceFrame.textEditor.codeMirror();
+ for (var line = 0; line < codeMirror.lineCount(); ++line) {
+ var text = codeMirror.getLine(line);
+ var markerType = ' ';
+ var lineInfo = codeMirror.lineInfo(line);
+ if (!lineInfo)
+ continue;
+ var gutterElement = lineInfo.gutterMarkers && lineInfo.gutterMarkers['CodeMirror-gutter-coverage'];
+ if (gutterElement) {
+ var markerClass = /^text-editor-coverage-(\w*)-marker$/.exec(gutterElement.classList)[1];
+ markerType = markerMap.get(markerClass) || gutterElement.classList;
+ }
+ InspectorTest.addResult(`${line}: ${markerType} ${text}`);
+ }
+}
+
+
}

Powered by Google App Engine
This is Rietveld 408576698