3 <script src=
"../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../http/tests/inspector/sources-test.js"></script>
5 <script src=
"./resources/example-fileset-for-test.js"></script>
10 ["textepl", "./Source/devtools/front_end/TextEditor.pl"],
11 ["defted", "./Source/devtools/front_end/DefaultTextEditor.pl"],
12 ["CMTE", "./Source/devtools/front_end/CodeMirrorTextEditor.pl"],
13 ["frocmte", "./Source/devtools/front_end/CodeMirrorTextEditor.pl"],
14 ["cmtepl", "./Source/devtools/front_end/CodeMirrorTextEditor.pl"],
15 ["setscr", "./Source/devtools/front_end/SettingsScreen.pl"],
16 ["cssnfv", "./Source/devtools/front_end/CSSNamedFlowView.pl"],
17 ["jssf", "./Source/devtools/front_end/JavaScriptSourceFrame.pl"],
18 ["sofrapl", "./Source/devtools/front_end/SourceFrame.pl"],
19 ["inspeins", "./Source/core/inspector/InspectorInstrumentation.bpp"],
20 ["froscr", "./Source/devtools/front_end/Script.pl"],
21 ["adscon", "./Source/devtools/front_end/AdvancedSearchController.pl"]
23 InspectorTest
.evaluateInPage("blinkFilePaths()", step1
);
24 InspectorTest
.addResult("Expected score must be equal to the actual score");
26 function step1(filePaths
)
28 var files
= filePaths
.value
.split(":");
29 InspectorTest
.addResult("Test set size: " + files
.length
);
30 for(var i
= 0; i
< TestQueries
.length
; ++i
) {
31 runQuery(files
, TestQueries
[i
][0], TestQueries
[i
][1]);
35 "svg/SVGTextRunRenderingContext.cpp",
36 "dom/ExecutionContext.cpp",
37 "testing/NullExecutionContext.cpp"
38 ], "execontext", "dom/ExecutionContext.cpp");
40 InspectorTest
.completeTest();
43 function runQuery(paths
, query
, expected
)
45 var scorer
= new WebInspector
.FilePathScoreFunction(query
);
48 var filter
= WebInspector
.FilePathScoreFunction
.filterRegex(query
);
49 for(var i
= 0; i
< paths
.length
; ++i
) {
50 if (!filter
.test(paths
[i
]))
52 var score
= scorer
.score(paths
[i
]);
53 if (score
> bestScore
) {
58 var result
= "\n=== Test query: " + query
;
59 result
+= "\n expected return: " + render(scorer
, expected
);
60 result
+= "\n actual return: " + render(scorer
, paths
[bestIndex
]);
61 InspectorTest
.addResult(result
);
64 function render(scorer
, value
)
67 var score
= scorer
.score(value
, indexes
);
70 for(var i
= 0; i
< value
.length
; ++i
) {
71 if (indexes
.indexOf(i
) !== -1) {
85 return result
+ " (score: " + score
+ ")";
90 <body onload=
"runTest()">
91 <p>Test file path scoring function
</p>