| 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> | 4 <script> |
| 5 function test() | 5 function test() |
| 6 { | 6 { |
| 7 var paths = { | 7 var paths = { |
| 8 FOO: "file:///home/username/projects/foo", | 8 FOO: "file:///home/username/projects/foo", |
| 9 BAR: "file:///home/username/projects/bar", | 9 BAR: "file:///home/username/projects/bar", |
| 10 BUILD: "file:///home/username/project/build", |
| 10 SITE1: "file:///www/site1" | 11 SITE1: "file:///www/site1" |
| 11 }; | 12 }; |
| 12 | 13 |
| 13 function addFileSystem(fileSystemMapping, path) | 14 function addFileSystem(fileSystemMapping, path) |
| 14 { | 15 { |
| 15 InspectorTest.addResult("Adding file system " + path); | 16 InspectorTest.addResult("Adding file system " + path); |
| 16 fileSystemMapping.addFileSystem(path); | 17 fileSystemMapping.addFileSystem(path); |
| 17 checkAndDumpFileSystemMapping(fileSystemMapping); | 18 checkAndDumpFileSystemMapping(fileSystemMapping); |
| 18 } | 19 } |
| 19 | 20 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // At first create file system mapping and clear it. | 89 // At first create file system mapping and clear it. |
| 89 var fileSystemMapping = new WebInspector.FileSystemMapping(); | 90 var fileSystemMapping = new WebInspector.FileSystemMapping(); |
| 90 var fileSystemPaths = Object.keys(fileSystemMapping._fileSystemMappings); | 91 var fileSystemPaths = Object.keys(fileSystemMapping._fileSystemMappings); |
| 91 for (var i = 0; i < fileSystemPaths.length; ++i) | 92 for (var i = 0; i < fileSystemPaths.length; ++i) |
| 92 fileSystemMapping.removeFileSystem(fileSystemPaths[i]); | 93 fileSystemMapping.removeFileSystem(fileSystemPaths[i]); |
| 93 | 94 |
| 94 // Now fill it with file systems. | 95 // Now fill it with file systems. |
| 95 checkAndDumpFileSystemMapping(fileSystemMapping); | 96 checkAndDumpFileSystemMapping(fileSystemMapping); |
| 96 addFileSystem(fileSystemMapping, paths.FOO) | 97 addFileSystem(fileSystemMapping, paths.FOO) |
| 97 addFileSystem(fileSystemMapping, paths.BAR) | 98 addFileSystem(fileSystemMapping, paths.BAR) |
| 99 addFileSystem(fileSystemMapping, paths.BUILD) |
| 98 addFileSystem(fileSystemMapping, paths.SITE1) | 100 addFileSystem(fileSystemMapping, paths.SITE1) |
| 99 | 101 |
| 100 // Now fill it with file mappings. | 102 // Now fill it with file mappings. |
| 101 addFileMapping(fileSystemMapping, paths.SITE1, "http://localhost/", "/"); | 103 addFileMapping(fileSystemMapping, paths.SITE1, "http://localhost/", "/"); |
| 102 addFileMapping(fileSystemMapping, paths.SITE1, "http://www.foo.com/", "/foo/
"); | 104 addFileMapping(fileSystemMapping, paths.SITE1, "http://www.foo.com/", "/foo/
"); |
| 103 addFileMapping(fileSystemMapping, paths.FOO, "http://www.example.com/bar/",
"/foo/"); | 105 addFileMapping(fileSystemMapping, paths.FOO, "http://www.example.com/bar/",
"/foo/"); |
| 104 addMappingForResource(fileSystemMapping, "http://www.bar.com/foo/folder/42.j
s", paths.FOO, paths.FOO + "/baz/folder/42.js"); | 106 addMappingForResource(fileSystemMapping, "http://www.bar.com/foo/folder/42.j
s", paths.FOO, paths.FOO + "/baz/folder/42.js"); |
| 107 addMappingForResource(fileSystemMapping, "http://localhost:3333/build/layout
.css", paths.BUILD, paths.BUILD + "/layout.css"); |
| 105 | 108 |
| 106 InspectorTest.addResult("Testing mappings for url:"); | 109 InspectorTest.addResult("Testing mappings for url:"); |
| 107 dumpFileForURL(fileSystemMapping, "http://www.bar.com/foo/folder/42.js"); | 110 dumpFileForURL(fileSystemMapping, "http://www.bar.com/foo/folder/42.js"); |
| 108 dumpFileForURL(fileSystemMapping, "http://www.foo.com/bar/folder/42.js"); | 111 dumpFileForURL(fileSystemMapping, "http://www.foo.com/bar/folder/42.js"); |
| 109 dumpFileForURL(fileSystemMapping, "http://localhost/index.html"); | 112 dumpFileForURL(fileSystemMapping, "http://localhost/index.html"); |
| 110 dumpFileForURL(fileSystemMapping, "https://localhost/index.html"); | 113 dumpFileForURL(fileSystemMapping, "https://localhost/index.html"); |
| 111 dumpFileForURL(fileSystemMapping, "http://localhost:8080/index.html"); | 114 dumpFileForURL(fileSystemMapping, "http://localhost:8080/index.html"); |
| 112 dumpFileForURL(fileSystemMapping, "http://localhost/"); | 115 dumpFileForURL(fileSystemMapping, "http://localhost/"); |
| 116 dumpFileForURL(fileSystemMapping, "http://localhost:3333/build/main.css"); |
| 113 InspectorTest.addResult(""); | 117 InspectorTest.addResult(""); |
| 114 | 118 |
| 115 InspectorTest.addResult("Testing mappings for path:"); | 119 InspectorTest.addResult("Testing mappings for path:"); |
| 116 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/baz/folder/42.js"
); | 120 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/baz/folder/42.js"
); |
| 117 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/baz/folder/43.js"
); | 121 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/baz/folder/43.js"
); |
| 118 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/bar/folder/42.js"
); | 122 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/bar/folder/42.js"
); |
| 119 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/foo/folder/42.js"
); | 123 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/foo/folder/42.js"
); |
| 120 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/foo2/folder/42.js
"); | 124 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/foo2/folder/42.js
"); |
| 121 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/foo/index.htm
l"); | 125 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/foo/index.htm
l"); |
| 122 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/index.html"); | 126 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/index.html"); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 141 removeFileSystem(fileSystemMapping, paths.BAR) | 145 removeFileSystem(fileSystemMapping, paths.BAR) |
| 142 | 146 |
| 143 InspectorTest.completeTest(); | 147 InspectorTest.completeTest(); |
| 144 } | 148 } |
| 145 </script> | 149 </script> |
| 146 </head> | 150 </head> |
| 147 <body onload="runTest()"> | 151 <body onload="runTest()"> |
| 148 <p>Tests FileSystemMapping</p> | 152 <p>Tests FileSystemMapping</p> |
| 149 </body> | 153 </body> |
| 150 </html> | 154 </html> |
| OLD | NEW |