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

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

Issue 2381953004: DevTools: Add test for SourceCodeDiff (Closed)
Patch Set: Created 4 years, 2 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 <html>
2 <head>
3
4 <link rel="stylesheet" href="resources/diff-before.css">
5 <link rel="stylesheet" href="resources/diff-after.css">
6
7 <script src="../../http/tests/inspector/inspector-test.js"></script>
8 <script src="../../http/tests/inspector/debugger-test.js"></script>
9 <script src="../../http/tests/inspector/sources-test.js"></script>
10 <script>
11 function test()
12 {
13 Runtime.experiments.enableForTest("sourceDiff");
14 var textAfter;
15 InspectorTest.showScriptSource("diff-after.css", onAfter);
16
17 function onAfter(afterFrame)
18 {
19 textAfter = afterFrame.textEditor.text();
20 InspectorTest.showScriptSource("diff-before.css", onBefore);
21 }
22
23 function onBefore(beforeFrame)
24 {
25 InspectorTest.addSniffer(WebInspector.SourceCodeDiff.prototype, "_decora tionsSetForTest", decorationsSet);
26 beforeFrame.setContent(textAfter);
27 }
28
29 function decorationsSet(decorations)
30 {
31 Array.from(decorations).sort((a, b) => a[0] - b[0]).forEach(print);
32 InspectorTest.completeTest();
33
34 function print(decoration)
35 {
36 var type = decoration[1].type;
37 var name = "?";
38 if (type === WebInspector.SourceCodeDiff.GutterDecorationType.Insert )
39 name = "+";
40 else if (type === WebInspector.SourceCodeDiff.GutterDecorationType.D elete)
41 name = "-";
42 else if (type === WebInspector.SourceCodeDiff.GutterDecorationType.M odify)
43 name = "@";
44
45 InspectorTest.addResult(decoration[0] + ":" + name)
46 }
47 }
48 }
49 </script>
50 </head>
51
52 <body onload="runTest()">
53 <p>Tests that diff markers correctly appear in the gutter.</p>
54 </body>
55 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698