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

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

Issue 11363170: Add an accessibility audit test for WebUI pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Doing accessibility check in javascript, with flags for whether to run a11y checks and whether to t… Created 8 years 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
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 6
7 /** 7 /**
8 * Create a fake history result with the given timestamp. 8 * Create a fake history result with the given timestamp.
9 * @param {Number} timestamp Timestamp of the entry, in ms since the epoch. 9 * @param {Number} timestamp Timestamp of the entry, in ms since the epoch.
10 * @return {Object} An object representing a history entry. 10 * @return {Object} An object representing a history entry.
(...skipping 20 matching lines...) Expand all
31 BaseHistoryWebUITest.prototype = { 31 BaseHistoryWebUITest.prototype = {
32 __proto__: testing.Test.prototype, 32 __proto__: testing.Test.prototype,
33 33
34 /** 34 /**
35 * Browse to the history page & call our preLoad(). 35 * Browse to the history page & call our preLoad().
36 */ 36 */
37 browsePreload: 'chrome://history-frame', 37 browsePreload: 'chrome://history-frame',
38 38
39 isAsync: true, 39 isAsync: true,
40 40
41 runA11yChecks: false,
42 a11yIssuesAreErrors: false,
43
41 /** 44 /**
42 * Register handlers to stub out calls to the history backend. 45 * Register handlers to stub out calls to the history backend.
43 * @override 46 * @override
44 */ 47 */
45 preLoad: function() { 48 preLoad: function() {
46 // Mock4JS doesn't pass in the actual arguments to the stub, but it _will_ 49 // Mock4JS doesn't pass in the actual arguments to the stub, but it _will_
47 // pass the original args to the matcher object. SaveMockArguments acts as 50 // pass the original args to the matcher object. SaveMockArguments acts as
48 // a proxy for another matcher, but keeps track of all the arguments it was 51 // a proxy for another matcher, but keeps track of all the arguments it was
49 // asked to match. 52 // asked to match.
50 var savedArgs = new SaveMockArguments(); 53 var savedArgs = new SaveMockArguments();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 }; 103 };
101 104
102 TEST_F('BaseHistoryWebUITest', 'emptyHistory', function() { 105 TEST_F('BaseHistoryWebUITest', 'emptyHistory', function() {
103 expectTrue($('newest-button').hidden); 106 expectTrue($('newest-button').hidden);
104 expectTrue($('newer-button').hidden); 107 expectTrue($('newer-button').hidden);
105 expectTrue($('older-button').hidden); 108 expectTrue($('older-button').hidden);
106 testDone(); 109 testDone();
107 }); 110 });
108 111
109 TEST_F('HistoryWebUITest', 'basicTest', function() { 112 TEST_F('HistoryWebUITest', 'basicTest', function() {
113 enableA11yChecks();
114
110 var resultCount = document.querySelectorAll('.entry').length; 115 var resultCount = document.querySelectorAll('.entry').length;
111 116
112 // Check that there are two days of entries. 117 // Check that there are two days of entries.
113 var dayHeaders = document.querySelectorAll('.day'); 118 var dayHeaders = document.querySelectorAll('.day');
114 assertEquals(2, dayHeaders.length); 119 assertEquals(2, dayHeaders.length);
115 expectNotEquals(dayHeaders[0].textContent, dayHeaders[1].textContent); 120 expectNotEquals(dayHeaders[0].textContent, dayHeaders[1].textContent);
121 expectAccessibilityOk();
116 122
117 // Check that the entries in each day are time-ordered, and that no 123 // Check that the entries in each day are time-ordered, and that no
118 // duplicate URLs appear on a given day. 124 // duplicate URLs appear on a given day.
119 var urlsByDay = {}; 125 var urlsByDay = {};
120 var lastDate = new Date(); 126 var lastDate = new Date();
121 for (var day = 0; day < dayHeaders.length; ++day) { 127 for (var day = 0; day < dayHeaders.length; ++day) {
122 var dayTitle = dayHeaders[day].textContent; 128 var dayTitle = dayHeaders[day].textContent;
123 var dayResults = document.querySelectorAll('.day-results')[day]; 129 var dayResults = document.querySelectorAll('.day-results')[day];
124 var entries = dayResults.querySelectorAll('.entry'); 130 var entries = dayResults.querySelectorAll('.entry');
125 expectGT(entries.length, 0); 131 expectGT(entries.length, 0);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Go back to the first page, and check that the same day headers are there. 186 // Go back to the first page, and check that the same day headers are there.
181 $('newest-button').click(); 187 $('newest-button').click();
182 var newDayHeaders = document.querySelectorAll('.day'); 188 var newDayHeaders = document.querySelectorAll('.day');
183 expectEquals(2, newDayHeaders.length); 189 expectEquals(2, newDayHeaders.length);
184 expectNotEquals(newDayHeaders[0].textContent, newDayHeaders[1].textContent); 190 expectNotEquals(newDayHeaders[0].textContent, newDayHeaders[1].textContent);
185 expectEquals(dayHeaders[0].textContent, newDayHeaders[0].textContent); 191 expectEquals(dayHeaders[0].textContent, newDayHeaders[0].textContent);
186 expectEquals(dayHeaders[1].textContent, newDayHeaders[1].textContent); 192 expectEquals(dayHeaders[1].textContent, newDayHeaders[1].textContent);
187 193
188 testDone(); 194 testDone();
189 }); 195 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698