Chromium Code Reviews| 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, "_markAsUnmodi fied", modifiedStatusChanged, true); | |
| 13 InspectorTest.addSniffer(WorkspaceDiff.WorkspaceDiff.prototype, "_markAsModifi ed", 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.
| |
| 14 | |
| 15 var uiSourceCodeList = new Changes.UISourceCodeList(workspaceDiff); | |
| 16 | |
| 17 var firstUISC = addUISourceCode("first.css", ".first {color: red}"); | |
| 18 var secondUISC = addUISourceCode("second.css", ".second {color: red}"); | |
| 19 var thirdUISC = addUISourceCode("third.css", ".third {color: red}"); | |
| 20 uiSourceCodeList.show(UI.inspectorView.element); | |
| 21 | |
| 22 InspectorTest.runTestSuite([ | |
| 23 function initialState(next) { | |
| 24 dumpAfterLoadingFinished().then(next); | |
| 25 }, | |
| 26 function workingCopyChanged(next) { | |
| 27 firstUISC.setWorkingCopy(".first {color: blue}"); | |
| 28 dumpAfterLoadingFinished().then(next); | |
| 29 }, | |
| 30 function workingCopyComitted(next) { | |
| 31 firstUISC.commitWorkingCopy(); | |
| 32 secondUISC.addRevision(".second {color: blue}"); | |
| 33 dumpAfterLoadingFinished().then(next); | |
| 34 }, | |
| 35 function resetAll(next) { | |
| 36 firstUISC.addRevision(".first {color: red}"); | |
| 37 secondUISC.addRevision(".second {color: red}"); | |
| 38 thirdUISC.addRevision(".third {color: red}"); | |
| 39 dumpAfterLoadingFinished().then(next); | |
| 40 } | |
| 41 | |
| 42 ]); | |
| 43 | |
| 44 function modifiedStatusChanged() { | |
| 45 if (!workspaceDiff._loadingUISourceCodes.size) | |
| 46 fulfill(); | |
| 47 } | |
| 48 | |
| 49 function dumpUISourceCodeList() { | |
| 50 uiSourceCodeList._treeoutline.rootElement().children().forEach(treeElement = > { | |
| 51 InspectorTest.addResult(treeElement.title); | |
| 52 }); | |
| 53 } | |
| 54 | |
| 55 function dumpAfterLoadingFinished() { | |
| 56 var promise = new Promise(x => fulfill = x); | |
| 57 modifiedStatusChanged(); | |
| 58 return promise.then(dumpUISourceCodeList); | |
| 59 } | |
| 60 | |
| 61 function addUISourceCode(url, content) { | |
| 62 return project.addContentProvider(url, Common.StaticContentProvider.fromStri ng(url, Common.resourceTypes.Stylesheet, content)); | |
| 63 } | |
| 64 } | |
| 65 </script> | |
| 66 </head> | |
| 67 <body onload="runTest()"> | |
| 68 <p>Tests that the changes uisourcecode list contains the changed uisourcecodes.< /p> | |
| 69 </body> | |
| 70 </html> | |
| OLD | NEW |