| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 | 3 |
| 4 <link rel="stylesheet" href="resources/diff-before.css"> | 4 <link rel="stylesheet" href="resources/diff-before.css"> |
| 5 <link rel="stylesheet" href="resources/diff-after.css"> | 5 <link rel="stylesheet" href="resources/diff-after.css"> |
| 6 | 6 |
| 7 <script src="../../http/tests/inspector/inspector-test.js"></script> | 7 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 8 <script src="../../http/tests/inspector/debugger-test.js"></script> | 8 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 9 <script src="../../http/tests/inspector/sources-test.js"></script> | 9 <script src="../../http/tests/inspector/sources-test.js"></script> |
| 10 <script> | 10 <script> |
| 11 function test() | 11 function test() |
| 12 { | 12 { |
| 13 Runtime.experiments.enableForTest("sourceDiff"); | 13 Runtime.experiments.enableForTest("sourceDiff"); |
| 14 var textAfter; | 14 var textAfter; |
| 15 InspectorTest.showScriptSource("diff-after.css", onAfter); | 15 InspectorTest.showScriptSource("diff-after.css", onAfter); |
| 16 | 16 |
| 17 function onAfter(afterFrame) | 17 function onAfter(afterFrame) |
| 18 { | 18 { |
| 19 textAfter = afterFrame.textEditor.text(); | 19 textAfter = afterFrame.textEditor.text(); |
| 20 InspectorTest.showScriptSource("diff-before.css", onBefore); | 20 InspectorTest.showScriptSource("diff-before.css", onBefore); |
| 21 } | 21 } |
| 22 | 22 |
| 23 function onBefore(beforeFrame) | 23 function onBefore(beforeFrame) |
| 24 { | 24 { |
| 25 InspectorTest.addSniffer(Sources.SourceCodeDiff.prototype, "_decorations
SetForTest", decorationsSet); | 25 InspectorTest.addSniffer(SourceFrame.SourceCodeDiff.prototype, "_decorat
ionsSetForTest", decorationsSet); |
| 26 beforeFrame.setContent(textAfter); | 26 beforeFrame.setContent(textAfter); |
| 27 } | 27 } |
| 28 | 28 |
| 29 function decorationsSet(decorations) | 29 function decorationsSet(decorations) |
| 30 { | 30 { |
| 31 Array.from(decorations).sort((a, b) => a[0] - b[0]).forEach(print); | 31 Array.from(decorations).sort((a, b) => a[0] - b[0]).forEach(print); |
| 32 InspectorTest.completeTest(); | 32 InspectorTest.completeTest(); |
| 33 | 33 |
| 34 function print(decoration) | 34 function print(decoration) |
| 35 { | 35 { |
| 36 var type = decoration[1].type; | 36 var type = decoration[1].type; |
| 37 var name = "Unknown"; | 37 var name = "Unknown"; |
| 38 if (type === Sources.SourceCodeDiff.GutterDecorationType.Insert) | 38 if (type === SourceFrame.SourceCodeDiff.GutterDecorationType.Insert) |
| 39 name = "Insert"; | 39 name = "Insert"; |
| 40 else if (type === Sources.SourceCodeDiff.GutterDecorationType.Delete
) | 40 else if (type === SourceFrame.SourceCodeDiff.GutterDecorationType.De
lete) |
| 41 name = "Delete"; | 41 name = "Delete"; |
| 42 else if (type === Sources.SourceCodeDiff.GutterDecorationType.Modify
) | 42 else if (type === SourceFrame.SourceCodeDiff.GutterDecorationType.Mo
dify) |
| 43 name = "Modify"; | 43 name = "Modify"; |
| 44 | 44 |
| 45 InspectorTest.addResult(decoration[0] + ":" + name) | 45 InspectorTest.addResult(decoration[0] + ":" + name) |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 </script> | 49 </script> |
| 50 </head> | 50 </head> |
| 51 | 51 |
| 52 <body onload="runTest()"> | 52 <body onload="runTest()"> |
| 53 <p>Tests that diff markers correctly appear in the gutter.</p> | 53 <p>Tests that diff markers correctly appear in the gutter.</p> |
| 54 </body> | 54 </body> |
| 55 </html> | 55 </html> |
| OLD | NEW |