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

Side by Side 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: Synchronize with origin Created 5 years, 11 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector/console/console-search-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 var a = {};
12 for (var i = 0; i < 200; ++i)
13 a["field_" + i] = "value #" + i;
14 console.dir(a);
15 console.log("LAST MATCH");
16 runTest();
17 }
18
19 function test()
20 {
21 function addResult(result)
22 {
23 viewport.refresh();
24 InspectorTest.addResult(result);
25 }
26
27 function setQuery(text)
28 {
29 consoleView._searchableView._searchInputElement.value = text;
30 consoleView._searchableView.showSearchField();
31 }
32
33 var consoleView = WebInspector.ConsolePanel._view();
34 var viewport = consoleView._viewport;
35 const maximumViewportMessagesCount = 150;
36 InspectorTest.runTestSuite([
37 function assertViewportHeight(next)
38 {
39 viewport.invalidate();
40 var viewportMessagesCount = viewport._lastVisibleIndex - viewport._f irstVisibleIndex;
41 if (viewportMessagesCount > maximumViewportMessagesCount) {
42 InspectorTest.addResult(String.sprintf(
43 "Test cannot be run because viewport can fit %d messages, whil e %d is the test's maximum.",
44 viewportMessagesCount, maximumViewportMessagesCount));
45 InspectorTest.completeTest();
46 return;
47 }
48 next();
49 },
50
51 function scrollConsoleToTop(next)
52 {
53 viewport.forceScrollItemToBeFirst(0);
54 addResult("first visible message index: " + viewport.firstVisibleInd ex());
55 next();
56 },
57
58 function testCanJumpForward(next)
59 {
60 setQuery("MATCH");
61
62 // Find first match.
63 consoleView._searchableView.handleFindNextShortcut();
64 addResult("first visible message index: " + viewport.firstVisibleInd ex());
65
66 // Find second match.
67 consoleView._searchableView.handleFindNextShortcut();
68 addResult("first visible message index: " + viewport.firstVisibleInd ex());
69
70 // Find last match.
71 consoleView._searchableView.handleFindNextShortcut();
72 addResult("last visible message index: " + viewport.lastVisibleIndex ());
73 next();
74 },
75
76 function testCanJumpBackward(next)
77 {
78 setQuery("MATCH");
79
80 // Start out at the first match.
81 consoleView._searchableView.handleFindNextShortcut();
82
83 // Find last match.
84 consoleView._searchableView.handleFindPreviousShortcut();
85 addResult("last visible message index: " + viewport.lastVisibleIndex ());
86
87 // Find second match.
88 consoleView._searchableView.handleFindPreviousShortcut();
89 addResult("first visible message index: " + viewport.firstVisibleInd ex());
90
91 // Find first match.
92 consoleView._searchableView.handleFindPreviousShortcut();
93 addResult("first visible message index: " + viewport.firstVisibleInd ex());
94 next();
95 },
96
97 function scrollConsoleToTop(next)
98 {
99 viewport.forceScrollItemToBeFirst(0);
100 addResult("first visible message index: " + viewport.firstVisibleInd ex());
101 next();
102 },
103
104 function testCanMarkCurrentMatch(next)
105 {
106 function addCurrentMarked ()
107 {
108 var matches = document.querySelectorAll(".highlighted-search-res ult");
109 addResult("number of visible matches: " + matches.length);
110 for (var i = 0; i < matches.length; ++i)
111 addResult("match " + i + ": " + matches[i].className);
112 }
113
114 setQuery("MATCH");
115
116 // Find first match.
117 consoleView._searchableView.handleFindNextShortcut();
118 addCurrentMarked();
119
120 // Find second match.
121 consoleView._searchableView.handleFindNextShortcut();
122 addCurrentMarked();
123
124 next();
125 },
126
127 function testCanJumpForwardBetweenTreeElementMatches(next)
128 {
129 InspectorTest.expandConsoleMessages(function()
130 {
131 // Find first match.
132 setQuery("field_1");
133 consoleView._searchableView.handleFindNextShortcut();
134 var currentResultElem = document.querySelector(".current-search- result");
135 addResult("matched tree element: " + currentResultElem.innerHTML );
136
137 // Find last match.
138 setQuery("field_199");
139 consoleView._searchableView.handleFindNextShortcut();
140 currentResultElem = document.querySelector(".current-search-resu lt");
141 addResult("matched tree element: " + currentResultElem.innerHTML );
142
143 next();
144 });
145 }
146 ]);
147 }
148 </script>
149 </head>
150 <body onload="populateConsoleWithMessages()">
151 <p>
152 Tests console search.
153 </p>
154 </body>
155 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/console/console-search-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698