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

Unified Diff: third_party/WebKit/LayoutTests/inspector/sources/source-code-diff.html

Issue 2381953004: DevTools: Add test for SourceCodeDiff (Closed)
Patch Set: Created 4 years, 3 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/sources/source-code-diff.html
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/source-code-diff.html b/third_party/WebKit/LayoutTests/inspector/sources/source-code-diff.html
new file mode 100644
index 0000000000000000000000000000000000000000..bcdfbbec110b48d7e45e8c07e155bbc4e9787b0a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/sources/source-code-diff.html
@@ -0,0 +1,55 @@
+<html>
+<head>
+
+<link rel="stylesheet" href="resources/diff-before.css">
+<link rel="stylesheet" href="resources/diff-after.css">
+
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/debugger-test.js"></script>
+<script src="../../http/tests/inspector/sources-test.js"></script>
+<script>
+function test()
+{
+ Runtime.experiments.enableForTest("sourceDiff");
+ var textAfter;
+ InspectorTest.showScriptSource("diff-after.css", onAfter);
+
+ function onAfter(afterFrame)
+ {
+ textAfter = afterFrame.textEditor.text();
+ InspectorTest.showScriptSource("diff-before.css", onBefore);
+ }
+
+ function onBefore(beforeFrame)
+ {
+ InspectorTest.addSniffer(WebInspector.SourceCodeDiff.prototype, "_decorationsSetForTest", decorationsSet);
+ beforeFrame.setContent(textAfter);
+ }
+
+ function decorationsSet(decorations)
+ {
+ Array.from(decorations).sort((a, b) => a[0] - b[0]).forEach(print);
+ InspectorTest.completeTest();
+
+ function print(decoration)
+ {
+ var type = decoration[1].type;
+ var name = "?";
+ if (type === WebInspector.SourceCodeDiff.GutterDecorationType.Insert)
+ name = "+";
+ else if (type === WebInspector.SourceCodeDiff.GutterDecorationType.Delete)
+ name = "-";
+ else if (type === WebInspector.SourceCodeDiff.GutterDecorationType.Modify)
+ name = "@";
+
+ InspectorTest.addResult(decoration[0] + ":" + name)
+ }
+ }
+}
+</script>
+</head>
+
+<body onload="runTest()">
+<p>Tests that diff markers correctly appear in the gutter.</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698