OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="inspector-test.js"></script> | |
4 <script src="debugger-test.js"></script> | |
5 <script src="persistence/persistence-test.js"></script> | |
6 <script src="isolated-filesystem-test.js"></script> | |
7 <script> | |
8 function addScript(url) | |
9 { | |
10 var script = document.createElement("script"); | |
11 script.setAttribute("src", url); | |
12 document.head.appendChild(script); | |
13 } | |
14 | |
15 function test() | |
16 { | |
17 InspectorTest.forceUseDefaultMapping(); | |
18 var target = InspectorTest.mainTarget; | |
19 var fileSystemProjectId = Persistence.FileSystemWorkspaceBinding.projectId("
file:///var/www"); | |
20 | |
21 function dumpFileSystemUISourceCodesMappings() | |
22 { | |
23 var uiSourceCodes = Workspace.workspace.project(fileSystemProjectId).uiS
ourceCodes(); | |
24 InspectorTest.addResult("UISourceCode uri to url mappings:"); | |
25 for (var uiSourceCode of uiSourceCodes) { | |
26 var binding = Persistence.persistence.binding(uiSourceCode); | |
27 var url = binding ? binding.network.url() : ""; | |
28 InspectorTest.addResult(" " + uiSourceCode.url() + " -> " + url); | |
29 } | |
30 } | |
31 | |
32 InspectorTest.runTestSuite([ | |
33 function testProjectBasedMapping(next) | |
34 { | |
35 InspectorTest.addResult("Adding file system."); | |
36 var fs = new InspectorTest.TestFileSystem("file:///var/www"); | |
37 fs.root.mkdir("html").addFile("foo.js", "var foo = 1;"); | |
38 fs.root.mkdir("html2").addFile("bar.js", "var bar = 2;"); | |
39 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/" } ]})); | |
40 fs.reportCreated(fileSystemCreated); | |
41 | |
42 function fileSystemCreated() | |
43 { | |
44 InspectorTest.evaluateInPage("addScript('resources/html/foo.js')
"); | |
45 InspectorTest.evaluateInPage("addScript('resources/html2/bar.js'
)"); | |
46 Promise.all([ | |
47 InspectorTest.waitForBinding("foo.js"), | |
48 InspectorTest.waitForBinding("bar.js") | |
49 ]).then(onBindings); | |
50 } | |
51 | |
52 function onBindings() | |
53 { | |
54 dumpFileSystemUISourceCodesMappings(); | |
55 fs.reportRemoved(); | |
56 next(); | |
57 } | |
58 } | |
59 ]); | |
60 }; | |
61 </script> | |
62 </head> | |
63 <body onload="runTest()"> | |
64 <p>Tests file system project mappings.</p> | |
65 </body> | |
66 </html> | |
OLD | NEW |