| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 | 3 |
| 4 | 4 |
| 5 <script src="../../http/tests/inspector/inspector-test.js"></script> | 5 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 6 <script src="../../http/tests/inspector/debugger-test.js"></script> | 6 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 7 <script src="./resources/javascript-outline-dialog.js"></script> | 7 <script src="./resources/javascript-outline-dialog.js"></script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 function test() | 10 function test() |
| 11 { | 11 { |
| 12 InspectorTest.showScriptSource("javascript-outline-dialog.js", onSourceShown
); | 12 InspectorTest.showScriptSource("javascript-outline-dialog.js", onSourceShown
); |
| 13 var provider; |
| 13 function onSourceShown(sourceFrame) | 14 function onSourceShown(sourceFrame) |
| 14 { | 15 { |
| 15 InspectorTest.addSniffer(Sources.JavaScriptOutlineDialog.prototype, "ref
resh", onDialogFulfilled); | 16 InspectorTest.addSniffer(Sources.OutlineQuickOpen.prototype, "refresh",
onQuickOpenFulfilled); |
| 16 UI.panels.sources._sourcesView._showOutlineDialog(); | 17 UI.panels.sources._sourcesView._showOutlineQuickOpen(); |
| 17 } | 18 } |
| 18 | 19 |
| 19 function onDialogFulfilled() | 20 function onQuickOpenFulfilled() |
| 20 { | 21 { |
| 22 provider = this; |
| 21 dumpScores("te"); | 23 dumpScores("te"); |
| 22 dumpScores("test"); | 24 dumpScores("test"); |
| 23 dumpScores("test("); | 25 dumpScores("test("); |
| 24 dumpScores("test(arg"); | 26 dumpScores("test(arg"); |
| 25 InspectorTest.completeTest(); | 27 InspectorTest.completeTest(); |
| 26 } | 28 } |
| 27 | 29 |
| 28 function dumpScores(query) | 30 function dumpScores(query) |
| 29 { | 31 { |
| 30 InspectorTest.addResult(`Scores for query="${query}"`); | 32 InspectorTest.addResult(`Scores for query="${query}"`); |
| 31 var dialog = Sources.JavaScriptOutlineDialog._instanceForTests; | |
| 32 var keys = []; | 33 var keys = []; |
| 33 for (var i = 0; i < dialog.itemCount(); ++i) { | 34 for (var i = 0; i < provider.itemCount(); ++i) { |
| 34 keys.push({ | 35 keys.push({ |
| 35 key: dialog.itemKeyAt(i), | 36 key: provider.itemKeyAt(i), |
| 36 score: dialog.itemScoreAt(i, query) | 37 score: provider.itemScoreAt(i, query) |
| 37 }); | 38 }); |
| 38 } | 39 } |
| 39 keys.sort((a,b) => b.score - a.score); | 40 keys.sort((a,b) => b.score - a.score); |
| 40 InspectorTest.addResult(keys.map(a => a.key + " " + a.score).join("\n"))
; | 41 InspectorTest.addResult(keys.map(a => a.key + " " + a.score).join("\n"))
; |
| 41 InspectorTest.addResult(""); | 42 InspectorTest.addResult(""); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 </script> | 46 </script> |
| 46 | 47 |
| 47 </head> | 48 </head> |
| 48 | 49 |
| 49 <body onload="runTest()"> | 50 <body onload="runTest()"> |
| 50 <p>Verify JavaScriptOutlineDialog scoring.</p> | 51 <p>Verify JavaScriptOutlineDialog scoring.</p> |
| 51 </body> | 52 </body> |
| 52 </html> | 53 </html> |
| OLD | NEW |