3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../http/tests/inspector/console-test.js"></script>
6 function populateConsoleWithMessages()
8 for (var i
= 0; i
< 200; ++i
)
9 console
.log("Message #" + i
);
10 console
.log("LAST MESSAGE");
16 var consoleView
= WebInspector
.ConsolePanel
._view();
17 var viewport
= consoleView
._viewport
;
18 const maximumViewportMessagesCount
= 150;
19 InspectorTest
.runTestSuite([
20 function waitForMessages(next
)
22 // NOTE: keep in sync with populateConsoleWithMessages above.
23 const expectedMessageCount
= 201;
24 InspectorTest
.waitForConsoleMessages(expectedMessageCount
, next
);
27 function verifyViewportIsTallEnough(next
)
29 viewport
.invalidate();
30 var viewportMessagesCount
= viewport
._lastVisibleIndex
- viewport
._firstVisibleIndex
;
31 if (viewportMessagesCount
> maximumViewportMessagesCount
) {
32 InspectorTest
.addResult(String
.sprintf("Test cannot be run because viewport could fit %d messages which is more then maxiumum of %d.", viewportMessagesCount
, maximumViewportMessagesCount
));
33 InspectorTest
.completeTest();
39 function scrollConsoleToTop(next
)
41 viewport
.forceScrollItemToBeFirst(0);
46 function testFindLastMessage(next
)
48 InspectorTest
.addSniffer(consoleView
, "_searchFinishedForTests", callback
);
49 consoleView
._searchableView
._searchInputElement
.value
= "LAST MESSAGE";
50 consoleView
._searchableView
.showSearchField();
54 consoleView
._searchableView
.handleFindNextShortcut();
64 InspectorTest
.addResult("first visible message index: " + viewport
.firstVisibleIndex());
70 InspectorTest
.addResult("last visible message index: " + viewport
.lastVisibleIndex());
75 <body onload=
"populateConsoleWithMessages()">
77 Tests that console viewport reveals messages on searching.