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 src="../../http/tests/inspector/sources-test.js"></script> | 4 <script src="../../http/tests/inspector/sources-test.js"></script> |
5 <script src="../resources/example-fileset-for-test.js"></script> | 5 <script src="../resources/example-fileset-for-test.js"></script> |
6 <script> | 6 <script> |
7 function test() | 7 function test() |
8 { | 8 { |
9 const TestQueries = [ | 9 const TestQueries = [ |
10 ["textepl", "./Source/devtools/front_end/TextEditor.pl"], | 10 ["textepl", "./Source/devtools/front_end/TextEditor.pl"], |
(...skipping 27 matching lines...) Expand all Loading... |
38 ], "execontext", "dom/ExecutionContext.cpp"); | 38 ], "execontext", "dom/ExecutionContext.cpp"); |
39 | 39 |
40 InspectorTest.completeTest(); | 40 InspectorTest.completeTest(); |
41 } | 41 } |
42 | 42 |
43 function runQuery(paths, query, expected) | 43 function runQuery(paths, query, expected) |
44 { | 44 { |
45 var scorer = new Sources.FilePathScoreFunction(query); | 45 var scorer = new Sources.FilePathScoreFunction(query); |
46 var bestScore = -1; | 46 var bestScore = -1; |
47 var bestIndex = -1; | 47 var bestIndex = -1; |
48 var filter = UI.FilteredListWidget.filterRegex(query); | 48 var filter = QuickOpen.FilteredListWidget.filterRegex(query); |
49 for(var i = 0; i < paths.length; ++i) { | 49 for(var i = 0; i < paths.length; ++i) { |
50 if (!filter.test(paths[i])) | 50 if (!filter.test(paths[i])) |
51 continue; | 51 continue; |
52 var score = scorer.score(paths[i]); | 52 var score = scorer.score(paths[i]); |
53 if (score > bestScore) { | 53 if (score > bestScore) { |
54 bestScore = score; | 54 bestScore = score; |
55 bestIndex = i; | 55 bestIndex = i; |
56 } | 56 } |
57 } | 57 } |
58 var result = "\n=== Test query: " + query; | 58 var result = "\n=== Test query: " + query; |
(...skipping 25 matching lines...) Expand all Loading... |
84 result += "<"; | 84 result += "<"; |
85 return result + " (score: " + score + ")"; | 85 return result + " (score: " + score + ")"; |
86 } | 86 } |
87 }; | 87 }; |
88 </script> | 88 </script> |
89 </head> | 89 </head> |
90 <body onload="runTest()"> | 90 <body onload="runTest()"> |
91 <p>Test file path scoring function</p> | 91 <p>Test file path scoring function</p> |
92 </body> | 92 </body> |
93 </html> | 93 </html> |
OLD | NEW |