| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/live-edit-test.js"></script> |
| 6 <script src="resources/edit-me.js"></script> |
| 7 |
| 8 <script> |
| 9 |
| 10 function test() { |
| 11 InspectorTest.startDebuggerTest(testStarted); |
| 12 function testStarted() { |
| 13 InspectorTest.showScriptSource('edit-me.js', didShowScriptSource); |
| 14 } |
| 15 |
| 16 function didShowScriptSource(sourceFrame) { |
| 17 replaceInSource(sourceFrame, 'return 0;', 'return "live-edited string";', di
dEditScriptSource); |
| 18 } |
| 19 |
| 20 function didEditScriptSource() { |
| 21 UI.panels.sources.sourcesView().currentUISourceCode().requestOriginalContent
().then(gotOriginalContent) |
| 22 } |
| 23 |
| 24 function gotOriginalContent(originalContent) { |
| 25 InspectorTest.addResult('==== Original Content ===='); |
| 26 InspectorTest.addResult(originalContent); |
| 27 UI.panels.sources.sourcesView().currentUISourceCode().requestContent().then(
gotContent) |
| 28 } |
| 29 |
| 30 function gotContent(content) { |
| 31 InspectorTest.addResult(''); |
| 32 InspectorTest.addResult(''); |
| 33 InspectorTest.addResult('==== Current Content ===='); |
| 34 InspectorTest.addResult(content); |
| 35 InspectorTest.completeDebuggerTest(); |
| 36 } |
| 37 |
| 38 function replaceInSource(sourceFrame, string, replacement, callback) { |
| 39 InspectorTest.addSniffer(InspectorTest.debuggerModel, '_didEditScriptSource'
, callback); |
| 40 InspectorTest.replaceInSource(sourceFrame, string, replacement); |
| 41 InspectorTest.commitSource(sourceFrame); |
| 42 } |
| 43 } |
| 44 |
| 45 </script> |
| 46 |
| 47 </head> |
| 48 |
| 49 <body onload="runTest()"> |
| 50 <p>Tests that the original content is accessible on live edited scripts.</p> |
| 51 |
| 52 </body> |
| 53 </html> |
| OLD | NEW |