| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../inspector-test.js"></script> | 3 <script src="../inspector-test.js"></script> |
| 4 <script src="../debugger-test.js"></script> | 4 <script src="../debugger-test.js"></script> |
| 5 <script src="../isolated-filesystem-test.js"></script> | 5 <script src="../isolated-filesystem-test.js"></script> |
| 6 <script src="./persistence-test.js"></script> | 6 <script src="./persistence-test.js"></script> |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 function test() | 9 function test() |
| 10 { | 10 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 var mainFrame = resourceTreeModel.mainFrame; | 32 var mainFrame = resourceTreeModel.mainFrame; |
| 33 var contentProvider = new Common.StaticContentProvider("http://127.0.0.1:800
0/nodejs.js", Common.resourceTypes.Script, () => Promise.resolve(nodeContent)); | 33 var contentProvider = new Common.StaticContentProvider("http://127.0.0.1:800
0/nodejs.js", Common.resourceTypes.Script, () => Promise.resolve(nodeContent)); |
| 34 networkProject.addFile(contentProvider, mainFrame, false); | 34 networkProject.addFile(contentProvider, mainFrame, false); |
| 35 | 35 |
| 36 // Add filesystem UISourceCode and mapping. | 36 // Add filesystem UISourceCode and mapping. |
| 37 var fs = new InspectorTest.TestFileSystem("file:///var/www"); | 37 var fs = new InspectorTest.TestFileSystem("file:///var/www"); |
| 38 var fsEntry = fs.root.addFile("nodejs.js", fsContent); | 38 var fsEntry = fs.root.addFile("nodejs.js", fsContent); |
| 39 fs.addFileMapping("http://127.0.0.1:8000", "/"); | 39 fs.addFileMapping("http://127.0.0.1:8000", "/"); |
| 40 fs.reportCreated(function() { }); | 40 fs.reportCreated(function() { }); |
| 41 | 41 |
| 42 var binding; |
| 42 InspectorTest.waitForBinding("nodejs.js").then(onBindingCreated); | 43 InspectorTest.waitForBinding("nodejs.js").then(onBindingCreated); |
| 43 | 44 |
| 44 function onBindingCreated(binding) | 45 function onBindingCreated(theBinding) |
| 45 { | 46 { |
| 47 binding = theBinding; |
| 46 InspectorTest.addResult("Binding created: " + binding); | 48 InspectorTest.addResult("Binding created: " + binding); |
| 47 editNetworkUISourceCode(binding); | 49 InspectorTest.runTestSuite(testSuite); |
| 48 } | 50 } |
| 49 | 51 |
| 50 function editNetworkUISourceCode(binding) | 52 var testSuite = [ |
| 51 { | 53 function addNetworkUISourceCodeRevision(next) |
| 52 InspectorTest.addResult("\nRunning: Edit network uiSourceCode"); | 54 { |
| 53 nodeContent = nodeContent.replace("//TODO", "network();\n//TODO"); | 55 nodeContent = nodeContent.replace("//TODO", "network();\n//TODO"); |
| 54 InspectorTest.addSniffer(Persistence.Persistence.prototype, "_contentSyn
cedForTest", onSynced); | 56 InspectorTest.addSniffer(Persistence.Persistence.prototype, "_conten
tSyncedForTest", onSynced); |
| 55 binding.network.addRevision(nodeContent); | 57 binding.network.addRevision(nodeContent); |
| 56 | 58 |
| 57 function onSynced() | 59 function onSynced() |
| 60 { |
| 61 dumpBindingContent(); |
| 62 next(); |
| 63 } |
| 64 }, |
| 65 |
| 66 function setNetworkUISourceCodeWorkingCopy(next) |
| 58 { | 67 { |
| 59 dumpBindingContent(binding); | 68 nodeContent = nodeContent.replace("//TODO", "workingCopy1();\n//TODO
"); |
| 60 changeFileSystem(binding); | 69 InspectorTest.addSniffer(Persistence.Persistence.prototype, "_conten
tSyncedForTest", onSynced); |
| 61 } | 70 binding.network.setWorkingCopy(nodeContent); |
| 62 } | |
| 63 | 71 |
| 64 function changeFileSystem(binding) | 72 function onSynced() |
| 65 { | 73 { |
| 66 InspectorTest.addResult("\nRunning: Edit fileSystem uiSourceCode"); | 74 dumpBindingContent(); |
| 67 fsContent = fsContent.replace("//TODO", "filesystem();\n//TODO"); | 75 next(); |
| 68 InspectorTest.addSniffer(Persistence.Persistence.prototype, "_contentSyn
cedForTest", onSynced); | 76 } |
| 69 fsEntry.setContent(fsContent); | 77 }, |
| 70 | 78 |
| 71 function onSynced() | 79 function changeFileSystemFile(next) |
| 72 { | 80 { |
| 73 dumpBindingContent(binding); | 81 fsContent = fsContent.replace("//TODO", "filesystem();\n//TODO"); |
| 74 InspectorTest.completeTest(); | 82 InspectorTest.addSniffer(Persistence.Persistence.prototype, "_conten
tSyncedForTest", onSynced); |
| 75 } | 83 fsEntry.setContent(fsContent); |
| 76 } | |
| 77 | 84 |
| 78 function dumpBindingContent(binding) | 85 function onSynced() |
| 86 { |
| 87 dumpBindingContent(); |
| 88 next(); |
| 89 } |
| 90 }, |
| 91 |
| 92 function setFileSystemUISourceCodeWorkingCopy(next) |
| 93 { |
| 94 nodeContent = fsContent.replace("//TODO", "workingCopy2();\n//TODO")
; |
| 95 InspectorTest.addSniffer(Persistence.Persistence.prototype, "_conten
tSyncedForTest", onSynced); |
| 96 binding.fileSystem.setWorkingCopy(nodeContent); |
| 97 |
| 98 function onSynced() |
| 99 { |
| 100 dumpBindingContent(); |
| 101 next(); |
| 102 } |
| 103 }, |
| 104 ]; |
| 105 |
| 106 function dumpBindingContent() |
| 79 { | 107 { |
| 80 InspectorTest.addResult("Network:"); | 108 InspectorTest.addResult("Network:"); |
| 81 InspectorTest.addResult(indent(binding.network.workingCopy())); | 109 InspectorTest.addResult(indent(binding.network.workingCopy())); |
| 82 InspectorTest.addResult(""); | 110 InspectorTest.addResult(""); |
| 83 InspectorTest.addResult("FileSystem:"); | 111 InspectorTest.addResult("FileSystem:"); |
| 84 InspectorTest.addResult(indent(binding.fileSystem.workingCopy())); | 112 InspectorTest.addResult(indent(binding.fileSystem.workingCopy())); |
| 85 InspectorTest.addResult(""); | 113 InspectorTest.addResult(""); |
| 86 } | 114 } |
| 87 | 115 |
| 88 function indent(content) | 116 function indent(content) |
| 89 { | 117 { |
| 90 return content.split("\n").map(line => " " + line).join("\n"); | 118 return content.split("\n").map(line => " " + line).join("\n"); |
| 91 } | 119 } |
| 92 }; | 120 }; |
| 93 </script> | 121 </script> |
| 94 </head> | 122 </head> |
| 95 <body onload="runTest()"> | 123 <body onload="runTest()"> |
| 96 <p>Verify that syncing Node.js contents works fine.</p> | 124 <p>Verify that syncing Node.js contents works fine.</p> |
| 97 </body> | 125 </body> |
| 98 </html> | 126 </html> |
| OLD | NEW |