Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector/changes/changes-uisourcecode-list.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector/changes/changes-uisourcecode-list.html b/third_party/WebKit/LayoutTests/inspector/changes/changes-uisourcecode-list.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..921aa659d40924b00dbb267858c5b5d0df7db555 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector/changes/changes-uisourcecode-list.html |
| @@ -0,0 +1,70 @@ |
| +<html> |
| +<head> |
| +<script src="../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="changes-test.js"></script> |
| +<script> |
| + |
| +function test() { |
| + var fulfill = function(){}; |
| + var workspace = new Workspace.Workspace(); |
| + var project = new Bindings.ContentProviderBasedProject(workspace, "mockProject", Workspace.projectTypes.Network, "", false); |
| + var workspaceDiff = new WorkspaceDiff.WorkspaceDiff(workspace); |
| + InspectorTest.addSniffer(WorkspaceDiff.WorkspaceDiff.prototype, "_markAsUnmodified", modifiedStatusChanged, true); |
| + InspectorTest.addSniffer(WorkspaceDiff.WorkspaceDiff.prototype, "_markAsModified", modifiedStatusChanged, true); |
|
lushnikov
2017/03/28 03:32:10
why don't you sub for event?
let's rather sniff f
einbinder
2017/03/28 23:51:04
Added forTest method.
|
| + |
| + var uiSourceCodeList = new Changes.UISourceCodeList(workspaceDiff); |
| + |
| + var firstUISC = addUISourceCode("first.css", ".first {color: red}"); |
| + var secondUISC = addUISourceCode("second.css", ".second {color: red}"); |
| + var thirdUISC = addUISourceCode("third.css", ".third {color: red}"); |
| + uiSourceCodeList.show(UI.inspectorView.element); |
| + |
| + InspectorTest.runTestSuite([ |
| + function initialState(next) { |
| + dumpAfterLoadingFinished().then(next); |
| + }, |
| + function workingCopyChanged(next) { |
| + firstUISC.setWorkingCopy(".first {color: blue}"); |
| + dumpAfterLoadingFinished().then(next); |
| + }, |
| + function workingCopyComitted(next) { |
| + firstUISC.commitWorkingCopy(); |
| + secondUISC.addRevision(".second {color: blue}"); |
| + dumpAfterLoadingFinished().then(next); |
| + }, |
| + function resetAll(next) { |
| + firstUISC.addRevision(".first {color: red}"); |
| + secondUISC.addRevision(".second {color: red}"); |
| + thirdUISC.addRevision(".third {color: red}"); |
| + dumpAfterLoadingFinished().then(next); |
| + } |
| + |
| + ]); |
| + |
| + function modifiedStatusChanged() { |
| + if (!workspaceDiff._loadingUISourceCodes.size) |
| + fulfill(); |
| + } |
| + |
| + function dumpUISourceCodeList() { |
| + uiSourceCodeList._treeoutline.rootElement().children().forEach(treeElement => { |
| + InspectorTest.addResult(treeElement.title); |
| + }); |
| + } |
| + |
| + function dumpAfterLoadingFinished() { |
| + var promise = new Promise(x => fulfill = x); |
| + modifiedStatusChanged(); |
| + return promise.then(dumpUISourceCodeList); |
| + } |
| + |
| + function addUISourceCode(url, content) { |
| + return project.addContentProvider(url, Common.StaticContentProvider.fromString(url, Common.resourceTypes.Stylesheet, content)); |
| + } |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>Tests that the changes uisourcecode list contains the changed uisourcecodes.</p> |
| +</body> |
| +</html> |