| <html> |
| <head> |
| <script src="inspector-test.js"></script> |
| <script src="debugger-test.js"></script> |
| <script src="persistence/persistence-test.js"></script> |
| <script src="isolated-filesystem-test.js"></script> |
| <script> |
| function addScript(url) |
| { |
| var script = document.createElement("script"); |
| script.setAttribute("src", url); |
| document.head.appendChild(script); |
| } |
| |
| function test() |
| { |
| InspectorTest.forceUseDefaultMapping(); |
| var target = InspectorTest.mainTarget; |
| var fileSystemProjectId = Persistence.FileSystemWorkspaceBinding.projectId("file:///var/www"); |
| |
| function dumpFileSystemUISourceCodesMappings() |
| { |
| var uiSourceCodes = Workspace.workspace.project(fileSystemProjectId).uiSourceCodes(); |
| InspectorTest.addResult("UISourceCode uri to url mappings:"); |
| for (var uiSourceCode of uiSourceCodes) { |
| var binding = Persistence.persistence.binding(uiSourceCode); |
| var url = binding ? binding.network.url() : ""; |
| InspectorTest.addResult(" " + uiSourceCode.url() + " -> " + url); |
| } |
| } |
| |
| InspectorTest.runTestSuite([ |
| function testProjectBasedMapping(next) |
| { |
| InspectorTest.addResult("Adding file system."); |
| var fs = new InspectorTest.TestFileSystem("file:///var/www"); |
| fs.root.mkdir("html").addFile("foo.js", "var foo = 1;"); |
| fs.root.mkdir("html2").addFile("bar.js", "var bar = 2;"); |
| fs.root.addFile(".devtools", JSON.stringify({ mappings: [ { folder: "/html/", url: "http://127.0.0.1:8000/inspector/resources/html/" }, { folder: "/html2/", url: "http://127.0.0.1:8000/inspector/resources/html2/" } ]})); |
| fs.reportCreated(fileSystemCreated); |
| |
| function fileSystemCreated() |
| { |
| InspectorTest.evaluateInPage("addScript('resources/html/foo.js')"); |
| InspectorTest.evaluateInPage("addScript('resources/html2/bar.js')"); |
| Promise.all([ |
| InspectorTest.waitForBinding("foo.js"), |
| InspectorTest.waitForBinding("bar.js") |
| ]).then(onBindings); |
| } |
| |
| function onBindings() |
| { |
| dumpFileSystemUISourceCodesMappings(); |
| fs.reportRemoved(); |
| next(); |
| } |
| } |
| ]); |
| }; |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Tests file system project mappings.</p> |
| </body> |
| </html> |