OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 = 25; | 5 /** @const */ var TOTAL_RESULT_COUNT = 25; |
6 | 6 |
7 /** | 7 /** |
8 * Test C++ fixture for downloads WebUI testing. | 8 * Test C++ fixture for downloads WebUI testing. |
9 * @constructor | 9 * @constructor |
10 * @extends {testing.Test} | 10 * @extends {testing.Test} |
(...skipping 29 matching lines...) Expand all Loading... |
40 /** @override */ | 40 /** @override */ |
41 accessibilityIssuesAreErrors: true, | 41 accessibilityIssuesAreErrors: true, |
42 | 42 |
43 /** | 43 /** |
44 * Sends TOTAL_RESULT_COUNT fake downloads to the page. This can't be called | 44 * Sends TOTAL_RESULT_COUNT fake downloads to the page. This can't be called |
45 * in the preLoad, because it requires the global Download object to have | 45 * in the preLoad, because it requires the global Download object to have |
46 * been created by the page. | 46 * been created by the page. |
47 * @override | 47 * @override |
48 */ | 48 */ |
49 setUp: function() { | 49 setUp: function() { |
50 testing.Test.prototype.setUp.call(this); | |
51 | |
52 this.createdDownloads = []; | 50 this.createdDownloads = []; |
53 | 51 |
54 // The entries will begin at 1:00 AM on Sept 2, 2008, and will be spaced | 52 // The entries will begin at 1:00 AM on Sept 2, 2008, and will be spaced |
55 // two minutes apart. | 53 // two minutes apart. |
56 var timestamp = new Date(2008, 9, 2, 1, 0).getTime(); | 54 var timestamp = new Date(2008, 9, 2, 1, 0).getTime(); |
57 for (var i = 0; i < TOTAL_RESULT_COUNT; ++i) { | 55 for (var i = 0; i < TOTAL_RESULT_COUNT; ++i) { |
58 this.createDownload(i, timestamp); | 56 this.createDownload(i, timestamp); |
59 timestamp += 2 * 60 * 1000; // Next visit is two minutes later. | 57 timestamp += 2 * 60 * 1000; // Next visit is two minutes later. |
60 } | 58 } |
61 downloads.Manager.updateAll(this.createdDownloads); | 59 downloads.Manager.updateAll(this.createdDownloads); |
62 expectEquals(downloads.Manager.size(), TOTAL_RESULT_COUNT); | 60 expectEquals(downloads.Manager.size(), TOTAL_RESULT_COUNT); |
63 | |
64 this.updateAccessibilityAuditConfig(); | |
65 }, | 61 }, |
66 | 62 |
67 /** | 63 /** |
68 * Disables failing accessibility audits. This should be removed when all | |
69 * audit issues have been resolved. | |
70 */ | |
71 updateAccessibilityAuditConfig: function() { | |
72 // Enable when failure is resolved. | |
73 // AX_TEXT_01: http://crbug.com/559217 | |
74 this.accessibilityAuditConfig.ignoreSelectors( | |
75 'controlsWithoutLabel', | |
76 '#term'); | |
77 | |
78 // Enable when failure is resolved. | |
79 // AX_FOCUS_03: http://crbug.com/559219 | |
80 this.accessibilityAuditConfig.ignoreSelectors( | |
81 'tabIndexGreaterThanZero', | |
82 '#term'); | |
83 }, | |
84 | |
85 /** | |
86 * Creates a download object to be passed to the page, following the expected | 64 * Creates a download object to be passed to the page, following the expected |
87 * backend format (see downloads_dom_handler.cc). | 65 * backend format (see downloads_dom_handler.cc). |
88 * @param {number} id A unique ID for the download. | 66 * @param {number} id A unique ID for the download. |
89 * @param {number} timestamp The time the download purportedly started. | 67 * @param {number} timestamp The time the download purportedly started. |
90 * @return {!Object} A fake download object. | 68 * @return {!Object} A fake download object. |
91 */ | 69 */ |
92 createDownload: function(id, timestamp) { | 70 createDownload: function(id, timestamp) { |
93 this.createdDownloads.unshift({ | 71 this.createdDownloads.unshift({ |
94 id: id, | 72 id: id, |
95 started: timestamp, | 73 started: timestamp, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // "Clear all" should only be showing when deletions are allowed. | 146 // "Clear all" should only be showing when deletions are allowed. |
169 expectEquals(!visible, $('clear-all').hidden); | 147 expectEquals(!visible, $('clear-all').hidden); |
170 | 148 |
171 // "Remove from list" links should only exist when deletions are allowed. | 149 // "Remove from list" links should only exist when deletions are allowed. |
172 var query = '#downloads-display .safe .remove'; | 150 var query = '#downloads-display .safe .remove'; |
173 if (!visible) | 151 if (!visible) |
174 query += '[hidden]'; | 152 query += '[hidden]'; |
175 expectEquals(TOTAL_RESULT_COUNT, document.querySelectorAll(query).length); | 153 expectEquals(TOTAL_RESULT_COUNT, document.querySelectorAll(query).length); |
176 }, | 154 }, |
177 }; | 155 }; |
OLD | NEW |