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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 WebInspector._originalTargetManager = WebInspector.targetManager; | 127 WebInspector._originalTargetManager = WebInspector.targetManager; |
128 WebInspector.targetManager = InspectorTest.testTargetManager; | 128 WebInspector.targetManager = InspectorTest.testTargetManager; |
129 | 129 |
130 InspectorTest.addResult("Adding file system."); | 130 InspectorTest.addResult("Adding file system."); |
131 var fs = new InspectorTest.TestFileSystem("file:///var/www"); | 131 var fs = new InspectorTest.TestFileSystem("file:///var/www"); |
132 fs.root.mkdir("html").addFile("foo.js", originalFileContent); | 132 fs.root.mkdir("html").addFile("foo.js", originalFileContent); |
133 fs.root.addFile("bar.js", "<bar content>"); | 133 fs.root.addFile("bar.js", "<bar content>"); |
134 InspectorTest.addResult("Adding file system mapping."); | 134 InspectorTest.addResult("Adding file system mapping."); |
135 fs.addFileMapping("http://localhost/", "/"); | 135 fs.addFileMapping("http://localhost/", "/"); |
136 fs.reportCreated(fileSystemCreated); | 136 fs.reportCreated(fileSystemCreated); |
| 137 var sourceFrame; |
| 138 |
| 139 function waitForMappingsCheck(callback) |
| 140 { |
| 141 InspectorTest.addSniffer(WebInspector.ResourceScriptFile.prototy
pe, "_mappingCheckedForTest", onMappingChecked); |
| 142 |
| 143 function onMappingChecked() |
| 144 { |
| 145 setImmediate(callback); |
| 146 } |
| 147 } |
137 | 148 |
138 function fileSystemCreated() | 149 function fileSystemCreated() |
139 { | 150 { |
140 loadScript(); | 151 loadScript(); |
141 | 152 |
142 uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(fileSyst
emProjectId, "file:///var/www/html/foo.js"); | 153 uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(fileSyst
emProjectId, "file:///var/www/html/foo.js"); |
143 InspectorTest.showUISourceCode(uiSourceCode, didShowScriptSource
); | 154 InspectorTest.showUISourceCode(uiSourceCode, sf => sourceFrame =
sf); |
| 155 waitForMappingsCheck(didShowScriptSource); |
144 } | 156 } |
145 | 157 |
146 function dumpUISourceCodeAndScriptContents() | 158 function dumpUISourceCodeAndScriptContents() |
147 { | 159 { |
148 InspectorTest.addResult("Dumping uiSourceCode and script content
:"); | 160 InspectorTest.addResult("Dumping uiSourceCode and script content
:"); |
149 InspectorTest.addResult(" uiSourceCode: " + uiSourceCode.work
ingCopy()); | 161 InspectorTest.addResult(" uiSourceCode: " + uiSourceCode.work
ingCopy()); |
150 InspectorTest.addResult(" script: " + scriptContent); | 162 InspectorTest.addResult(" script: " + scriptContent); |
151 } | 163 } |
152 | 164 |
153 function didShowScriptSource(sourceFrame) | 165 function didShowScriptSource() |
154 { | 166 { |
155 dumpUISourceCodeAndScriptContents(); | 167 dumpUISourceCodeAndScriptContents(); |
156 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 168 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
157 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); | 169 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); |
158 | 170 |
159 InspectorTest.addResult("Editing uiSourceCode:"); | 171 InspectorTest.addResult("Editing uiSourceCode:"); |
| 172 waitForMappingsCheck(onMappingChecked1); |
160 uiSourceCode.setWorkingCopy("<foo content edited>"); | 173 uiSourceCode.setWorkingCopy("<foo content edited>"); |
| 174 } |
| 175 |
| 176 function onMappingChecked1() |
| 177 { |
161 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 178 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
162 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); | 179 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); |
163 | 180 |
164 function setScriptSourceOverrideFailure(scriptId, newContent, ca
llback) | 181 function setScriptSourceOverrideFailure(scriptId, newContent, ca
llback) |
165 { | 182 { |
166 callback("error"); | 183 callback("error"); |
167 } | 184 } |
168 InspectorTest.override(WebInspector.DebuggerModel.prototype, "se
tScriptSource", setScriptSourceOverrideFailure); | 185 InspectorTest.override(WebInspector.DebuggerModel.prototype, "se
tScriptSource", setScriptSourceOverrideFailure); |
169 | 186 |
170 InspectorTest.addResult("Committing uiSourceCode with live edit
failure:"); | 187 InspectorTest.addResult("Committing uiSourceCode with live edit
failure:"); |
| 188 waitForMappingsCheck(onMappingChecked2); |
171 uiSourceCode.commitWorkingCopy(); | 189 uiSourceCode.commitWorkingCopy(); |
| 190 } |
172 | 191 |
| 192 function onMappingChecked2() |
| 193 { |
173 dumpUISourceCodeAndScriptContents(); | 194 dumpUISourceCodeAndScriptContents(); |
174 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 195 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
175 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); | 196 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); |
176 | 197 |
177 InspectorTest.addResult("Reloading with saved but diverged uiSou
rceCode:"); | 198 InspectorTest.addResult("Reloading with saved but diverged uiSou
rceCode:"); |
178 unloadScript(); | 199 unloadScript(); |
179 InspectorTest.addResult("UISourceCode should not have script fil
e after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCode)); | 200 InspectorTest.addResult("UISourceCode should not have script fil
e after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCode)); |
180 InspectorTest.addResult("Saved but diverged source frame should
not be muted: " + !sourceFrame._muted); | 201 InspectorTest.addResult("Saved but diverged source frame should
not be muted: " + !sourceFrame._muted); |
181 | 202 |
182 InspectorTest.addResult("Loading script."); | 203 InspectorTest.addResult("Loading script."); |
| 204 waitForMappingsCheck(onMappingChecked3); |
183 loadScript(); | 205 loadScript(); |
| 206 } |
| 207 |
| 208 function onMappingChecked3() |
| 209 { |
184 dumpUISourceCodeAndScriptContents(); | 210 dumpUISourceCodeAndScriptContents(); |
185 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 211 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
186 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); | 212 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); |
187 | 213 |
188 InspectorTest.addResult("Editing uiSourceCode again:"); | 214 InspectorTest.addResult("Editing uiSourceCode again:"); |
| 215 waitForMappingsCheck(onMappingChecked4); |
189 uiSourceCode.setWorkingCopy("<foo content edited again>"); | 216 uiSourceCode.setWorkingCopy("<foo content edited again>"); |
| 217 } |
| 218 |
| 219 function onMappingChecked4() |
| 220 { |
190 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 221 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
191 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); | 222 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); |
192 | 223 |
193 function setScriptSourceOverrideSuccess(scriptId, newContent, ca
llback) | 224 function setScriptSourceOverrideSuccess(scriptId, newContent, ca
llback) |
194 { | 225 { |
195 scriptContent = newContent; | 226 scriptContent = newContent; |
196 callback(); | 227 callback(); |
197 } | 228 } |
198 InspectorTest.override(WebInspector.DebuggerModel.prototype, "se
tScriptSource", setScriptSourceOverrideSuccess); | 229 InspectorTest.override(WebInspector.DebuggerModel.prototype, "se
tScriptSource", setScriptSourceOverrideSuccess); |
199 | 230 |
200 InspectorTest.addResult("Committing uiSourceCode again (with liv
e edit success now):"); | 231 InspectorTest.addResult("Committing uiSourceCode again (with liv
e edit success now):"); |
| 232 waitForMappingsCheck(onMappingChecked5); |
201 uiSourceCode.commitWorkingCopy(); | 233 uiSourceCode.commitWorkingCopy(); |
| 234 } |
202 | 235 |
| 236 function onMappingChecked5() |
| 237 { |
203 dumpUISourceCodeAndScriptContents(); | 238 dumpUISourceCodeAndScriptContents(); |
204 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 239 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
205 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); | 240 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); |
206 | 241 |
207 InspectorTest.addResult("Reloading page:"); | 242 InspectorTest.addResult("Reloading page:"); |
208 unloadScript(); | 243 unloadScript(); |
209 InspectorTest.addResult("UISourceCode should not have script fil
e after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCode)); | 244 InspectorTest.addResult("UISourceCode should not have script fil
e after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCode)); |
210 InspectorTest.addResult("Saved and merged source frame should no
t be muted: " + !sourceFrame._muted); | 245 InspectorTest.addResult("Saved and merged source frame should no
t be muted: " + !sourceFrame._muted); |
211 InspectorTest.addResult("Loading script."); | 246 InspectorTest.addResult("Loading script."); |
| 247 waitForMappingsCheck(onMappingChecked6); |
212 loadScript(); | 248 loadScript(); |
| 249 } |
| 250 |
| 251 function onMappingChecked6() |
| 252 { |
213 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 253 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
214 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); | 254 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); |
215 | 255 |
216 InspectorTest.addResult("Editing uiSourceCode again and reloadin
g while it is dirty:"); | 256 InspectorTest.addResult("Editing uiSourceCode again and reloadin
g while it is dirty:"); |
217 uiSourceCode.setWorkingCopy("<foo content edited and dirty>"); | 257 uiSourceCode.setWorkingCopy("<foo content edited and dirty>"); |
218 unloadScript(); | 258 unloadScript(); |
219 InspectorTest.addResult("UISourceCode should not have script fil
e after unloading scripts: " + !resourceScriptMapping.scriptFile(uiSourceCode)); | 259 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); | 260 InspectorTest.addResult("Dirty source frame should be muted: " +
sourceFrame._muted); |
221 InspectorTest.addResult("Loading script."); | 261 InspectorTest.addResult("Loading script."); |
| 262 waitForMappingsCheck(onMappingChecked7); |
222 loadScript(); | 263 loadScript(); |
| 264 } |
| 265 |
| 266 function onMappingChecked7() |
| 267 { |
223 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); | 268 InspectorTest.addResult(" - hasDivergedFromVM: " + !!resourceScr
iptMapping.scriptFile(uiSourceCode).hasDivergedFromVM()); |
224 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); | 269 InspectorTest.addResult(" - sourceFrame._muted: " + !!sourceFram
e._muted); |
225 | 270 |
226 unloadScript(); | 271 unloadScript(); |
227 loadScript; | 272 loadScript; |
228 | 273 |
229 WebInspector.debuggerWorkspaceBinding = InspectorTest._originalD
ebuggerBinding; | 274 WebInspector.debuggerWorkspaceBinding = InspectorTest._originalD
ebuggerBinding; |
230 fs.reportRemoved(); | 275 fs.reportRemoved(); |
231 next(); | 276 next(); |
232 } | 277 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 380 } |
336 } | 381 } |
337 ]); | 382 ]); |
338 }; | 383 }; |
339 </script> | 384 </script> |
340 </head> | 385 </head> |
341 <body onload="runTest()"> | 386 <body onload="runTest()"> |
342 <p>Tests file system project mappings.</p> | 387 <p>Tests file system project mappings.</p> |
343 </body> | 388 </body> |
344 </html> | 389 </html> |
OLD | NEW |