| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="changes-test.js"></script> |
| 5 <script> |
| 6 |
| 7 function test() { |
| 8 var fulfill = function(){}; |
| 9 var workspace = new Workspace.Workspace(); |
| 10 var project = new Bindings.ContentProviderBasedProject(workspace, "mockProject
", Workspace.projectTypes.Network, "", false); |
| 11 var workspaceDiff = new WorkspaceDiff.WorkspaceDiff(workspace); |
| 12 InspectorTest.addSniffer(WorkspaceDiff.WorkspaceDiff.prototype, "_uiSourceCode
ProcessedForTest", modifiedStatusChanged, true); |
| 13 |
| 14 var uiSourceCodeList = new Changes.ChangesSidebar(workspaceDiff); |
| 15 |
| 16 var firstUISC = addUISourceCode("first.css", ".first {color: red}"); |
| 17 var secondUISC = addUISourceCode("second.css", ".second {color: red}"); |
| 18 var thirdUISC = addUISourceCode("third.css", ".third {color: red}"); |
| 19 uiSourceCodeList.show(UI.inspectorView.element); |
| 20 |
| 21 InspectorTest.runTestSuite([ |
| 22 function initialState(next) { |
| 23 dumpAfterLoadingFinished().then(next); |
| 24 }, |
| 25 function workingCopyChanged(next) { |
| 26 firstUISC.setWorkingCopy(".first {color: blue}"); |
| 27 dumpAfterLoadingFinished().then(next); |
| 28 }, |
| 29 function workingCopyComitted(next) { |
| 30 firstUISC.commitWorkingCopy(); |
| 31 secondUISC.addRevision(".second {color: blue}"); |
| 32 dumpAfterLoadingFinished().then(next); |
| 33 }, |
| 34 function resetAll(next) { |
| 35 firstUISC.addRevision(".first {color: red}"); |
| 36 secondUISC.addRevision(".second {color: red}"); |
| 37 thirdUISC.addRevision(".third {color: red}"); |
| 38 dumpAfterLoadingFinished().then(next); |
| 39 } |
| 40 |
| 41 ]); |
| 42 |
| 43 function modifiedStatusChanged() { |
| 44 if (!workspaceDiff._loadingUISourceCodes.size) |
| 45 fulfill(); |
| 46 } |
| 47 |
| 48 function dumpUISourceCodeList() { |
| 49 uiSourceCodeList._treeoutline.rootElement().children().forEach(treeElement =
> { |
| 50 InspectorTest.addResult(treeElement.title); |
| 51 }); |
| 52 } |
| 53 |
| 54 function dumpAfterLoadingFinished() { |
| 55 var promise = new Promise(x => fulfill = x); |
| 56 modifiedStatusChanged(); |
| 57 return promise.then(dumpUISourceCodeList); |
| 58 } |
| 59 |
| 60 function addUISourceCode(url, content) { |
| 61 return project.addContentProvider(url, Common.StaticContentProvider.fromStri
ng(url, Common.resourceTypes.Stylesheet, content)); |
| 62 } |
| 63 } |
| 64 </script> |
| 65 </head> |
| 66 <body onload="runTest()"> |
| 67 <p>Tests that the changes sidebar contains the changed uisourcecodes.</p> |
| 68 </body> |
| 69 </html> |
| OLD | NEW |