Index: LayoutTests/inspector/console/console-search-can-jump-forward-between-matches.html |
diff --git a/LayoutTests/inspector/console/console-search-reveals-messages.html b/LayoutTests/inspector/console/console-search-can-jump-forward-between-matches.html |
similarity index 50% |
copy from LayoutTests/inspector/console/console-search-reveals-messages.html |
copy to LayoutTests/inspector/console/console-search-can-jump-forward-between-matches.html |
index f057e77abf12888cc045da1306fac44be02e2baa..38ca285d3383b51eb723d45bbc697ad0d2f8172c 100644 |
--- a/LayoutTests/inspector/console/console-search-reveals-messages.html |
+++ b/LayoutTests/inspector/console/console-search-can-jump-forward-between-matches.html |
@@ -5,24 +5,36 @@ |
<script> |
function populateConsoleWithMessages() |
{ |
+ console.log("FIRST MATCH, SECOND MATCH"); |
for (var i = 0; i < 200; ++i) |
console.log("Message #" + i); |
- console.log("LAST MESSAGE"); |
+ console.log("LAST MATCH"); |
runTest(); |
} |
function test() |
{ |
+ function addResult(result) |
+ { |
+ viewport.refresh(); |
+ InspectorTest.addResult(result); |
+ } |
+ |
+ // Make sure to produce test output in case test times out |
+ setTimeout(InspectorTest.completeTest.bind(InspectorTest), 2000); |
+ |
var consoleView = WebInspector.ConsolePanel._view(); |
var viewport = consoleView._viewport; |
const maximumViewportMessagesCount = 150; |
InspectorTest.runTestSuite([ |
- function verifyViewportIsTallEnough(next) |
+ function assertViewportHeight(next) |
{ |
viewport.invalidate(); |
var viewportMessagesCount = viewport._lastVisibleIndex - viewport._firstVisibleIndex; |
if (viewportMessagesCount > maximumViewportMessagesCount) { |
- InspectorTest.addResult(String.sprintf("Test cannot be run because viewport could fit %d messages which is more then maxiumum of %d.", viewportMessagesCount, maximumViewportMessagesCount)); |
+ InspectorTest.addResult(String.sprintf( |
+ "Test cannot be run because viewport can fit %d messages, while %d is the test's maximum.", |
+ viewportMessagesCount, maximumViewportMessagesCount)); |
InspectorTest.completeTest(); |
return; |
} |
@@ -32,37 +44,35 @@ function test() |
function scrollConsoleToTop(next) |
{ |
viewport.forceScrollItemToBeFirst(0); |
- dumpTop(); |
+ addResult("first visible message index: " + viewport.firstVisibleIndex()); |
next(); |
}, |
- function testFindLastMessage(next) |
+ function testFindMatches(next) |
{ |
- consoleView._searchableView._searchInputElement.value = "LAST MESSAGE"; |
+ consoleView._searchableView._searchInputElement.value = "MATCH"; |
consoleView._searchableView.showSearchField(); |
+ |
+ // Find first match |
+ consoleView._searchableView.handleFindNextShortcut(); |
+ addResult("first visible message index: " + viewport.firstVisibleIndex()); |
+ |
+ // Find second match |
+ consoleView._searchableView.handleFindNextShortcut(); |
+ addResult("first visible message index: " + viewport.firstVisibleIndex()); |
+ |
+ // Find last match |
consoleView._searchableView.handleFindNextShortcut(); |
- dumpBottom(); |
+ addResult("last visible message index: " + viewport.lastVisibleIndex()); |
next(); |
} |
]); |
- |
- function dumpTop() |
- { |
- viewport.refresh(); |
- InspectorTest.addResult("first visible message index: " + viewport.firstVisibleIndex()); |
- } |
- |
- function dumpBottom() |
- { |
- viewport.refresh(); |
- InspectorTest.addResult("last visible message index: " + viewport.lastVisibleIndex()); |
- } |
} |
</script> |
</head> |
<body onload="populateConsoleWithMessages()"> |
<p> |
- Tests that console viewport reveals messages on searching. |
+ Tests that console can jump forward between search matches when clicking the find next button. |
</p> |
</body> |
</html> |