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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 */ | 771 */ |
772 TEST_F('HistoryWebUIRealBackendTest', 'basic', function() { | 772 TEST_F('HistoryWebUIRealBackendTest', 'basic', function() { |
773 // Check that there are two days of entries, and three entries in total. | 773 // Check that there are two days of entries, and three entries in total. |
774 assertEquals(2, document.querySelectorAll('.day').length); | 774 assertEquals(2, document.querySelectorAll('.day').length); |
775 assertEquals(3, document.querySelectorAll('.entry').length); | 775 assertEquals(3, document.querySelectorAll('.entry').length); |
776 | 776 |
777 testDone(); | 777 testDone(); |
778 }); | 778 }); |
779 | 779 |
780 TEST_F('HistoryWebUIRealBackendTest', 'atLeastOneFocusable', function() { | 780 TEST_F('HistoryWebUIRealBackendTest', 'atLeastOneFocusable', function() { |
781 assertEquals(1, document.querySelectorAll('[tabindex="0"]').length); | 781 expectEquals(1, document.querySelectorAll('[tabindex="0"]').length); |
782 testDone(); | 782 testDone(); |
783 }); | 783 }); |
784 | 784 |
785 /** | 785 /** |
786 * Test individual deletion of history entries. | 786 * Test individual deletion of history entries. |
787 */ | 787 */ |
788 TEST_F('HistoryWebUIRealBackendTest', 'singleDeletion', function() { | 788 TEST_F('HistoryWebUIRealBackendTest', 'singleDeletion', function() { |
789 // Deletes the history entry represented by |entryElement|, and calls callback | 789 // Deletes the history entry represented by |entryElement|, and calls callback |
790 // when the deletion is complete. | 790 // when the deletion is complete. |
791 var removeEntry = function(entryElement, callback) { | 791 var removeEntry = function(entryElement, callback) { |
(...skipping 28 matching lines...) Expand all Loading... |
820 expectEquals(1, document.querySelectorAll('.day').length); | 820 expectEquals(1, document.querySelectorAll('.day').length); |
821 | 821 |
822 // Delete another entry. The original third entry should now be the first. | 822 // Delete another entry. The original third entry should now be the first. |
823 removeEntry(document.querySelector('.entry'), function() { | 823 removeEntry(document.querySelector('.entry'), function() { |
824 expectEquals(thirdTitle, document.querySelector('.entry a').textContent); | 824 expectEquals(thirdTitle, document.querySelector('.entry a').textContent); |
825 testDone(); | 825 testDone(); |
826 }); | 826 }); |
827 }); | 827 }); |
828 }); | 828 }); |
829 | 829 |
| 830 TEST_F('HistoryWebUIRealBackendTest', 'leftRightChangeFocus', function() { |
| 831 var visit = document.querySelector('.entry').visit; |
| 832 visit.titleLink.focus(); |
| 833 assertEquals(visit.titleLink, document.activeElement); |
| 834 |
| 835 var right = document.createEvent('KeyboardEvent'); |
| 836 right.initKeyboardEvent('keydown', true, true, window, 'Right'); |
| 837 assertEquals('Right', right.keyIdentifier); |
| 838 expectFalse(visit.titleLink.dispatchEvent(right)); |
| 839 |
| 840 assertEquals(visit.dropDown, document.activeElement); |
| 841 |
| 842 var left = document.createEvent('KeyboardEvent'); |
| 843 left.initKeyboardEvent('keydown', true, true, window, 'Left'); |
| 844 assertEquals('Left', left.keyIdentifier); |
| 845 expectFalse(visit.dropDown.dispatchEvent(left)); |
| 846 |
| 847 expectEquals(visit.titleLink, document.activeElement); |
| 848 testDone(); |
| 849 }); |
| 850 |
830 /** | 851 /** |
831 * Fixture for History WebUI testing when deletions are prohibited. | 852 * Fixture for History WebUI testing when deletions are prohibited. |
832 * @extends {HistoryWebUIRealBackendTest} | 853 * @extends {HistoryWebUIRealBackendTest} |
833 * @constructor | 854 * @constructor |
834 */ | 855 */ |
835 function HistoryWebUIDeleteProhibitedTest() {} | 856 function HistoryWebUIDeleteProhibitedTest() {} |
836 | 857 |
837 HistoryWebUIDeleteProhibitedTest.prototype = { | 858 HistoryWebUIDeleteProhibitedTest.prototype = { |
838 __proto__: HistoryWebUIRealBackendTest.prototype, | 859 __proto__: HistoryWebUIRealBackendTest.prototype, |
839 | 860 |
(...skipping 21 matching lines...) Expand all Loading... |
861 | 882 |
862 // Attempting to remove items anyway should fail. | 883 // Attempting to remove items anyway should fail. |
863 historyModel.removeVisitsFromHistory(historyModel.visits_, function () { | 884 historyModel.removeVisitsFromHistory(historyModel.visits_, function () { |
864 // The callback is only called on success. | 885 // The callback is only called on success. |
865 testDone([false, 'Delete succeeded even though it was prohibited.']); | 886 testDone([false, 'Delete succeeded even though it was prohibited.']); |
866 }); | 887 }); |
867 waitForCallback('deleteFailed', testDone); | 888 waitForCallback('deleteFailed', testDone); |
868 }); | 889 }); |
869 | 890 |
870 TEST_F('HistoryWebUIDeleteProhibitedTest', 'atLeastOneFocusable', function() { | 891 TEST_F('HistoryWebUIDeleteProhibitedTest', 'atLeastOneFocusable', function() { |
871 assertEquals(1, document.querySelectorAll('[tabindex="0"]').length); | 892 expectEquals(1, document.querySelectorAll('[tabindex="0"]').length); |
872 testDone(); | 893 testDone(); |
873 }); | 894 }); |
874 | 895 |
| 896 TEST_F('HistoryWebUIDeleteProhibitedTest', 'leftRightChangeFocus', function() { |
| 897 var visit = document.querySelector('.entry').visit; |
| 898 visit.titleLink.focus(); |
| 899 assertEquals(visit.titleLink, document.activeElement); |
| 900 |
| 901 var right = document.createEvent('KeyboardEvent'); |
| 902 right.initKeyboardEvent('keydown', true, true, window, 'Right'); |
| 903 assertEquals('Right', right.keyIdentifier); |
| 904 expectFalse(visit.titleLink.dispatchEvent(right)); |
| 905 |
| 906 assertEquals(visit.dropDown, document.activeElement); |
| 907 |
| 908 var left = document.createEvent('KeyboardEvent'); |
| 909 left.initKeyboardEvent('keydown', true, true, window, 'Left'); |
| 910 assertEquals('Left', left.keyIdentifier); |
| 911 expectFalse(visit.dropDown.dispatchEvent(left)); |
| 912 |
| 913 expectEquals(visit.titleLink, document.activeElement); |
| 914 testDone(); |
| 915 }); |
| 916 |
875 /** | 917 /** |
876 * Fixture for History WebUI testing IDN. | 918 * Fixture for History WebUI testing IDN. |
877 * @extends {BaseHistoryWebUITest} | 919 * @extends {BaseHistoryWebUITest} |
878 * @constructor | 920 * @constructor |
879 */ | 921 */ |
880 function HistoryWebUIIDNTest() {} | 922 function HistoryWebUIIDNTest() {} |
881 | 923 |
882 HistoryWebUIIDNTest.prototype = { | 924 HistoryWebUIIDNTest.prototype = { |
883 __proto__: BaseHistoryWebUITest.prototype, | 925 __proto__: BaseHistoryWebUITest.prototype, |
884 | 926 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() { | 978 TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() { |
937 // Switch to the week view. | 979 // Switch to the week view. |
938 $('timeframe-filter-week').click(); | 980 $('timeframe-filter-week').click(); |
939 waitForCallback('historyResult', function() { | 981 waitForCallback('historyResult', function() { |
940 // Each URL should be organized under a different "domain". | 982 // Each URL should be organized under a different "domain". |
941 expectEquals(document.querySelectorAll('.entry').length, 4); | 983 expectEquals(document.querySelectorAll('.entry').length, 4); |
942 expectEquals(document.querySelectorAll('.site-domain-wrapper').length, 4); | 984 expectEquals(document.querySelectorAll('.site-domain-wrapper').length, 4); |
943 testDone(); | 985 testDone(); |
944 }); | 986 }); |
945 }); | 987 }); |
OLD | NEW |