Chromium Code Reviews| 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/debugger-test.js"></script> | 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/workspace-test.js"></script> | 5 <script src="../../../http/tests/inspector/workspace-test.js"></script> |
| 6 <script src="../../../http/tests/inspector/isolated-filesystem-test.js"></script > | 6 <script src="../../../http/tests/inspector/isolated-filesystem-test.js"></script > |
| 7 <script src="../../../http/tests/inspector/live-edit-test.js"></script> | 7 <script src="../../../http/tests/inspector/live-edit-test.js"></script> |
| 8 <script> | 8 <script> |
| 9 function test() | 9 function test() |
| 10 { | 10 { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 | 163 |
| 164 function setScriptSourceOverrideFailure(scriptId, newContent, ca llback) | 164 function setScriptSourceOverrideFailure(scriptId, newContent, ca llback) |
| 165 { | 165 { |
| 166 callback("error"); | 166 callback("error"); |
| 167 } | 167 } |
| 168 InspectorTest.override(WebInspector.DebuggerModel.prototype, "se tScriptSource", setScriptSourceOverrideFailure); | 168 InspectorTest.override(WebInspector.DebuggerModel.prototype, "se tScriptSource", setScriptSourceOverrideFailure); |
| 169 | 169 |
| 170 InspectorTest.addResult("Committing uiSourceCode with live edit failure:"); | 170 InspectorTest.addResult("Committing uiSourceCode with live edit failure:"); |
| 171 uiSourceCode.commitWorkingCopy(); | 171 uiSourceCode.commitWorkingCopy(); |
| 172 | 172 |
| 173 dumpUISourceCodeAndScriptContents(); | 173 resourceScriptMapping.scriptFile(uiSourceCode).checkMapping().th en(onMappingChecked1); |
|
pfeldman
2016/01/20 19:23:51
What if checkMapping is not called in the non-test
lushnikov
2016/01/20 23:35:58
Rewrote using sniffers.
| |
| 174 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | |
| 175 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram e._muted); | |
| 176 | 174 |
| 177 InspectorTest.addResult("Reloading with saved but diverged uiSou rceCode:"); | 175 function onMappingChecked1() |
| 178 unloadScript(); | 176 { |
| 179 InspectorTest.addResult("UISourceCode should not have script fil e after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCode)); | 177 dumpUISourceCodeAndScriptContents(); |
| 180 InspectorTest.addResult("Saved but diverged source frame should not be muted: " + !sourceFrame._muted); | 178 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourc eScriptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
| 179 InspectorTest.addResult(" - sourceFrame._muted: " + !!source Frame._muted); | |
| 181 | 180 |
| 182 InspectorTest.addResult("Loading script."); | 181 InspectorTest.addResult("Reloading with saved but diverged u iSourceCode:"); |
| 183 loadScript(); | 182 unloadScript(); |
| 184 dumpUISourceCodeAndScriptContents(); | 183 InspectorTest.addResult("UISourceCode should not have script file after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCod e)); |
| 185 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 184 InspectorTest.addResult("Saved but diverged source frame sho uld not be muted: " + !sourceFrame._muted); |
| 186 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram e._muted); | |
| 187 | 185 |
| 188 InspectorTest.addResult("Editing uiSourceCode again:"); | 186 InspectorTest.addResult("Loading script."); |
| 189 uiSourceCode.setWorkingCopy("<foo content edited again>"); | 187 loadScript(); |
| 190 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 188 resourceScriptMapping.scriptFile(uiSourceCode).checkMapping( ).then(onMappingChecked2); |
| 191 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram e._muted); | 189 } |
| 192 | 190 |
| 193 function setScriptSourceOverrideSuccess(scriptId, newContent, ca llback) | 191 function onMappingChecked2() |
| 194 { | 192 { |
| 195 scriptContent = newContent; | 193 dumpUISourceCodeAndScriptContents(); |
| 196 callback(); | 194 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourc eScriptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
| 195 InspectorTest.addResult(" - sourceFrame._muted: " + !!source Frame._muted); | |
| 196 | |
| 197 InspectorTest.addResult("Editing uiSourceCode again:"); | |
| 198 uiSourceCode.setWorkingCopy("<foo content edited again>"); | |
| 199 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourc eScriptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | |
| 200 InspectorTest.addResult(" - sourceFrame._muted: " + !!source Frame._muted); | |
| 201 | |
| 202 function setScriptSourceOverrideSuccess(scriptId, newContent , callback) | |
| 203 { | |
| 204 scriptContent = newContent; | |
| 205 callback(); | |
| 206 } | |
| 207 InspectorTest.override(WebInspector.DebuggerModel.prototype, "setScriptSource", setScriptSourceOverrideSuccess); | |
| 208 | |
| 209 InspectorTest.addResult("Committing uiSourceCode again (with live edit success now):"); | |
| 210 uiSourceCode.commitWorkingCopy(); | |
| 211 | |
| 212 dumpUISourceCodeAndScriptContents(); | |
| 213 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourc eScriptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | |
| 214 InspectorTest.addResult(" - sourceFrame._muted: " + !!source Frame._muted); | |
| 215 | |
| 216 InspectorTest.addResult("Reloading page:"); | |
| 217 unloadScript(); | |
| 218 InspectorTest.addResult("UISourceCode should not have script file after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCod e)); | |
| 219 InspectorTest.addResult("Saved and merged source frame shoul d not be muted: " + !sourceFrame._muted); | |
| 220 InspectorTest.addResult("Loading script."); | |
| 221 loadScript(); | |
| 222 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourc eScriptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | |
| 223 InspectorTest.addResult(" - sourceFrame._muted: " + !!source Frame._muted); | |
| 224 | |
| 225 InspectorTest.addResult("Editing uiSourceCode again and relo ading while it is dirty:"); | |
| 226 uiSourceCode.setWorkingCopy("<foo content edited and dirty>" ); | |
| 227 unloadScript(); | |
| 228 InspectorTest.addResult("UISourceCode should not have script file after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCod e)); | |
| 229 InspectorTest.addResult("Dirty source frame should be muted: " + sourceFrame._muted); | |
| 230 InspectorTest.addResult("Loading script."); | |
| 231 loadScript(); | |
| 232 | |
| 233 resourceScriptMapping.scriptFile(uiSourceCode).checkMapping( ).then(onMappingChecked3); | |
| 197 } | 234 } |
| 198 InspectorTest.override(WebInspector.DebuggerModel.prototype, "se tScriptSource", setScriptSourceOverrideSuccess); | |
| 199 | 235 |
| 200 InspectorTest.addResult("Committing uiSourceCode again (with liv e edit success now):"); | 236 function onMappingChecked3() |
| 201 uiSourceCode.commitWorkingCopy(); | 237 { |
| 238 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourc eScriptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | |
| 239 InspectorTest.addResult(" - sourceFrame._muted: " + !!source Frame._muted); | |
| 202 | 240 |
| 203 dumpUISourceCodeAndScriptContents(); | 241 unloadScript(); |
| 204 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 242 loadScript; |
| 205 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram e._muted); | |
| 206 | 243 |
| 207 InspectorTest.addResult("Reloading page:"); | 244 WebInspector.debuggerWorkspaceBinding = InspectorTest._origi nalDebuggerBinding; |
| 208 unloadScript(); | 245 fs.reportRemoved(); |
| 209 InspectorTest.addResult("UISourceCode should not have script fil e after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCode)); | 246 next(); |
| 210 InspectorTest.addResult("Saved and merged source frame should no t be muted: " + !sourceFrame._muted); | 247 } |
| 211 InspectorTest.addResult("Loading script."); | |
| 212 loadScript(); | |
| 213 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | |
| 214 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram e._muted); | |
| 215 | |
| 216 InspectorTest.addResult("Editing uiSourceCode again and reloadin g while it is dirty:"); | |
| 217 uiSourceCode.setWorkingCopy("<foo content edited and dirty>"); | |
| 218 unloadScript(); | |
| 219 InspectorTest.addResult("UISourceCode should not have script fil e after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCode)); | |
| 220 InspectorTest.addResult("Dirty source frame should be muted: " + sourceFrame._muted); | |
| 221 InspectorTest.addResult("Loading script."); | |
| 222 loadScript(); | |
| 223 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | |
| 224 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram e._muted); | |
| 225 | |
| 226 unloadScript(); | |
| 227 loadScript; | |
| 228 | |
| 229 WebInspector.debuggerWorkspaceBinding = InspectorTest._originalD ebuggerBinding; | |
| 230 fs.reportRemoved(); | |
| 231 next(); | |
| 232 } | 248 } |
| 233 }, | 249 }, |
| 234 | 250 |
| 235 function testRemoveProject(next) | 251 function testRemoveProject(next) |
| 236 { | 252 { |
| 237 function dumpWorkspaceUISourceCodes() | 253 function dumpWorkspaceUISourceCodes() |
| 238 { | 254 { |
| 239 InspectorTest.addResult("Dumping uiSourceCodes origin URLs:"); | 255 InspectorTest.addResult("Dumping uiSourceCodes origin URLs:"); |
| 240 var uiSourceCodes = InspectorTest.testWorkspace.uiSourceCodes(); | 256 var uiSourceCodes = InspectorTest.testWorkspace.uiSourceCodes(); |
| 241 for (var i = 0; i < uiSourceCodes.length; ++i) | 257 for (var i = 0; i < uiSourceCodes.length; ++i) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 } | 351 } |
| 336 } | 352 } |
| 337 ]); | 353 ]); |
| 338 }; | 354 }; |
| 339 </script> | 355 </script> |
| 340 </head> | 356 </head> |
| 341 <body onload="runTest()"> | 357 <body onload="runTest()"> |
| 342 <p>Tests file system project mappings.</p> | 358 <p>Tests file system project mappings.</p> |
| 343 </body> | 359 </body> |
| 344 </html> | 360 </html> |
| OLD | NEW |