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