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

Unified Diff: third_party/WebKit/LayoutTests/inspector/diff-module.html

Issue 2349823002: DevTools: Preserve the text when doing a line-by-line diff (Closed)
Patch Set: Docs 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/diff-module-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/inspector/diff-module.html
diff --git a/third_party/WebKit/LayoutTests/inspector/diff-module.html b/third_party/WebKit/LayoutTests/inspector/diff-module.html
new file mode 100644
index 0000000000000000000000000000000000000000..72d8beef69480b450cfc8f12c02229b49210c351
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/diff-module.html
@@ -0,0 +1,62 @@
+<html>
+<head>
+<script src="../http/tests/inspector/inspector-test.js"></script>
+<script>
+
+function initialize_DiffTest()
+{
+ InspectorTest.preloadModule("diff");
+}
+
+function test()
+{
+ print(WebInspector.Diff.charDiff("test this sentence.", "test that sentence"));
+ print(WebInspector.Diff.lineDiff(["test this sentence."], ["test that sentence"]));
+ print(WebInspector.Diff.lineDiff(["a", "b", "c"], ["a", "c"]));
+ print(WebInspector.Diff.lineDiff(["a", "b", "c"], ["b", "a", "c"]));
+ print(WebInspector.Diff.lineDiff(["a", "c"], ["a", "b", "c"]));
+ print(WebInspector.Diff.lineDiff(
+ [
+ "for (var i = 0; i < 100; i++) {",
+ " willBeLeftAlone()",
+ " willBeDeleted();",
+ "}",
+ "for (var j = 0; j < 100; j++) {",
+ " console.log('something changed');",
+ " willBeDeletedAgain();",
+ "}"
+ ],
+ [
+ "for (var i = 0; i < 100; i++) {",
+ " willBeLeftAlone();",
+ "}",
+ "insertThisLine();",
+ "for (var j = 0; j < 100; j++) {",
+ " console.log('changed');",
+ "}"
+ ]));
+ InspectorTest.completeTest();
+ function print(results)
+ {
+ InspectorTest.addResult("");
+ for (var i = 0; i < results.length; i++) {
+ var result = results[i];
+ var type = "Unknown";
+ if (result[0] === WebInspector.Diff.Operation.Equal)
+ type = "=";
+ else if (result[0] === WebInspector.Diff.Operation.Insert)
+ type = "+";
+ else if (result[0] === WebInspector.Diff.Operation.Delete)
+ type = "-";
+ else if (result[0] === WebInspector.Diff.Operation.Edit)
+ type = "E";
+ InspectorTest.addResult(type + ": " + JSON.stringify(result[1], null, 4));
+ }
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that the Diff module correctly diffs things.</p>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/diff-module-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698