Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: LayoutTests/inspector/console/console-search-can-jump-backward-between-matches.html

Issue 676193002: Navigate between individual search matches in DevTools console (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Add tests Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/console/console-search-can-jump-backward-between-matches.html
diff --git a/LayoutTests/inspector/console/console-search-can-jump-backward-between-matches.html b/LayoutTests/inspector/console/console-search-can-jump-backward-between-matches.html
new file mode 100644
index 0000000000000000000000000000000000000000..d41e14d52a026962b0d3bc10f6ab68a237919694
--- /dev/null
+++ b/LayoutTests/inspector/console/console-search-can-jump-backward-between-matches.html
@@ -0,0 +1,81 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/console-test.js"></script>
+<script>
+function populateConsoleWithMessages()
+{
+ console.log("FIRST MATCH, SECOND MATCH");
+ for (var i = 0; i < 200; ++i)
+ console.log("Message #" + i);
+ 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 assertViewportHeight(next)
+ {
+ viewport.invalidate();
+ var viewportMessagesCount = viewport._lastVisibleIndex - viewport._firstVisibleIndex;
+ if (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;
+ }
+ next();
+ },
+
+ function scrollConsoleToTop(next)
+ {
+ viewport.forceScrollItemToBeFirst(0);
+ addResult("first visible message index: " + viewport.firstVisibleIndex());
+ next();
+ },
+
+ 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
+ {
+ consoleView._searchableView._searchInputElement.value = "MATCH";
+ consoleView._searchableView.showSearchField();
+
+ // Start out at the first match
+ consoleView._searchableView.handleFindNextShortcut();
+
+ // Find last match
+ consoleView._searchableView.handleFindPreviousShortcut();
+ addResult("last visible message index: " + viewport.lastVisibleIndex());
+
+ // Find second match
+ consoleView._searchableView.handleFindPreviousShortcut();
+ addResult("first visible message index: " + viewport.firstVisibleIndex());
+
+ // Find first match
+ consoleView._searchableView.handleFindPreviousShortcut();
+ addResult("first visible message index: " + viewport.firstVisibleIndex());
+ next();
+ }
+ ]);
+}
+</script>
+</head>
+<body onload="populateConsoleWithMessages()">
+<p>
+ Tests that console can jump backward between search matches in response to find previous command.
+</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698