| <html> |
| <head> |
| <script src="../http/tests/inspector/inspector-test.js"></script> |
| <script src="../http/tests/inspector/debugger-test.js"></script> |
| <script src="../http/tests/inspector/workspace-test.js"></script> |
| <script src="../http/tests/inspector/isolated-filesystem-test.js"></script> |
| <script> |
| function test() |
| { |
| function dumpUISourceCodes(uiSourceCodes, next) |
| { |
| innerDumpUISourceCodes(uiSourceCodes, 0, next); |
| |
| function innerDumpUISourceCodes(uiSourceCodes, startIndex, next) |
| { |
| InspectorTest.addResult(""); |
| if (startIndex === uiSourceCodes.length) { |
| next(); |
| return; |
| } |
| InspectorTest.dumpUISourceCode(uiSourceCodes[startIndex], innerDumpUISourceCodes.bind(this, uiSourceCodes, startIndex + 1, next)); |
| } |
| } |
| |
| InspectorTest.runTestSuite([ |
| function testFileSystems(next) |
| { |
| InspectorTest.createWorkspace(); |
| var manager = InspectorTest.createIsolatedFileSystemManager(InspectorTest.testWorkspace, InspectorTest.testFileSystemMapping); |
| var uiSourceCodes = []; |
| var entry1 = new WebInspector.FileMapping.Entry("http://localhost/", "/var/www/localhost/"); |
| var entry2 = new WebInspector.FileMapping.Entry("http://www.example.com/", "/foo/bar/"); |
| InspectorTest.testFileMapping.setMappingEntries([entry1, entry2]); |
| InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 3); |
| InspectorTest.addResult("Adding first file system."); |
| manager.addMockFileSystem("/var/www", {"/localhost/foo.js": "<foo content>", "/bar.js": "<bar content>"}); |
| InspectorTest.addResult("Adding second file system."); |
| manager.addMockFileSystem("/foo/bar", {"/baz.js": "<baz content>"}); |
| |
| dumpUISourceCodes(uiSourceCodes, uiSourceCodesDumped); |
| |
| function uiSourceCodeAdded(uiSourceCode) |
| { |
| uiSourceCodes.push(uiSourceCode) |
| } |
| |
| function uiSourceCodesDumped() |
| { |
| InspectorTest.addResult("UISourceCode uri to url mappings:"); |
| for (var i = 0; i < uiSourceCodes.length; ++i) { |
| var url = uiSourceCodes[i].url; |
| if (!url) |
| continue; |
| InspectorTest.addResult(" " + uiSourceCodes[i].uri() + " -> " + uiSourceCodes[i].url); |
| } |
| InspectorTest.addResult("UISourceCode url to uri mappings:"); |
| for (var i = 0; i < uiSourceCodes.length; ++i) { |
| var url = uiSourceCodes[i].url; |
| if (!url) |
| continue; |
| var uri = InspectorTest.testWorkspace.uiSourceCodeForURL(url).uri(); |
| InspectorTest.addResult(" " + url + " -> " + uri); |
| } |
| var uiSourceCodesCount = InspectorTest.testWorkspace.uiSourceCodes().length; |
| InspectorTest.addResult("Removing second file system."); |
| manager.removeMockFileSystem("/var/www"); |
| InspectorTest.addResult(" number of uiSourceCodes in workspace after removing second file system: " + InspectorTest.testWorkspace.uiSourceCodes().length); |
| InspectorTest.addResult("Removing first file system."); |
| manager.removeMockFileSystem("/foo/bar"); |
| InspectorTest.addResult(" number of uiSourceCodes in workspace after removing first file system: " + InspectorTest.testWorkspace.uiSourceCodes().length); |
| next(); |
| } |
| }, |
| ]); |
| }; |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Tests file system project.</p> |
| </body> |
| </html> |