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

Side by Side Diff: chrome/test/data/webui/history_browsertest.js

Issue 12217015: History: Fix selecting multiple visits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A test and minor fix. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/history/history.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** @const */ var TOTAL_RESULT_COUNT = 160; 5 /** @const */ var TOTAL_RESULT_COUNT = 160;
6 /** @const */ var WAIT_TIMEOUT = 200; 6 /** @const */ var WAIT_TIMEOUT = 200;
7 7
8 /** 8 /**
9 * Create a fake history result with the given timestamp. 9 * Create a fake history result with the given timestamp.
10 * @param {Number} timestamp Timestamp of the entry, in ms since the epoch. 10 * @param {Number} timestamp Timestamp of the entry, in ms since the epoch.
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 var nextEntry = document.querySelectorAll('.title a')[3]; 309 var nextEntry = document.querySelectorAll('.title a')[3];
310 removeButton.click(); 310 removeButton.click();
311 waitForCallback('historyResult', function() { 311 waitForCallback('historyResult', function() {
312 // The next entry after the deleted ones should now be the first. 312 // The next entry after the deleted ones should now be the first.
313 expectEquals(document.querySelector('.title a').textContent, 313 expectEquals(document.querySelector('.title a').textContent,
314 nextEntry.textContent); 314 nextEntry.textContent);
315 testDone(); 315 testDone();
316 }); 316 });
317 }); 317 });
318 }); 318 });
319
320 /**
321 * Test selecting multiple entries using shift click.
322 */
323 TEST_F('HistoryWebUITest', 'multipleSelect', function() {
324 var checkboxes = document.querySelectorAll(
325 '#results-display input[type=checkbox]');
326
327 // Make sure that nothing is checked.
328 for (var i = 0; i < checkboxes.length; i++)
329 expectFalse(checkboxes[i].checked);
Patrick Dubroy 2013/02/05 20:43:14 You could also do this with: expectEqual(docume
Sergiu 2013/02/06 10:52:34 Done, expectFalse doesn't actually work as it seem
330
331 var getNewEvent = function() {
Patrick Dubroy 2013/02/05 20:43:14 Nit: maybe name this getClickEvent?
Sergiu 2013/02/06 10:52:34 Made it getShiftClickEvent to make it clearer.
332 return new MouseEvent('click', { shiftKey: true });
333 };
334
335 // Check the start.
336 $('checkbox-4').dispatchEvent(getNewEvent());
337 // And the end.
338 $('checkbox-9').dispatchEvent(getNewEvent());
339
340 // See if they are checked.
341 for (var i = 0; i < checkboxes.length; i++) {
342 if (i >= 4 && i <= 9)
Patrick Dubroy 2013/02/05 20:43:14 Again, you could use querySelectorAll('input[type=
Sergiu 2013/02/06 10:52:34 Just for thoroughness I would like to check the id
343 expectTrue(checkboxes[i].checked);
344 else
345 expectFalse(checkboxes[i].checked);
346 }
347
348 // Extend the selection.
349 $('checkbox-14').dispatchEvent(getNewEvent());
350
351 for (var i = 0; i < checkboxes.length; i++) {
Patrick Dubroy 2013/02/05 20:43:14 Same here.
Sergiu 2013/02/06 10:52:34 Done.
352 if (i >= 4 && i <= 14)
353 expectTrue(checkboxes[i].checked);
354 else
355 expectFalse(checkboxes[i].checked);
356 }
357
358 // Now do a normal click on a higher ID box and a shift click on a lower ID
359 // one (test the other way around).
360 $('checkbox-24').click();
361 $('checkbox-19').dispatchEvent(getNewEvent());
362
363 for (var i = 0; i < checkboxes.length; i++) {
364 if ((i >= 4 && i <= 14) || (i >= 19 && i <=24))
365 expectTrue(checkboxes[i].checked);
366 else
367 expectFalse(checkboxes[i].checked);
368 }
369
Patrick Dubroy 2013/02/05 20:43:14 One more test I would add: $('checkbox-26').cli
Sergiu 2013/02/06 10:52:34 Done.
370 testDone();
371 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/history/history.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698