Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector/changes/changes-highlighter.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector/changes/changes-highlighter.html b/third_party/WebKit/LayoutTests/inspector/changes/changes-highlighter.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e2888e28bf6c9e681a98bddf4eac820b8c8d6760 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector/changes/changes-highlighter.html |
| @@ -0,0 +1,41 @@ |
| +<html> |
| +<head> |
| + |
| +<link rel="stylesheet" href="resources/before.css"> |
| +<link rel="stylesheet" href="resources/after.css"> |
| +<script src="../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="../../http/tests/inspector/debugger-test.js"></script> |
| +<script src="changes-test.js"></script> |
| +<script> |
| + |
| +function test() { |
| + InspectorTest.waitForScriptSource("after.css", uiSourceCode => uiSourceCode.requestContent().then(onAfterContent)); |
|
lushnikov
2017/03/28 03:32:10
waitForUISourceCode(..
(cause i'm about to remove
einbinder
2017/03/28 23:51:04
Done.
|
| + function onAfterContent(content) { |
|
lushnikov
2017/03/28 03:32:10
nit: newline before function
einbinder
2017/03/28 23:51:04
Done.
|
| + InspectorTest.waitForScriptSource("before.css", uiSourceCode => uiSourceCode.setWorkingCopy(content)); |
| + InspectorTest.addSniffer(Changes.ChangesView.prototype, "_renderRows", rowsRendered, true); |
| + UI.viewManager.showView("changes.changes"); |
| + } |
| + function rowsRendered() { |
|
lushnikov
2017/03/28 03:32:10
nit: newline
einbinder
2017/03/28 23:51:04
Done.
|
| + var codeMirror = this._editor._codeMirror; |
| + for (var i = 0; i < codeMirror.lineCount(); i++) { |
| + codeMirror.scrollIntoView(i); // Ensure highlighting |
| + var lineInfo = codeMirror.lineInfo(i); |
| + var prefix = ""; |
| + if (lineInfo.handle.styleClasses.bgClass === "deletion") |
| + prefix = "-"; |
| + else if (lineInfo.handle.styleClasses.bgClass === "addition") |
| + prefix = "+"; |
| + else if (lineInfo.handle.styleClasses.bgClass === "equal") |
| + prefix = " "; |
| + InspectorTest.addResult(prefix + " " + lineInfo.text); |
| + |
| + } |
| + InspectorTest.completeTest(); |
| + } |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>Tests that the changes view highlights diffs correctly.</p> |
| +</body> |
| +</html> |