OLD | NEW |
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 GEN('#include "chrome/test/data/webui/history_ui_browsertest.h"'); | 5 GEN('#include "chrome/test/data/webui/history_ui_browsertest.h"'); |
6 | 6 |
7 /** @const */ var TOTAL_RESULT_COUNT = 160; | 7 /** @const */ var TOTAL_RESULT_COUNT = 160; |
8 /** @const */ var WAIT_TIMEOUT = 200; | 8 /** @const */ var WAIT_TIMEOUT = 200; |
9 | 9 |
10 /** | 10 /** |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 expectEquals(entryDate.getYear(), date.getYear()); | 410 expectEquals(entryDate.getYear(), date.getYear()); |
411 expectEquals(entryDate.getMonth(), date.getMonth()); | 411 expectEquals(entryDate.getMonth(), date.getMonth()); |
412 expectEquals(entryDate.getDay(), date.getDay()); | 412 expectEquals(entryDate.getDay(), date.getDay()); |
413 expectEquals(entryDate.getHours(), date.getHours()); | 413 expectEquals(entryDate.getHours(), date.getHours()); |
414 expectEquals(entryDate.getMinutes(), date.getMinutes()); | 414 expectEquals(entryDate.getMinutes(), date.getMinutes()); |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 // Check that there are 3 page navigation links and that only the "Older" | 418 // Check that there are 3 page navigation links and that only the "Older" |
419 // link is visible. | 419 // link is visible. |
420 expectEquals(3, document.querySelectorAll('.link-button').length); | 420 expectEquals(3, document.querySelectorAll('[is="action-link"]').length); |
421 expectTrue($('newest-button').hidden); | 421 expectTrue($('newest-button').hidden); |
422 expectTrue($('newer-button').hidden); | 422 expectTrue($('newer-button').hidden); |
423 expectFalse($('older-button').hidden); | 423 expectFalse($('older-button').hidden); |
424 | 424 |
425 ensureTimeWidthsEqual(); | 425 ensureTimeWidthsEqual(); |
426 | 426 |
427 // Go to the next page. | 427 // Go to the next page. |
428 $('older-button').click(); | 428 $('older-button').click(); |
429 waitForCallback('historyResult', function() { | 429 waitForCallback('historyResult', function() { |
430 resultCount += document.querySelectorAll('.entry').length; | 430 resultCount += document.querySelectorAll('.entry').length; |
431 | 431 |
432 // Check that the two pages include all of the entries. | 432 // Check that the two pages include all of the entries. |
433 expectEquals(TOTAL_RESULT_COUNT, resultCount); | 433 expectEquals(TOTAL_RESULT_COUNT, resultCount); |
434 | 434 |
435 // Check that the day header was properly continued -- the header for the | 435 // Check that the day header was properly continued -- the header for the |
436 // last day on the first page should be a substring of the header on the | 436 // last day on the first page should be a substring of the header on the |
437 // second page. E.g. "Wed, Oct 8, 2008" and "Web, Oct 8, 2008 - cont'd". | 437 // second page. E.g. "Wed, Oct 8, 2008" and "Web, Oct 8, 2008 - cont'd". |
438 var newDayHeaders = document.querySelectorAll('.day'); | 438 var newDayHeaders = document.querySelectorAll('.day'); |
439 expectEquals(1, newDayHeaders.length); | 439 expectEquals(1, newDayHeaders.length); |
440 expectEquals(0, | 440 expectEquals(0, |
441 newDayHeaders[0].textContent.indexOf(dayHeaders[1].textContent)); | 441 newDayHeaders[0].textContent.indexOf(dayHeaders[1].textContent)); |
442 | 442 |
443 // Check that the "Newest" and "Newer" links are now visible, but the | 443 // Check that the "Newest" and "Newer" links are now visible, but the |
444 // "Older" link is hidden. | 444 // "Older" link is hidden. |
445 expectEquals(3, document.querySelectorAll('.link-button').length); | 445 expectEquals(3, document.querySelectorAll('[is="action-link"]').length); |
446 expectFalse($('newest-button').hidden); | 446 expectFalse($('newest-button').hidden); |
447 expectFalse($('newer-button').hidden); | 447 expectFalse($('newer-button').hidden); |
448 expectTrue($('older-button').hidden); | 448 expectTrue($('older-button').hidden); |
449 | 449 |
450 ensureTimeWidthsEqual(); | 450 ensureTimeWidthsEqual(); |
451 | 451 |
452 // Go back to the first page, and check that the same day headers are there. | 452 // Go back to the first page, and check that the same day headers are there. |
453 $('newest-button').click(); | 453 $('newest-button').click(); |
454 var newDayHeaders = document.querySelectorAll('.day'); | 454 var newDayHeaders = document.querySelectorAll('.day'); |
455 expectEquals(2, newDayHeaders.length); | 455 expectEquals(2, newDayHeaders.length); |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 */ | 777 */ |
778 TEST_F('HistoryWebUIRealBackendTest', 'basic', function() { | 778 TEST_F('HistoryWebUIRealBackendTest', 'basic', function() { |
779 // Check that there are two days of entries, and three entries in total. | 779 // Check that there are two days of entries, and three entries in total. |
780 assertEquals(2, document.querySelectorAll('.day').length); | 780 assertEquals(2, document.querySelectorAll('.day').length); |
781 assertEquals(3, document.querySelectorAll('.entry').length); | 781 assertEquals(3, document.querySelectorAll('.entry').length); |
782 | 782 |
783 testDone(); | 783 testDone(); |
784 }); | 784 }); |
785 | 785 |
786 TEST_F('HistoryWebUIRealBackendTest', 'atLeastOneFocusable', function() { | 786 TEST_F('HistoryWebUIRealBackendTest', 'atLeastOneFocusable', function() { |
787 expectEquals(1, document.querySelectorAll('[tabindex="0"]').length); | 787 var results = document.querySelectorAll('#results-display [tabindex="0"]'); |
| 788 expectEquals(1, results.length); |
788 testDone(); | 789 testDone(); |
789 }); | 790 }); |
790 | 791 |
791 TEST_F('HistoryWebUIRealBackendTest', 'deleteRemovesEntry', function() { | 792 TEST_F('HistoryWebUIRealBackendTest', 'deleteRemovesEntry', function() { |
792 assertTrue(historyModel.deletingHistoryAllowed); | 793 assertTrue(historyModel.deletingHistoryAllowed); |
793 | 794 |
794 var visit = document.querySelector('.entry').visit; | 795 var visit = document.querySelector('.entry').visit; |
795 visit.titleLink.focus(); | 796 visit.titleLink.focus(); |
796 assertEquals(visit.titleLink, document.activeElement); | 797 assertEquals(visit.titleLink, document.activeElement); |
797 | 798 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 expectTrue(removeButton.disabled); | 938 expectTrue(removeButton.disabled); |
938 | 939 |
939 // The "Remove from history" drop-down item should be disabled. | 940 // The "Remove from history" drop-down item should be disabled. |
940 var removeVisit = $('remove-visit'); | 941 var removeVisit = $('remove-visit'); |
941 expectTrue(removeVisit.disabled); | 942 expectTrue(removeVisit.disabled); |
942 | 943 |
943 testDone(); | 944 testDone(); |
944 }); | 945 }); |
945 | 946 |
946 TEST_F('HistoryWebUIDeleteProhibitedTest', 'atLeastOneFocusable', function() { | 947 TEST_F('HistoryWebUIDeleteProhibitedTest', 'atLeastOneFocusable', function() { |
947 expectEquals(1, document.querySelectorAll('[tabindex="0"]').length); | 948 var results = document.querySelectorAll('#results-display [tabindex="0"]'); |
| 949 expectEquals(1, results.length); |
948 testDone(); | 950 testDone(); |
949 }); | 951 }); |
950 | 952 |
951 TEST_F('HistoryWebUIDeleteProhibitedTest', 'leftRightChangeFocus', function() { | 953 TEST_F('HistoryWebUIDeleteProhibitedTest', 'leftRightChangeFocus', function() { |
952 var visit = document.querySelector('.entry').visit; | 954 var visit = document.querySelector('.entry').visit; |
953 visit.titleLink.focus(); | 955 visit.titleLink.focus(); |
954 assertEquals(visit.titleLink, document.activeElement); | 956 assertEquals(visit.titleLink, document.activeElement); |
955 | 957 |
956 var right = document.createEvent('KeyboardEvent'); | 958 var right = document.createEvent('KeyboardEvent'); |
957 right.initKeyboardEvent('keydown', true, true, window, 'Right'); | 959 right.initKeyboardEvent('keydown', true, true, window, 'Right'); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() { | 1055 TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() { |
1054 // Switch to the week view. | 1056 // Switch to the week view. |
1055 $('timeframe-controls').querySelectorAll('input')[1].click(); | 1057 $('timeframe-controls').querySelectorAll('input')[1].click(); |
1056 waitForCallback('historyResult', function() { | 1058 waitForCallback('historyResult', function() { |
1057 // Each URL should be organized under a different "domain". | 1059 // Each URL should be organized under a different "domain". |
1058 expectEquals(document.querySelectorAll('.entry').length, 4); | 1060 expectEquals(document.querySelectorAll('.entry').length, 4); |
1059 expectEquals(document.querySelectorAll('.site-domain-wrapper').length, 4); | 1061 expectEquals(document.querySelectorAll('.site-domain-wrapper').length, 4); |
1060 testDone(); | 1062 testDone(); |
1061 }); | 1063 }); |
1062 }); | 1064 }); |
OLD | NEW |