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

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

Issue 685783003: history: fix more focus oddness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: arv@ review Created 6 years, 1 month 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 | « chrome/browser/resources/history/history.js ('k') | ui/webui/resources/js/cr/ui/focus_grid.js » ('j') | 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 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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 assertFalse($('history-page').contains(document.activeElement)); 902 assertFalse($('history-page').contains(document.activeElement));
903 903
904 waitForCallback('deleteComplete', testDone); 904 waitForCallback('deleteComplete', testDone);
905 905
906 var enter = document.createEvent('KeyboardEvent'); 906 var enter = document.createEvent('KeyboardEvent');
907 enter.initKeyboardEvent('keydown', true, true, window, 'Enter'); 907 enter.initKeyboardEvent('keydown', true, true, window, 'Enter');
908 document.dispatchEvent(enter); 908 document.dispatchEvent(enter);
909 assertFalse($('alertOverlay').classList.contains('showing')); 909 assertFalse($('alertOverlay').classList.contains('showing'));
910 }); 910 });
911 911
912 TEST_F('HistoryWebUIRealBackendTest', 'menuButtonActivatesOneRow', function() {
913 var entries = document.querySelectorAll('.entry');
914 assertEquals(3, entries.length);
915 assertTrue(entries[0].classList.contains('active'));
916 assertTrue($('action-menu').hidden);
917
918 // Show the menu via mousedown on the menu button.
919 var menuButton = entries[2].querySelector('.menu-button');
920 menuButton.dispatchEvent(new MouseEvent('mousedown'));
921 expectFalse($('action-menu').hidden);
922
923 // Check that the 'active' item hasn't changed.
924 expectTrue(entries[0].classList.contains('active'));
925 expectFalse(entries[2].classList.contains('active'));
926
927 testDone();
928 });
929
930 TEST_F('HistoryWebUIRealBackendTest', 'shiftClickActivatesOneRow', function() {
931 var entries = document.querySelectorAll('.entry');
932 assertEquals(3, entries.length);
933 assertTrue(entries[0].classList.contains('active'));
934
935 entries[0].visit.checkBox.focus();
936 assertEquals(entries[0].visit.checkBox, document.activeElement);
937
938 entries[0].visit.checkBox.click();
939 assertTrue(entries[0].visit.checkBox.checked);
940
941 var entryBox = entries[2].querySelector('.entry-box');
942 entryBox.dispatchEvent(new MouseEvent('click', {shiftKey: true}));
943 assertTrue(entries[1].visit.checkBox.checked);
944
945 // Focus shouldn't have changed, but the checkbox should toggle.
946 expectEquals(entries[0].visit.checkBox, document.activeElement);
947
948 expectTrue(entries[0].classList.contains('active'));
949 expectFalse(entries[2].classList.contains('active'));
950
951 var shiftDown = new MouseEvent('mousedown', {shiftKey: true, bubbles: true});
952 entries[2].visit.checkBox.dispatchEvent(shiftDown);
953 expectEquals(entries[2].visit.checkBox, document.activeElement);
954
955 // 'focusin' events aren't dispatched while tests are run in batch (e.g.
956 // --test-launcher-jobs=2). Simulate this. TODO(dbeam): fix instead.
957 cr.dispatchSimpleEvent(document.activeElement, 'focusin', true, true);
958
959 expectFalse(entries[0].classList.contains('active'));
960 expectTrue(entries[2].classList.contains('active'));
961
962 testDone();
963 });
964
912 /** 965 /**
913 * Fixture for History WebUI testing when deletions are prohibited. 966 * Fixture for History WebUI testing when deletions are prohibited.
914 * @extends {HistoryWebUIRealBackendTest} 967 * @extends {HistoryWebUIRealBackendTest}
915 * @constructor 968 * @constructor
916 */ 969 */
917 function HistoryWebUIDeleteProhibitedTest() {} 970 function HistoryWebUIDeleteProhibitedTest() {}
918 971
919 HistoryWebUIDeleteProhibitedTest.prototype = { 972 HistoryWebUIDeleteProhibitedTest.prototype = {
920 __proto__: HistoryWebUIRealBackendTest.prototype, 973 __proto__: HistoryWebUIRealBackendTest.prototype,
921 974
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() { 1108 TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() {
1056 // Switch to the week view. 1109 // Switch to the week view.
1057 $('timeframe-controls').querySelectorAll('input')[1].click(); 1110 $('timeframe-controls').querySelectorAll('input')[1].click();
1058 waitForCallback('historyResult', function() { 1111 waitForCallback('historyResult', function() {
1059 // Each URL should be organized under a different "domain". 1112 // Each URL should be organized under a different "domain".
1060 expectEquals(document.querySelectorAll('.entry').length, 4); 1113 expectEquals(document.querySelectorAll('.entry').length, 4);
1061 expectEquals(document.querySelectorAll('.site-domain-wrapper').length, 4); 1114 expectEquals(document.querySelectorAll('.site-domain-wrapper').length, 4);
1062 testDone(); 1115 testDone();
1063 }); 1116 });
1064 }); 1117 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/history/history.js ('k') | ui/webui/resources/js/cr/ui/focus_grid.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698