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

Unified Diff: LayoutTests/inspector/console/console-search.html

Issue 676193002: Navigate between individual search matches in DevTools console (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Consolidate test suites Created 6 years 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.html
diff --git a/LayoutTests/inspector/console/console-search.html b/LayoutTests/inspector/console/console-search.html
new file mode 100644
index 0000000000000000000000000000000000000000..5eee554475e8b8e021aecd6026c777ee043468a0
--- /dev/null
+++ b/LayoutTests/inspector/console/console-search.html
@@ -0,0 +1,147 @@
+<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);
+ var a = {};
+ for (var i = 0; i < 200; ++i)
+ a["field_" + i] = "value #" + i;
+ console.dir(a);
+ console.log("LAST MATCH");
+ runTest();
+}
+
+function test()
+{
+ function addResult(result)
+ {
+ viewport.refresh();
+ InspectorTest.addResult(result);
+ }
+
+ function setQuery(text)
+ {
+ consoleView._searchableView._searchInputElement.value = text;
+ consoleView._searchableView.showSearchField();
+ }
+
+ 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 testCanJumpForward(next)
+ {
+ setQuery("MATCH");
+
+ // Find first match
lushnikov 2014/12/04 16:07:34 Please terminate all the comments here with period
aknudsen 2014/12/05 22:30:02 Done.
+ 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();
+ addResult("last visible message index: " + viewport.lastVisibleIndex());
+ next();
+ },
+
+ function testCanJumpBackward(next)
+ {
+ setQuery("MATCH");
+
+ // 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();
+ },
+
+ function scrollConsoleToTop(next)
+ {
+ viewport.forceScrollItemToBeFirst(0);
+ addResult("first visible message index: " + viewport.firstVisibleIndex());
+ next();
+ },
+
+ function testCanMarkCurrentMatch(next)
+ {
+ setQuery("MATCH");
+
+ // Find first match
+ consoleView._searchableView.handleFindNextShortcut();
+ addResult(InspectorTest.dumpConsoleMessagesIntoArray(false, true));
lushnikov 2014/12/04 16:07:34 This adds a lot of output which is impossible to r
aknudsen 2014/12/05 22:30:02 Done.
+
+ // Find second match
+ consoleView._searchableView.handleFindNextShortcut();
+ addResult(InspectorTest.dumpConsoleMessagesIntoArray(false, true));
+
+ next();
+ },
+
+ function testCanJumpForwardBetweenTreeElementMatches(next)
+ {
+ InspectorTest.expandConsoleMessages(function()
+ {
+ // Find first match
+ setQuery("field_1");
+ consoleView._searchableView.handleFindNextShortcut();
+ var currentResultElem = document.querySelector(".current-search-result");
+ addResult("matched tree element: " + currentResultElem.innerHTML);
+
+ // Find last match
+ setQuery("field_199");
+ consoleView._searchableView.handleFindNextShortcut();
+ currentResultElem = document.querySelector(".current-search-result");
+ addResult("matched tree element: " + currentResultElem.innerHTML);
+
+ next();
+ });
+ }
+ ]);
+}
+</script>
+</head>
+<body onload="populateConsoleWithMessages()">
+<p>
+ Tests console search.
+</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698