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

Side by Side Diff: LayoutTests/inspector/console/console-search-can-jump-forward-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 unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script> 4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script> 5 <script>
6 function populateConsoleWithMessages() 6 function populateConsoleWithMessages()
7 { 7 {
8 console.log("FIRST MATCH, SECOND MATCH");
8 for (var i = 0; i < 200; ++i) 9 for (var i = 0; i < 200; ++i)
9 console.log("Message #" + i); 10 console.log("Message #" + i);
10 console.log("LAST MESSAGE"); 11 console.log("LAST MATCH");
11 runTest(); 12 runTest();
12 } 13 }
13 14
14 function test() 15 function test()
15 { 16 {
17 function addResult(result)
18 {
19 viewport.refresh();
20 InspectorTest.addResult(result);
21 }
22
23 // Make sure to produce test output in case test times out
24 setTimeout(InspectorTest.completeTest.bind(InspectorTest), 2000);
25
16 var consoleView = WebInspector.ConsolePanel._view(); 26 var consoleView = WebInspector.ConsolePanel._view();
17 var viewport = consoleView._viewport; 27 var viewport = consoleView._viewport;
18 const maximumViewportMessagesCount = 150; 28 const maximumViewportMessagesCount = 150;
19 InspectorTest.runTestSuite([ 29 InspectorTest.runTestSuite([
20 function verifyViewportIsTallEnough(next) 30 function assertViewportHeight(next)
21 { 31 {
22 viewport.invalidate(); 32 viewport.invalidate();
23 var viewportMessagesCount = viewport._lastVisibleIndex - viewport._f irstVisibleIndex; 33 var viewportMessagesCount = viewport._lastVisibleIndex - viewport._f irstVisibleIndex;
24 if (viewportMessagesCount > maximumViewportMessagesCount) { 34 if (viewportMessagesCount > maximumViewportMessagesCount) {
25 InspectorTest.addResult(String.sprintf("Test cannot be run becau se viewport could fit %d messages which is more then maxiumum of %d.", viewportM essagesCount, maximumViewportMessagesCount)); 35 InspectorTest.addResult(String.sprintf(
36 "Test cannot be run because viewport can fit %d messages, whil e %d is the test's maximum.",
37 viewportMessagesCount, maximumViewportMessagesCount));
26 InspectorTest.completeTest(); 38 InspectorTest.completeTest();
27 return; 39 return;
28 } 40 }
29 next(); 41 next();
30 }, 42 },
31 43
32 function scrollConsoleToTop(next) 44 function scrollConsoleToTop(next)
33 { 45 {
34 viewport.forceScrollItemToBeFirst(0); 46 viewport.forceScrollItemToBeFirst(0);
35 dumpTop(); 47 addResult("first visible message index: " + viewport.firstVisibleInd ex());
36 next(); 48 next();
37 }, 49 },
38 50
39 function testFindLastMessage(next) 51 function testFindMatches(next)
40 { 52 {
41 consoleView._searchableView._searchInputElement.value = "LAST MESSAG E"; 53 consoleView._searchableView._searchInputElement.value = "MATCH";
42 consoleView._searchableView.showSearchField(); 54 consoleView._searchableView.showSearchField();
55
56 // Find first match
43 consoleView._searchableView.handleFindNextShortcut(); 57 consoleView._searchableView.handleFindNextShortcut();
44 dumpBottom(); 58 addResult("first visible message index: " + viewport.firstVisibleInd ex());
59
60 // Find second match
61 consoleView._searchableView.handleFindNextShortcut();
62 addResult("first visible message index: " + viewport.firstVisibleInd ex());
63
64 // Find last match
65 consoleView._searchableView.handleFindNextShortcut();
66 addResult("last visible message index: " + viewport.lastVisibleIndex ());
45 next(); 67 next();
46 } 68 }
47 ]); 69 ]);
48
49 function dumpTop()
50 {
51 viewport.refresh();
52 InspectorTest.addResult("first visible message index: " + viewport.first VisibleIndex());
53 }
54
55 function dumpBottom()
56 {
57 viewport.refresh();
58 InspectorTest.addResult("last visible message index: " + viewport.lastVi sibleIndex());
59 }
60 } 70 }
61 </script> 71 </script>
62 </head> 72 </head>
63 <body onload="populateConsoleWithMessages()"> 73 <body onload="populateConsoleWithMessages()">
64 <p> 74 <p>
65 Tests that console viewport reveals messages on searching. 75 Tests that console can jump forward between search matches when clicking the find next button.
66 </p> 76 </p>
67 </body> 77 </body>
68 </html> 78 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698