| 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 BUILD: "file:///home/username/project/build", |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 var entries = fileSystemMapping.mappingEntries(fileSystemPaths[i]); | 80 var entries = fileSystemMapping.mappingEntries(fileSystemPaths[i]); |
| 81 for (var j = 0; j < entries.length; ++j) { | 81 for (var j = 0; j < entries.length; ++j) { |
| 82 var entry = entries[j]; | 82 var entry = entries[j]; |
| 83 InspectorTest.addResult(" - " + JSON.stringify(entri
es[j])); | 83 InspectorTest.addResult(" - " + JSON.stringify(entri
es[j])); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 InspectorTest.addResult(""); | 86 InspectorTest.addResult(""); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // At first create file system mapping and clear it. | 89 // At first create file system mapping and clear it. |
| 90 var fileSystemMapping = new WebInspector.FileSystemMapping(); | 90 var fileSystemMapping = new Workspace.FileSystemMapping(); |
| 91 var fileSystemPaths = Object.keys(fileSystemMapping._fileSystemMappings); | 91 var fileSystemPaths = Object.keys(fileSystemMapping._fileSystemMappings); |
| 92 for (var i = 0; i < fileSystemPaths.length; ++i) | 92 for (var i = 0; i < fileSystemPaths.length; ++i) |
| 93 fileSystemMapping.removeFileSystem(fileSystemPaths[i]); | 93 fileSystemMapping.removeFileSystem(fileSystemPaths[i]); |
| 94 | 94 |
| 95 // Now fill it with file systems. | 95 // Now fill it with file systems. |
| 96 checkAndDumpFileSystemMapping(fileSystemMapping); | 96 checkAndDumpFileSystemMapping(fileSystemMapping); |
| 97 addFileSystem(fileSystemMapping, paths.FOO) | 97 addFileSystem(fileSystemMapping, paths.FOO) |
| 98 addFileSystem(fileSystemMapping, paths.BAR) | 98 addFileSystem(fileSystemMapping, paths.BAR) |
| 99 addFileSystem(fileSystemMapping, paths.BUILD) | 99 addFileSystem(fileSystemMapping, paths.BUILD) |
| 100 addFileSystem(fileSystemMapping, paths.SITE1) | 100 addFileSystem(fileSystemMapping, paths.SITE1) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 123 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/foo/folder/42.js"
); | 123 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/foo/folder/42.js"
); |
| 124 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/foo2/folder/42.js
"); | 124 dumpURLForPath(fileSystemMapping, paths.FOO, paths.FOO + "/foo2/folder/42.js
"); |
| 125 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/foo/index.htm
l"); | 125 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/foo/index.htm
l"); |
| 126 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/index.html"); | 126 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/index.html"); |
| 127 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/foo"); | 127 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/foo"); |
| 128 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/foo/"); | 128 dumpURLForPath(fileSystemMapping, paths.SITE1, paths.SITE1 + "/foo/"); |
| 129 InspectorTest.addResult(""); | 129 InspectorTest.addResult(""); |
| 130 | 130 |
| 131 // Then create another file mapping to make sure it is correctly restored fr
om the settings. | 131 // Then create another file mapping to make sure it is correctly restored fr
om the settings. |
| 132 InspectorTest.addResult("Creating another file system mapping."); | 132 InspectorTest.addResult("Creating another file system mapping."); |
| 133 var fileSystemMapping = new WebInspector.FileSystemMapping(); | 133 var fileSystemMapping = new Workspace.FileSystemMapping(); |
| 134 checkAndDumpFileSystemMapping(fileSystemMapping); | 134 checkAndDumpFileSystemMapping(fileSystemMapping); |
| 135 | 135 |
| 136 // Now remove file mappings. | 136 // Now remove file mappings. |
| 137 removeMappingForURL(fileSystemMapping, "http://www.bar.com/foo/folder/42.js"
); | 137 removeMappingForURL(fileSystemMapping, "http://www.bar.com/foo/folder/42.js"
); |
| 138 removeFileMapping(fileSystemMapping, paths.SITE1, "http://localhost/", "/"); | 138 removeFileMapping(fileSystemMapping, paths.SITE1, "http://localhost/", "/"); |
| 139 removeFileMapping(fileSystemMapping, paths.SITE1, "http://www.foo.com/", "/f
oo/"); | 139 removeFileMapping(fileSystemMapping, paths.SITE1, "http://www.foo.com/", "/f
oo/"); |
| 140 removeFileMapping(fileSystemMapping, paths.FOO, "http://www.example.com/bar/
", "/foo/"); | 140 removeFileMapping(fileSystemMapping, paths.FOO, "http://www.example.com/bar/
", "/foo/"); |
| 141 | 141 |
| 142 // Now remove file systems. | 142 // Now remove file systems. |
| 143 removeFileSystem(fileSystemMapping, paths.SITE1) | 143 removeFileSystem(fileSystemMapping, paths.SITE1) |
| 144 removeFileSystem(fileSystemMapping, paths.FOO) | 144 removeFileSystem(fileSystemMapping, paths.FOO) |
| 145 removeFileSystem(fileSystemMapping, paths.BAR) | 145 removeFileSystem(fileSystemMapping, paths.BAR) |
| 146 | 146 |
| 147 InspectorTest.completeTest(); | 147 InspectorTest.completeTest(); |
| 148 } | 148 } |
| 149 </script> | 149 </script> |
| 150 </head> | 150 </head> |
| 151 <body onload="runTest()"> | 151 <body onload="runTest()"> |
| 152 <p>Tests FileSystemMapping</p> | 152 <p>Tests FileSystemMapping</p> |
| 153 </body> | 153 </body> |
| 154 </html> | 154 </html> |
| OLD | NEW |