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

Side by Side Diff: LayoutTests/inspector/console/console-viewport-selection.html

Issue 564893002: DevTools: [Console] fix selection of all console messages (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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-viewport-selection-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
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(count) 6 function populateConsoleWithMessages(count)
7 { 7 {
8 for (var i = 0; i < count - 1; ++i) 8 for (var i = 0; i < count - 1; ++i)
9 console.log("Message #" + i); 9 console.log("Message #" + i);
10 console.log("hello %cworld", "color: blue"); 10 console.log("hello %cworld", "color: blue");
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 var lastMessageElement = viewport.renderedElementAt(messagesCount - 1); 155 var lastMessageElement = viewport.renderedElementAt(messagesCount - 1);
156 // there is a blue-colored "world" span in last message. 156 // there is a blue-colored "world" span in last message.
157 var blueSpan = lastMessageElement; 157 var blueSpan = lastMessageElement;
158 while (blueSpan.nodeName !== "SPAN" || blueSpan.textContent !== "wor ld") 158 while (blueSpan.nodeName !== "SPAN" || blueSpan.textContent !== "wor ld")
159 blueSpan = blueSpan.traverseNextNode(); 159 blueSpan = blueSpan.traverseNextNode();
160 160
161 window.getSelection().setBaseAndExtent(blueSpan, 0, blueSpan, blueSp an.textContent.length); 161 window.getSelection().setBaseAndExtent(blueSpan, 0, blueSpan, blueSp an.textContent.length);
162 InspectorTest.addResult("Selected text: " + viewport._selectedText() ); 162 InspectorTest.addResult("Selected text: " + viewport._selectedText() );
163 next(); 163 next();
164 }, 164 },
165
166 function testSelectAll(next)
167 {
168 viewport.forceScrollItemToBeFirst(0);
169
170 // Set some initial selection in console.
171 var base = consoleView.itemElement(messagesCount - 2);
172 var extent = consoleView.itemElement(messagesCount - 1);
173 window.getSelection().setBaseAndExtent(base, 0, extent, 0);
174
175 // Try to select all messages.
176 document.execCommand("selectAll");
177
178 var text = viewport._selectedText();
179 var count = text ? text.split("\n").length : 0;
180 InspectorTest.addResult(count === messagesCount ? "Selected all " + count + " messages." : "Selected " + count + " messages instead of " + messagesC ount);
181 next();
182 }
165 ]; 183 ];
166 184
167 var awaitingMessagesCount = messagesCount; 185 var awaitingMessagesCount = messagesCount;
168 function messageAdded() 186 function messageAdded()
169 { 187 {
170 if (!--awaitingMessagesCount) 188 if (!--awaitingMessagesCount)
171 InspectorTest.runTestSuite(testSuite); 189 InspectorTest.runTestSuite(testSuite);
172 } 190 }
173 191
174 InspectorTest.addConsoleSniffer(messageAdded, true); 192 InspectorTest.addConsoleSniffer(messageAdded, true);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 269 }
252 } 270 }
253 </script> 271 </script>
254 </head> 272 </head>
255 <body onload="runTest()"> 273 <body onload="runTest()">
256 <p> 274 <p>
257 Tests that console viewport handles selection properly. 275 Tests that console viewport handles selection properly.
258 </p> 276 </p>
259 </body> 277 </body>
260 </html> 278 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/console/console-viewport-selection-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698