| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/persistence/persistence-test.js"></sc
ript> | |
| 5 <script src="../../../http/tests/inspector/debugger-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> | |
| 8 <script> | |
| 9 function addScript() | |
| 10 { | |
| 11 var script = document.createElement("script"); | |
| 12 script.src = "resources/edit-me.js"; | |
| 13 document.head.appendChild(script); | |
| 14 } | |
| 15 | |
| 16 function test() | |
| 17 { | |
| 18 InspectorTest.runTestSuite([ | |
| 19 function testLiveEditReload(next) | |
| 20 { | |
| 21 var fs = new InspectorTest.TestFileSystem("file:///var/www"); | |
| 22 fs.root.mkdir("html").addFile("edit-me.js", "function f()\n{\n re
turn 0;\n}\n"); | |
| 23 fs.root.addFile("bar.js", "<bar content>"); | |
| 24 InspectorTest.addResult("Adding file system."); | |
| 25 fs.addFileMapping(Common.ParsedURL.completeURL(InspectorTest.mainTar
get.inspectedURL(), "resources/"), "/html/"); | |
| 26 fs.reportCreated(fileSystemCreated); | |
| 27 | |
| 28 function fileSystemCreated() | |
| 29 { | |
| 30 InspectorTest.evaluateInPage("addScript()"); | |
| 31 InspectorTest.waitForBinding("edit-me.js").then(didAddScript); | |
| 32 } | |
| 33 | |
| 34 function didAddScript() | |
| 35 { | |
| 36 InspectorTest.showScriptSource("edit-me.js", didShowScriptSource
); | |
| 37 } | |
| 38 | |
| 39 function didShowScriptSource(sourceFrame) | |
| 40 { | |
| 41 InspectorTest.addResult("Editing filesystem resource: " + source
Frame.uiSourceCode().url()); | |
| 42 InspectorTest.addSniffer(SDK.DebuggerModel.prototype, "_didEditS
criptSource", didEditScriptSource); | |
| 43 InspectorTest.replaceInSource(sourceFrame, "return 0;", "return
\"live-edited string\";"); | |
| 44 InspectorTest.commitSource(sourceFrame); | |
| 45 } | |
| 46 | |
| 47 function didEditScriptSource() | |
| 48 { | |
| 49 InspectorTest.evaluateInPage("f()", didEvaluateInPage); | |
| 50 } | |
| 51 | |
| 52 function didEvaluateInPage(result) | |
| 53 { | |
| 54 InspectorTest.addResult("Edited function returns: " + result.des
cription); | |
| 55 next(); | |
| 56 } | |
| 57 } | |
| 58 ]); | |
| 59 }; | |
| 60 </script> | |
| 61 </head> | |
| 62 <body onload="runTest()"> | |
| 63 <p>Tests file system project mappings in combination with live edit.</p> | |
| 64 </body> | |
| 65 </html> | |
| OLD | NEW |