OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../http/tests/inspector/console-test.js"></script> | |
5 <script> | |
6 function populateConsoleWithMessages() | |
7 { | |
8 console.log("FIRST MATCH, SECOND MATCH"); | |
9 for (var i = 0; i < 200; ++i) | |
10 console.log("Message #" + i); | |
11 console.log("LAST MATCH"); | |
12 runTest(); | |
13 } | |
14 | |
15 function test() | |
16 { | |
17 function addResult(result) | |
18 { | |
19 viewport.refresh(); | |
20 InspectorTest.addResult(result); | |
21 } | |
22 | |
23 // Make sure to produce test output in case test times out | |
24 setTimeout(InspectorTest.completeTest.bind(InspectorTest), 2000); | |
25 | |
26 var consoleView = WebInspector.ConsolePanel._view(); | |
27 var viewport = consoleView._viewport; | |
28 const maximumViewportMessagesCount = 150; | |
29 InspectorTest.runTestSuite([ | |
30 function assertViewportHeight(next) | |
31 { | |
32 viewport.invalidate(); | |
33 var viewportMessagesCount = viewport._lastVisibleIndex - viewport._f irstVisibleIndex; | |
34 if (viewportMessagesCount > maximumViewportMessagesCount) { | |
35 InspectorTest.addResult(String.sprintf( | |
36 "Test cannot be run because viewport can fit %d messages, whil e %d is the test's maximum.", | |
37 viewportMessagesCount, maximumViewportMessagesCount)); | |
38 InspectorTest.completeTest(); | |
39 return; | |
40 } | |
41 next(); | |
42 }, | |
43 | |
44 function scrollConsoleToTop(next) | |
45 { | |
46 viewport.forceScrollItemToBeFirst(0); | |
47 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
48 next(); | |
49 }, | |
50 | |
51 function testFindMatches(next) | |
lushnikov
2014/11/07 16:27:16
Could you please group all the tests into a single
aknudsen
2014/11/08 12:00:52
Ah, will do, thanks for the suggestion.
aknudsen
2014/11/09 00:09:46
When considering merging tests, I thought about ho
| |
52 { | |
53 consoleView._searchableView._searchInputElement.value = "MATCH"; | |
54 consoleView._searchableView.showSearchField(); | |
55 | |
56 // Start out at the first match | |
57 consoleView._searchableView.handleFindNextShortcut(); | |
58 | |
59 // Find last match | |
60 consoleView._searchableView.handleFindPreviousShortcut(); | |
61 addResult("last visible message index: " + viewport.lastVisibleIndex ()); | |
62 | |
63 // Find second match | |
64 consoleView._searchableView.handleFindPreviousShortcut(); | |
65 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
66 | |
67 // Find first match | |
68 consoleView._searchableView.handleFindPreviousShortcut(); | |
69 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
70 next(); | |
71 } | |
72 ]); | |
73 } | |
74 </script> | |
75 </head> | |
76 <body onload="populateConsoleWithMessages()"> | |
77 <p> | |
78 Tests that console can jump backward between search matches in response to f ind previous command. | |
79 </p> | |
80 </body> | |
81 </html> | |
OLD | NEW |