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