| 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/isolated-filesystem-test.js"></script> | 5 <script src="../http/tests/inspector/isolated-filesystem-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 function fileSystemUISourceCodes() | 9 function fileSystemUISourceCodes() |
| 10 { | 10 { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 var dir = fs.root.mkdir("html"); | 204 var dir = fs.root.mkdir("html"); |
| 205 dir.addFile("foo.js", ""); | 205 dir.addFile("foo.js", ""); |
| 206 fs.reportCreated(dumpFileSystem); | 206 fs.reportCreated(dumpFileSystem); |
| 207 | 207 |
| 208 function dumpFileSystem() | 208 function dumpFileSystem() |
| 209 { | 209 { |
| 210 InspectorTest.addResult("-- Original tree --"); | 210 InspectorTest.addResult("-- Original tree --"); |
| 211 dumpWorkspaceUISourceCodes(); | 211 dumpWorkspaceUISourceCodes(); |
| 212 | 212 |
| 213 dir.addFile("bar.js", ""); | 213 dir.addFile("bar.js", ""); |
| 214 InspectorFrontendHost.events.dispatchEventToListeners(InspectorF
rontendHostAPI.Events.FileSystemFilesChanged, ["/var/www4/html/bar.js"]); | 214 InspectorFrontendHost.events.dispatchEventToListeners(InspectorF
rontendHostAPI.Events.FileSystemFilesChangedAddedRemoved, { |
| 215 changed: [], |
| 216 added:["/var/www4/html/bar.js"], |
| 217 removed: [] |
| 218 }); |
| 215 | 219 |
| 216 InspectorTest.addResult("-- File added externally --"); | 220 InspectorTest.addResult("-- File added externally --"); |
| 217 dumpWorkspaceUISourceCodes(); | 221 dumpWorkspaceUISourceCodes(); |
| 218 fs.reportRemoved(); | 222 fs.reportRemoved(); |
| 219 next(); | 223 next(); |
| 220 } | 224 } |
| 221 }, | 225 }, |
| 222 | 226 |
| 223 function testGitFolders(next) | 227 function testGitFolders(next) |
| 224 { | 228 { |
| 225 var fs = new InspectorTest.TestFileSystem("file:///var/www3"); | 229 var fs = new InspectorTest.TestFileSystem("file:///var/www3"); |
| 226 var project1 = fs.root.mkdir("project_1"); | 230 var project1 = fs.root.mkdir("project_1"); |
| 227 project1.mkdir(".git").addFile("foo.git"); | 231 project1.mkdir(".git").addFile("foo.git"); |
| 228 var project2 = fs.root.mkdir("project_2"); | 232 var project2 = fs.root.mkdir("project_2"); |
| 229 project2.mkdir(".git").addFile("bar.git"); | 233 project2.mkdir(".git").addFile("bar.git"); |
| 230 var project3 = fs.root.mkdir("project_3"); | 234 var project3 = fs.root.mkdir("project_3"); |
| 231 project3.mkdir(".svn").addFile("baz.svn"); | 235 project3.mkdir(".svn").addFile("baz.svn"); |
| 232 var project4 = fs.root.mkdir("project_4"); | 236 var project4 = fs.root.mkdir("project_4"); |
| 233 project4.addFile("index.html"); | 237 project4.addFile("index.html"); |
| 234 fs.reportCreated(dumpGitFolders); | 238 fs.reportCreated(dumpGitFolders); |
| 235 | 239 |
| 236 function dumpGitFolders() | 240 function dumpGitFolders() |
| 237 { | 241 { |
| 238 var isolatedFileSystem = Workspace.isolatedFileSystemManager.fil
eSystem("file:///var/www3"); | 242 var isolatedFileSystem = Workspace.isolatedFileSystemManager.fil
eSystem("file:///var/www3"); |
| 239 var folders = isolatedFileSystem.gitFolders(); | 243 var folders = isolatedFileSystem.initialGitFolders(); |
| 240 folders.sort(); | 244 folders.sort(); |
| 241 for (var gitFolder of folders) | 245 for (var gitFolder of folders) |
| 242 InspectorTest.addResult(gitFolder); | 246 InspectorTest.addResult(gitFolder); |
| 243 fs.reportRemoved(); | 247 fs.reportRemoved(); |
| 244 next(); | 248 next(); |
| 245 } | 249 } |
| 246 }, | 250 }, |
| 247 | 251 |
| 248 function testUISourceCodeMetadata(next) | 252 function testUISourceCodeMetadata(next) |
| 249 { | 253 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 273 next(); | 277 next(); |
| 274 } | 278 } |
| 275 | 279 |
| 276 function dumpMetadata(label, metadata) | 280 function dumpMetadata(label, metadata) |
| 277 { | 281 { |
| 278 InspectorTest.addResult(label); | 282 InspectorTest.addResult(label); |
| 279 InspectorTest.addResult(" content size: " + metadata.contentS
ize); | 283 InspectorTest.addResult(" content size: " + metadata.contentS
ize); |
| 280 InspectorTest.addResult(" modification time: " + metadata.mod
ificationTime.toISOString()); | 284 InspectorTest.addResult(" modification time: " + metadata.mod
ificationTime.toISOString()); |
| 281 } | 285 } |
| 282 }, | 286 }, |
| 287 |
| 288 function testFileRename(next) |
| 289 { |
| 290 var fs = new InspectorTest.TestFileSystem("file:///var/www3"); |
| 291 var file = fs.root.mkdir("test").addFile("hello.js", "123456"); |
| 292 fs.reportCreated(function() { }); |
| 293 InspectorTest.waitForScriptSource("hello.js", onUISourceCode); |
| 294 var uiSourceCode; |
| 295 var originalURL; |
| 296 function onUISourceCode(sourceCode) |
| 297 { |
| 298 uiSourceCode = sourceCode; |
| 299 originalURL = uiSourceCode.url(); |
| 300 InspectorTest.addResult('URL before rename: ' + originalURL); |
| 301 uiSourceCode.rename('goodbye.js', renamed); |
| 302 } |
| 303 |
| 304 function renamed() |
| 305 { |
| 306 InspectorTest.addResult('URL after rename: ' + uiSourceCode.url(
)); |
| 307 if (uiSourceCode.project().workspace().uiSourceCodeForURL(origin
alURL)) |
| 308 InspectorTest.addResult('ERROR: Still found original URL in
workspace.'); |
| 309 if (!uiSourceCode.project().workspace().uiSourceCodeForURL(uiSou
rceCode.url())) |
| 310 InspectorTest.addResult('ERROR: Could not find new URL in wo
rkspace.'); |
| 311 next(); |
| 312 } |
| 313 } |
| 283 ]); | 314 ]); |
| 284 }; | 315 }; |
| 285 </script> | 316 </script> |
| 286 </head> | 317 </head> |
| 287 <body onload="runTest()"> | 318 <body onload="runTest()"> |
| 288 <p>Tests file system project.</p> | 319 <p>Tests file system project.</p> |
| 289 </body> | 320 </body> |
| 290 </html> | 321 </html> |
| OLD | NEW |