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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 * are all the same width. | 359 * are all the same width. |
360 */ | 360 */ |
361 function ensureTimeWidthsEqual() { | 361 function ensureTimeWidthsEqual() { |
362 var times = document.querySelectorAll('.entry .time'); | 362 var times = document.querySelectorAll('.entry .time'); |
363 var timeWidth = times[0].clientWidth; | 363 var timeWidth = times[0].clientWidth; |
364 for (var i = 1; i < times.length; ++i) { | 364 for (var i = 1; i < times.length; ++i) { |
365 assertEquals(timeWidth, times[i].clientWidth); | 365 assertEquals(timeWidth, times[i].clientWidth); |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 TEST_F('HistoryWebUIFakeBackendTest', 'emptyHistory', function() { | 369 // Times out on Mac: http://crbug.com/336845 |
hcarmona
2015/03/06 19:01:14
Why not disable only on the failing platform?
GEN
| |
370 TEST_F('HistoryWebUIFakeBackendTest', 'DISABLED_emptyHistory', function() { | |
370 expectTrue($('newest-button').hidden); | 371 expectTrue($('newest-button').hidden); |
371 expectTrue($('newer-button').hidden); | 372 expectTrue($('newer-button').hidden); |
372 expectTrue($('older-button').hidden); | 373 expectTrue($('older-button').hidden); |
373 testDone(); | 374 testDone(); |
374 }); | 375 }); |
375 | 376 |
376 // Times out on Win: http://crbug.com/336845 | 377 // Times out on Win: http://crbug.com/336845 |
377 TEST_F('HistoryWebUITest', 'DISABLED_basicTest', function() { | 378 TEST_F('HistoryWebUITest', 'DISABLED_basicTest', function() { |
378 var resultCount = document.querySelectorAll('.entry').length; | 379 var resultCount = document.querySelectorAll('.entry').length; |
379 | 380 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
696 // than or equal to the number of visits from the previous domain. | 697 // than or equal to the number of visits from the previous domain. |
697 var domainEntries = element.querySelectorAll('.number-visits'); | 698 var domainEntries = element.querySelectorAll('.number-visits'); |
698 var currentNumberOfVisits = getNumberVisits(domainEntries[0]); | 699 var currentNumberOfVisits = getNumberVisits(domainEntries[0]); |
699 for (var j = 1; j < domainEntries.length; j++) { | 700 for (var j = 1; j < domainEntries.length; j++) { |
700 var numberOfVisits = getNumberVisits(domainEntries[j]); | 701 var numberOfVisits = getNumberVisits(domainEntries[j]); |
701 assertTrue(currentNumberOfVisits >= numberOfVisits); | 702 assertTrue(currentNumberOfVisits >= numberOfVisits); |
702 currentNumberOfVisits = numberOfVisits; | 703 currentNumberOfVisits = numberOfVisits; |
703 } | 704 } |
704 } | 705 } |
705 | 706 |
706 TEST_F('RangeHistoryWebUITest', 'weekViewGrouped', function() { | 707 // Times out on Mac and Win: http://crbug.com/336845 |
hcarmona
2015/03/06 19:01:14
Similarly here:
GEN('#if defined(OS_MACOSX) || de
| |
708 TEST_F('RangeHistoryWebUITest', 'DISABLED_weekViewGrouped', function() { | |
707 // Change to weekly view. | 709 // Change to weekly view. |
708 setPageState('', 0, HistoryModel.Range.WEEK, 0); | 710 setPageState('', 0, HistoryModel.Range.WEEK, 0); |
709 waitForCallback('historyResult', function() { | 711 waitForCallback('historyResult', function() { |
710 // See if the correct number of days is still shown. | 712 // See if the correct number of days is still shown. |
711 var dayResults = document.querySelectorAll('.day-results'); | 713 var dayResults = document.querySelectorAll('.day-results'); |
712 assertEquals(7, dayResults.length); | 714 assertEquals(7, dayResults.length); |
713 | 715 |
714 // Check whether the results are ordered by visits. | 716 // Check whether the results are ordered by visits. |
715 for (var i = 0; i < dayResults.length; i++) | 717 for (var i = 0; i < dayResults.length; i++) |
716 checkGroupedVisits(dayResults[i]); | 718 checkGroupedVisits(dayResults[i]); |
717 | 719 |
718 ensureTimeWidthsEqual(); | 720 ensureTimeWidthsEqual(); |
719 | 721 |
720 testDone(); | 722 testDone(); |
721 }); | 723 }); |
722 }); | 724 }); |
723 | 725 |
724 TEST_F('RangeHistoryWebUITest', 'monthViewGrouped', function() { | 726 // Times out on Mac and Win: http://crbug.com/336845 |
727 TEST_F('RangeHistoryWebUITest', 'DISABLED_monthViewGrouped', function() { | |
725 // Change to monthly view. | 728 // Change to monthly view. |
726 setPageState('', 0, HistoryModel.Range.MONTH, 0); | 729 setPageState('', 0, HistoryModel.Range.MONTH, 0); |
727 waitForCallback('historyResult', function() { | 730 waitForCallback('historyResult', function() { |
728 // See if the correct number of days is shown. | 731 // See if the correct number of days is shown. |
729 var monthResults = document.querySelectorAll('.month-results'); | 732 var monthResults = document.querySelectorAll('.month-results'); |
730 assertEquals(1, monthResults.length); | 733 assertEquals(1, monthResults.length); |
731 | 734 |
732 checkGroupedVisits(monthResults[0]); | 735 checkGroupedVisits(monthResults[0]); |
733 ensureTimeWidthsEqual(); | 736 ensureTimeWidthsEqual(); |
734 | 737 |
735 testDone(); | 738 testDone(); |
736 }); | 739 }); |
737 }); | 740 }); |
738 | 741 |
739 TEST_F('RangeHistoryWebUITest', 'monthViewEmptyMonth', function() { | 742 // Times out on Mac: http://crbug.com/336845 |
743 TEST_F('RangeHistoryWebUITest', 'DISABLED_monthViewEmptyMonth', function() { | |
740 // Change to monthly view. | 744 // Change to monthly view. |
741 setPageState('', 0, HistoryModel.Range.MONTH, 2); | 745 setPageState('', 0, HistoryModel.Range.MONTH, 2); |
742 | 746 |
743 waitForCallback('historyResult', function() { | 747 waitForCallback('historyResult', function() { |
744 // See if the correct number of days is shown. | 748 // See if the correct number of days is shown. |
745 var resultsDisplay = $('results-display'); | 749 var resultsDisplay = $('results-display'); |
746 assertEquals(0, resultsDisplay.querySelectorAll('.months-results').length); | 750 assertEquals(0, resultsDisplay.querySelectorAll('.months-results').length); |
747 var noResults = loadTimeData.getString('noResults'); | 751 var noResults = loadTimeData.getString('noResults'); |
748 assertNotEquals(-1, $('results-header').textContent.indexOf(noResults)); | 752 assertNotEquals(-1, $('results-header').textContent.indexOf(noResults)); |
749 | 753 |
(...skipping 20 matching lines...) Expand all Loading... | |
770 | 774 |
771 // Add a visit on the next day. | 775 // Add a visit on the next day. |
772 GEN(' AddPageToHistory(36, "http://google.com", "Google");'); | 776 GEN(' AddPageToHistory(36, "http://google.com", "Google");'); |
773 }, | 777 }, |
774 }; | 778 }; |
775 | 779 |
776 /** | 780 /** |
777 * Simple test that verifies that the correct entries are retrieved from the | 781 * Simple test that verifies that the correct entries are retrieved from the |
778 * history database and displayed in the UI. | 782 * history database and displayed in the UI. |
779 */ | 783 */ |
780 TEST_F('HistoryWebUIRealBackendTest', 'basic', function() { | 784 // Times out on Mac and Win: http://crbug.com/336845 |
785 TEST_F('HistoryWebUIRealBackendTest', 'DISABLED_basic', function() { | |
781 // Check that there are two days of entries, and three entries in total. | 786 // Check that there are two days of entries, and three entries in total. |
782 assertEquals(2, document.querySelectorAll('.day').length); | 787 assertEquals(2, document.querySelectorAll('.day').length); |
783 assertEquals(3, document.querySelectorAll('.entry').length); | 788 assertEquals(3, document.querySelectorAll('.entry').length); |
784 | 789 |
785 testDone(); | 790 testDone(); |
786 }); | 791 }); |
787 | 792 |
788 TEST_F('HistoryWebUIRealBackendTest', 'atLeastOneFocusable', function() { | 793 // Times out on Mac: http://crbug.com/336845 |
794 TEST_F('HistoryWebUIRealBackendTest', | |
795 'DISABLED_atLeastOneFocusable', function() { | |
789 var results = document.querySelectorAll('#results-display [tabindex="0"]'); | 796 var results = document.querySelectorAll('#results-display [tabindex="0"]'); |
790 expectGE(results.length, 1); | 797 expectGE(results.length, 1); |
791 testDone(); | 798 testDone(); |
792 }); | 799 }); |
793 | 800 |
794 TEST_F('HistoryWebUIRealBackendTest', 'deleteRemovesEntry', function() { | 801 // Times out on Mac: http://crbug.com/336845 |
802 TEST_F('HistoryWebUIRealBackendTest', | |
803 'DISABLED_deleteRemovesEntry', function() { | |
795 assertTrue(historyModel.deletingHistoryAllowed); | 804 assertTrue(historyModel.deletingHistoryAllowed); |
796 | 805 |
797 var visit = document.querySelector('.entry').visit; | 806 var visit = document.querySelector('.entry').visit; |
798 visit.titleLink.focus(); | 807 visit.titleLink.focus(); |
799 assertEquals(visit.titleLink, document.activeElement); | 808 assertEquals(visit.titleLink, document.activeElement); |
800 | 809 |
801 var deleteKey = document.createEvent('KeyboardEvent'); | 810 var deleteKey = document.createEvent('KeyboardEvent'); |
802 deleteKey.initKeyboardEvent('keydown', true, true, window, 'U+007F'); | 811 deleteKey.initKeyboardEvent('keydown', true, true, window, 'U+007F'); |
803 assertEquals('U+007F', deleteKey.keyIdentifier); | 812 assertEquals('U+007F', deleteKey.keyIdentifier); |
804 | 813 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 assertFalse($('history-page').contains(document.activeElement)); | 916 assertFalse($('history-page').contains(document.activeElement)); |
908 | 917 |
909 waitForCallback('deleteComplete', testDone); | 918 waitForCallback('deleteComplete', testDone); |
910 | 919 |
911 var enter = document.createEvent('KeyboardEvent'); | 920 var enter = document.createEvent('KeyboardEvent'); |
912 enter.initKeyboardEvent('keydown', true, true, window, 'Enter'); | 921 enter.initKeyboardEvent('keydown', true, true, window, 'Enter'); |
913 document.documentElement.dispatchEvent(enter); | 922 document.documentElement.dispatchEvent(enter); |
914 assertFalse($('alertOverlay').classList.contains('showing')); | 923 assertFalse($('alertOverlay').classList.contains('showing')); |
915 }); | 924 }); |
916 | 925 |
917 TEST_F('HistoryWebUIRealBackendTest', 'menuButtonActivatesOneRow', function() { | 926 // Times out on Mac: http://crbug.com/336845 |
927 TEST_F('HistoryWebUIRealBackendTest', | |
928 'DISABLED_menuButtonActivatesOneRow', function() { | |
918 var entries = document.querySelectorAll('.entry'); | 929 var entries = document.querySelectorAll('.entry'); |
919 assertEquals(3, entries.length); | 930 assertEquals(3, entries.length); |
920 assertTrue(entries[0].classList.contains('active')); | 931 assertTrue(entries[0].classList.contains('active')); |
921 assertTrue($('action-menu').hidden); | 932 assertTrue($('action-menu').hidden); |
922 | 933 |
923 // Show the menu via mousedown on the menu button. | 934 // Show the menu via mousedown on the menu button. |
924 var menuButton = entries[2].querySelector('.menu-button'); | 935 var menuButton = entries[2].querySelector('.menu-button'); |
925 menuButton.dispatchEvent(new MouseEvent('mousedown')); | 936 menuButton.dispatchEvent(new MouseEvent('mousedown')); |
926 expectFalse($('action-menu').hidden); | 937 expectFalse($('action-menu').hidden); |
927 | 938 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
978 __proto__: HistoryWebUIRealBackendTest.prototype, | 989 __proto__: HistoryWebUIRealBackendTest.prototype, |
979 | 990 |
980 /** @override */ | 991 /** @override */ |
981 testGenPreamble: function() { | 992 testGenPreamble: function() { |
982 HistoryWebUIRealBackendTest.prototype.testGenPreamble.call(this); | 993 HistoryWebUIRealBackendTest.prototype.testGenPreamble.call(this); |
983 GEN(' SetDeleteAllowed(false);'); | 994 GEN(' SetDeleteAllowed(false);'); |
984 }, | 995 }, |
985 }; | 996 }; |
986 | 997 |
987 // Test UI when removing entries is prohibited. | 998 // Test UI when removing entries is prohibited. |
988 TEST_F('HistoryWebUIDeleteProhibitedTest', 'deleteProhibited', function() { | 999 // Times out on Mac: http://crbug.com/336845 |
1000 TEST_F('HistoryWebUIDeleteProhibitedTest', | |
1001 'DISABLED_deleteProhibited', function() { | |
989 // No checkboxes should be created. | 1002 // No checkboxes should be created. |
990 var checkboxes = document.querySelectorAll( | 1003 var checkboxes = document.querySelectorAll( |
991 '#results-display input[type=checkbox]'); | 1004 '#results-display input[type=checkbox]'); |
992 expectEquals(0, checkboxes.length); | 1005 expectEquals(0, checkboxes.length); |
993 | 1006 |
994 // The "remove" button should be disabled. | 1007 // The "remove" button should be disabled. |
995 var removeButton = $('remove-selected'); | 1008 var removeButton = $('remove-selected'); |
996 expectTrue(removeButton.disabled); | 1009 expectTrue(removeButton.disabled); |
997 | 1010 |
998 // The "Remove from history" drop-down item should be disabled. | 1011 // The "Remove from history" drop-down item should be disabled. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1066 | 1079 |
1067 // Clear AcceptLanguages to get domain in unicode. | 1080 // Clear AcceptLanguages to get domain in unicode. |
1068 GEN(' ClearAcceptLanguages();'); | 1081 GEN(' ClearAcceptLanguages();'); |
1069 }, | 1082 }, |
1070 }; | 1083 }; |
1071 | 1084 |
1072 /** | 1085 /** |
1073 * Simple test that verifies that the correct entries are retrieved from the | 1086 * Simple test that verifies that the correct entries are retrieved from the |
1074 * history database and displayed in the UI. | 1087 * history database and displayed in the UI. |
1075 */ | 1088 */ |
1076 TEST_F('HistoryWebUIIDNTest', 'basic', function() { | 1089 // Times out on Mac: http://crbug.com/336845 |
1090 TEST_F('HistoryWebUIIDNTest', 'DISABLED_basic', function() { | |
1077 // Check that there is only one entry and domain is in unicode. | 1091 // Check that there is only one entry and domain is in unicode. |
1078 assertEquals(1, document.querySelectorAll('.domain').length); | 1092 assertEquals(1, document.querySelectorAll('.domain').length); |
1079 assertEquals("\u043f\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442." + | 1093 assertEquals("\u043f\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442." + |
1080 "\u0440\u0444", document.querySelector('.domain').textContent); | 1094 "\u0440\u0444", document.querySelector('.domain').textContent); |
1081 | 1095 |
1082 testDone(); | 1096 testDone(); |
1083 }); | 1097 }); |
1084 | 1098 |
1085 /** | 1099 /** |
1086 * Fixture for a test that uses the real backend and tests how the history | 1100 * Fixture for a test that uses the real backend and tests how the history |
(...skipping 26 matching lines...) Expand all Loading... | |
1113 TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() { | 1127 TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() { |
1114 // Switch to the week view. | 1128 // Switch to the week view. |
1115 $('timeframe-controls').querySelectorAll('input')[1].click(); | 1129 $('timeframe-controls').querySelectorAll('input')[1].click(); |
1116 waitForCallback('historyResult', function() { | 1130 waitForCallback('historyResult', function() { |
1117 // Each URL should be organized under a different "domain". | 1131 // Each URL should be organized under a different "domain". |
1118 expectEquals(document.querySelectorAll('.entry').length, 4); | 1132 expectEquals(document.querySelectorAll('.entry').length, 4); |
1119 expectEquals(document.querySelectorAll('.site-domain-wrapper').length, 4); | 1133 expectEquals(document.querySelectorAll('.site-domain-wrapper').length, 4); |
1120 testDone(); | 1134 testDone(); |
1121 }); | 1135 }); |
1122 }); | 1136 }); |
OLD | NEW |