| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../http/tests/inspector/sources-test.js"></script> | 4 <script src="../http/tests/inspector/sources-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 function createMockProject() | 8 function createMockProject() |
| 9 { | 9 { |
| 10 var workspace = new WebInspector.Workspace(); | 10 var workspace = new WebInspector.Workspace(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 uiSourceCode.commitWorkingCopy(function() { }); | 43 uiSourceCode.commitWorkingCopy(function() { }); |
| 44 | 44 |
| 45 InspectorTest.addResult("First revision added."); | 45 InspectorTest.addResult("First revision added."); |
| 46 dumpUISourceCodeWithRevisions(uiSourceCode); | 46 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 47 uiSourceCode.setWorkingCopy("content3"); | 47 uiSourceCode.setWorkingCopy("content3"); |
| 48 uiSourceCode.setWorkingCopy("content4"); | 48 uiSourceCode.setWorkingCopy("content4"); |
| 49 uiSourceCode.commitWorkingCopy(function() { }); | 49 uiSourceCode.commitWorkingCopy(function() { }); |
| 50 | 50 |
| 51 InspectorTest.addResult("Second revision added."); | 51 InspectorTest.addResult("Second revision added."); |
| 52 dumpUISourceCodeWithRevisions(uiSourceCode); | 52 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 53 uiSourceCode.revertToOriginal(); | 53 uiSourceCode.revertToOriginal().then(onReverted); |
| 54 InspectorTest.addResult("Reverted to original."); | 54 |
| 55 dumpUISourceCodeWithRevisions(uiSourceCode); | 55 function onReverted() |
| 56 next(); | 56 { |
| 57 InspectorTest.addResult("Reverted to original."); |
| 58 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 59 next(); |
| 60 } |
| 57 }, | 61 }, |
| 58 | 62 |
| 59 function testAddRevisionsRevertAndClearHistory(next) | 63 function testAddRevisionsRevertAndClearHistory(next) |
| 60 { | 64 { |
| 61 var uiSourceCode = new WebInspector.UISourceCode(createMockProject()
, "url2", WebInspector.resourceTypes.Script); | 65 var uiSourceCode = new WebInspector.UISourceCode(createMockProject()
, "url2", WebInspector.resourceTypes.Script); |
| 62 | 66 |
| 63 uiSourceCode.setWorkingCopy("content1"); | 67 uiSourceCode.setWorkingCopy("content1"); |
| 64 uiSourceCode.setWorkingCopy("content2"); | 68 uiSourceCode.setWorkingCopy("content2"); |
| 65 uiSourceCode.commitWorkingCopy(function() { }); | 69 uiSourceCode.commitWorkingCopy(function() { }); |
| 66 | 70 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 91 uiSourceCode.commitWorkingCopy(function() { }); | 95 uiSourceCode.commitWorkingCopy(function() { }); |
| 92 | 96 |
| 93 InspectorTest.addResult("First revision added."); | 97 InspectorTest.addResult("First revision added."); |
| 94 dumpUISourceCodeWithRevisions(uiSourceCode); | 98 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 95 uiSourceCode.setWorkingCopy("content3"); | 99 uiSourceCode.setWorkingCopy("content3"); |
| 96 uiSourceCode.setWorkingCopy("content4"); | 100 uiSourceCode.setWorkingCopy("content4"); |
| 97 uiSourceCode.commitWorkingCopy(function() { }); | 101 uiSourceCode.commitWorkingCopy(function() { }); |
| 98 | 102 |
| 99 InspectorTest.addResult("Second revision added."); | 103 InspectorTest.addResult("Second revision added."); |
| 100 dumpUISourceCodeWithRevisions(uiSourceCode); | 104 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 101 uiSourceCode.history[0].revertToThis(); | 105 uiSourceCode.history[0].revertToThis().then(onReverted); |
| 102 InspectorTest.addResult("Reverted to previous revision."); | 106 |
| 103 dumpUISourceCodeWithRevisions(uiSourceCode); | 107 function onReverted() |
| 104 next(); | 108 { |
| 109 InspectorTest.addResult("Reverted to previous revision."); |
| 110 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 111 next(); |
| 112 } |
| 105 }, | 113 }, |
| 106 | 114 |
| 107 function testRequestContentAddRevisionsRevertToOriginal(next) | 115 function testRequestContentAddRevisionsRevertToOriginal(next) |
| 108 { | 116 { |
| 109 var uiSourceCode = new WebInspector.UISourceCode(createMockProject()
, "url4", WebInspector.resourceTypes.Script); | 117 var uiSourceCode = new WebInspector.UISourceCode(createMockProject()
, "url4", WebInspector.resourceTypes.Script); |
| 110 uiSourceCode.requestContent(contentReceived); | 118 uiSourceCode.requestContent().then(contentReceived); |
| 111 | 119 |
| 112 function contentReceived() | 120 function contentReceived() |
| 113 { | 121 { |
| 114 InspectorTest.addResult("Content requested."); | 122 InspectorTest.addResult("Content requested."); |
| 115 dumpUISourceCodeWithRevisions(uiSourceCode); | 123 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 116 uiSourceCode.setWorkingCopy("content1"); | 124 uiSourceCode.setWorkingCopy("content1"); |
| 117 uiSourceCode.setWorkingCopy("content2"); | 125 uiSourceCode.setWorkingCopy("content2"); |
| 118 uiSourceCode.commitWorkingCopy(function() { }); | 126 uiSourceCode.commitWorkingCopy(function() { }); |
| 119 | 127 |
| 120 InspectorTest.addResult("First revision added."); | 128 InspectorTest.addResult("First revision added."); |
| 121 dumpUISourceCodeWithRevisions(uiSourceCode); | 129 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 122 uiSourceCode.setWorkingCopy("content3"); | 130 uiSourceCode.setWorkingCopy("content3"); |
| 123 uiSourceCode.setWorkingCopy("content4"); | 131 uiSourceCode.setWorkingCopy("content4"); |
| 124 uiSourceCode.commitWorkingCopy(function() { }); | 132 uiSourceCode.commitWorkingCopy(function() { }); |
| 125 | 133 |
| 126 InspectorTest.addResult("Second revision added."); | 134 InspectorTest.addResult("Second revision added."); |
| 127 dumpUISourceCodeWithRevisions(uiSourceCode); | 135 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 128 uiSourceCode.revertToOriginal(); | 136 uiSourceCode.revertToOriginal().then(onReverted); |
| 129 InspectorTest.addResult("Reverted to original."); | 137 |
| 130 dumpUISourceCodeWithRevisions(uiSourceCode); | 138 function onReverted() |
| 131 next(); | 139 { |
| 140 InspectorTest.addResult("Reverted to original."); |
| 141 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 142 next(); |
| 143 } |
| 132 } | 144 } |
| 133 }, | 145 }, |
| 134 | 146 |
| 135 function testRequestContentAddRevisionsRevertAndClearHistory(next) | 147 function testRequestContentAddRevisionsRevertAndClearHistory(next) |
| 136 { | 148 { |
| 137 var uiSourceCode = new WebInspector.UISourceCode(createMockProject()
, "url5", WebInspector.resourceTypes.Script); | 149 var uiSourceCode = new WebInspector.UISourceCode(createMockProject()
, "url5", WebInspector.resourceTypes.Script); |
| 138 uiSourceCode.requestContent(contentReceived); | 150 uiSourceCode.requestContent().then(contentReceived); |
| 139 | 151 |
| 140 function contentReceived() | 152 function contentReceived() |
| 141 { | 153 { |
| 142 InspectorTest.addResult("Content requested."); | 154 InspectorTest.addResult("Content requested."); |
| 143 dumpUISourceCodeWithRevisions(uiSourceCode); | 155 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 144 uiSourceCode.setWorkingCopy("content1"); | 156 uiSourceCode.setWorkingCopy("content1"); |
| 145 uiSourceCode.setWorkingCopy("content2"); | 157 uiSourceCode.setWorkingCopy("content2"); |
| 146 uiSourceCode.commitWorkingCopy(function() { }); | 158 uiSourceCode.commitWorkingCopy(function() { }); |
| 147 | 159 |
| 148 InspectorTest.addResult("First revision added."); | 160 InspectorTest.addResult("First revision added."); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 160 InspectorTest.addResult("Reverted and cleared history."); | 172 InspectorTest.addResult("Reverted and cleared history."); |
| 161 dumpUISourceCodeWithRevisions(uiSourceCode); | 173 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 162 next(); | 174 next(); |
| 163 } | 175 } |
| 164 } | 176 } |
| 165 }, | 177 }, |
| 166 | 178 |
| 167 function testRequestContentAddRevisionsRevertToPrevious(next) | 179 function testRequestContentAddRevisionsRevertToPrevious(next) |
| 168 { | 180 { |
| 169 var uiSourceCode = new WebInspector.UISourceCode(createMockProject()
, "url6", WebInspector.resourceTypes.Script); | 181 var uiSourceCode = new WebInspector.UISourceCode(createMockProject()
, "url6", WebInspector.resourceTypes.Script); |
| 170 uiSourceCode.requestContent(contentReceived); | 182 uiSourceCode.requestContent().then(contentReceived); |
| 171 | 183 |
| 172 function contentReceived() | 184 function contentReceived() |
| 173 { | 185 { |
| 174 InspectorTest.addResult("Content requested."); | 186 InspectorTest.addResult("Content requested."); |
| 175 dumpUISourceCodeWithRevisions(uiSourceCode); | 187 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 176 uiSourceCode.setWorkingCopy("content1"); | 188 uiSourceCode.setWorkingCopy("content1"); |
| 177 uiSourceCode.setWorkingCopy("content2"); | 189 uiSourceCode.setWorkingCopy("content2"); |
| 178 uiSourceCode.commitWorkingCopy(function() { }); | 190 uiSourceCode.commitWorkingCopy(function() { }); |
| 179 | 191 |
| 180 InspectorTest.addResult("First revision added."); | 192 InspectorTest.addResult("First revision added."); |
| 181 dumpUISourceCodeWithRevisions(uiSourceCode); | 193 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 182 uiSourceCode.setWorkingCopy("content3"); | 194 uiSourceCode.setWorkingCopy("content3"); |
| 183 uiSourceCode.setWorkingCopy("content4"); | 195 uiSourceCode.setWorkingCopy("content4"); |
| 184 uiSourceCode.commitWorkingCopy(function() { }); | 196 uiSourceCode.commitWorkingCopy(function() { }); |
| 185 | 197 |
| 186 InspectorTest.addResult("Second revision added."); | 198 InspectorTest.addResult("Second revision added."); |
| 187 dumpUISourceCodeWithRevisions(uiSourceCode); | 199 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 188 uiSourceCode.history[0].revertToThis(); | 200 uiSourceCode.history[0].revertToThis().then(onReverted); |
| 189 InspectorTest.addResult("Reverted to previous revision."); | 201 |
| 190 dumpUISourceCodeWithRevisions(uiSourceCode); | 202 function onReverted() |
| 191 next(); | 203 { |
| 204 InspectorTest.addResult("Reverted to previous revision."); |
| 205 dumpUISourceCodeWithRevisions(uiSourceCode); |
| 206 next(); |
| 207 } |
| 192 } | 208 } |
| 193 }, | 209 }, |
| 194 ]); | 210 ]); |
| 195 } | 211 } |
| 196 </script> | 212 </script> |
| 197 </head> | 213 </head> |
| 198 <body onload="runTest()"> | 214 <body onload="runTest()"> |
| 199 <p>Tests revision support in UISourceCode.</p> | 215 <p>Tests revision support in UISourceCode.</p> |
| 200 <a href="https://bugs.webkit.org/show_bug.cgi?id=97669">Bug 97669</a> | 216 <a href="https://bugs.webkit.org/show_bug.cgi?id=97669">Bug 97669</a> |
| 201 </body> | 217 </body> |
| 202 </html> | 218 </html> |
| OLD | NEW |