| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <title>Test search in sources.</title> | 3 <title>Test search in sources.</title> |
| 4 <script src="../inspector-test.js"></script> | 4 <script src="../inspector-test.js"></script> |
| 5 <script src="../isolated-filesystem-test.js"></script> | 5 <script src="../isolated-filesystem-test.js"></script> |
| 6 <script src="../workspace-test.js"></script> | |
| 7 <script src="../debugger-test.js"></script> | 6 <script src="../debugger-test.js"></script> |
| 8 <script src="./search-test.js"></script> | 7 <script src="./search-test.js"></script> |
| 9 <script> | 8 <script> |
| 10 function test() | 9 function test() |
| 11 { | 10 { |
| 11 function fileSystemUISourceCodes() |
| 12 { |
| 13 var uiSourceCodes = []; |
| 14 var fileSystemProjects = Workspace.workspace.projectsForType(Workspace.p
rojectTypes.FileSystem); |
| 15 for (var project of fileSystemProjects) |
| 16 uiSourceCodes = uiSourceCodes.concat(project.uiSourceCodes()); |
| 17 return uiSourceCodes; |
| 18 } |
| 19 |
| 12 var scope = new Sources.SourcesSearchScope(); | 20 var scope = new Sources.SourcesSearchScope(); |
| 13 var names = ["search.html", "search.js", "search.css"]; | 21 var names = ["search.html", "search.js", "search.css"]; |
| 14 var fs = new InspectorTest.TestFileSystem("file:///var/www"); | 22 var fs = new InspectorTest.TestFileSystem("file:///var/www"); |
| 15 | 23 |
| 16 var promises = []; | 24 var promises = []; |
| 17 for (var name of names) | 25 for (var name of names) |
| 18 promises.push(populateFileSystem(name)); | 26 promises.push(populateFileSystem(name)); |
| 19 | 27 |
| 20 Promise.all(promises) | 28 Promise.all(promises) |
| 21 .then(onAllResourcesLoaded) | 29 .then(onAllResourcesLoaded) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 InspectorTest.addResult("Running a file query with non-existing
project name now:"); | 180 InspectorTest.addResult("Running a file query with non-existing
project name now:"); |
| 173 query = "searchTest" + "Unique" + " file:zzz"; | 181 query = "searchTest" + "Unique" + " file:zzz"; |
| 174 searchConfig = new Workspace.SearchConfig(query, true, false); | 182 searchConfig = new Workspace.SearchConfig(query, true, false); |
| 175 InspectorTest.runSearchAndDumpResults(scope, searchConfig, true,
next); | 183 InspectorTest.runSearchAndDumpResults(scope, searchConfig, true,
next); |
| 176 } | 184 } |
| 177 }, | 185 }, |
| 178 | 186 |
| 179 function testDirtyFiles(next) | 187 function testDirtyFiles(next) |
| 180 { | 188 { |
| 181 var uiSourceCode; | 189 var uiSourceCode; |
| 182 var uiSourceCodes = InspectorTest.fileSystemUISourceCodes(); | 190 var uiSourceCodes = fileSystemUISourceCodes(); |
| 183 for (var i = 0; i < uiSourceCodes.length; ++i) { | 191 for (var i = 0; i < uiSourceCodes.length; ++i) { |
| 184 if (uiSourceCodes[i].name() === "search.js") { | 192 if (uiSourceCodes[i].name() === "search.js") { |
| 185 uiSourceCode = uiSourceCodes[i]; | 193 uiSourceCode = uiSourceCodes[i]; |
| 186 break; | 194 break; |
| 187 } | 195 } |
| 188 } | 196 } |
| 189 | 197 |
| 190 uiSourceCode.setWorkingCopy("FOO " + "searchTest" + "UniqueString" +
" BAR"); | 198 uiSourceCode.setWorkingCopy("FOO " + "searchTest" + "UniqueString" +
" BAR"); |
| 191 var query = "searchTest" + "UniqueString"; | 199 var query = "searchTest" + "UniqueString"; |
| 192 var searchConfig = new Workspace.SearchConfig(query, true, false); | 200 var searchConfig = new Workspace.SearchConfig(query, true, false); |
| 193 InspectorTest.runSearchAndDumpResults(scope, searchConfig, true, nex
t); | 201 InspectorTest.runSearchAndDumpResults(scope, searchConfig, true, nex
t); |
| 194 } | 202 } |
| 195 ]; | 203 ]; |
| 196 } | 204 } |
| 197 | 205 |
| 198 </script> | 206 </script> |
| 199 </head> | 207 </head> |
| 200 <body onload="runTest()"> | 208 <body onload="runTest()"> |
| 201 <p>Tests that ScriptSearchScope performs search across all sources correctly.</p
> | 209 <p>Tests that ScriptSearchScope performs search across all sources correctly.</p
> |
| 202 See <a href="https://bugs.webkit.org/show_bug.cgi?id=41350">bug 41350</a>. | 210 See <a href="https://bugs.webkit.org/show_bug.cgi?id=41350">bug 41350</a>. |
| 203 </body> | 211 </body> |
| 204 </html> | 212 </html> |
| OLD | NEW |