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 |
50 this.createdDownloads = []; | 52 this.createdDownloads = []; |
51 | 53 |
52 // The entries will begin at 1:00 AM on Sept 2, 2008, and will be spaced | 54 // The entries will begin at 1:00 AM on Sept 2, 2008, and will be spaced |
53 // two minutes apart. | 55 // two minutes apart. |
54 var timestamp = new Date(2008, 9, 2, 1, 0).getTime(); | 56 var timestamp = new Date(2008, 9, 2, 1, 0).getTime(); |
55 for (var i = 0; i < TOTAL_RESULT_COUNT; ++i) { | 57 for (var i = 0; i < TOTAL_RESULT_COUNT; ++i) { |
56 this.createDownload(i, timestamp); | 58 this.createDownload(i, timestamp); |
57 timestamp += 2 * 60 * 1000; // Next visit is two minutes later. | 59 timestamp += 2 * 60 * 1000; // Next visit is two minutes later. |
58 } | 60 } |
59 downloads.Manager.updateAll(this.createdDownloads); | 61 downloads.Manager.updateAll(this.createdDownloads); |
60 expectEquals(downloads.Manager.size(), TOTAL_RESULT_COUNT); | 62 expectEquals(downloads.Manager.size(), TOTAL_RESULT_COUNT); |
| 63 |
| 64 this.updateAccessibilityAuditConfig(); |
61 }, | 65 }, |
62 | 66 |
63 /** | 67 /** |
| 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 /** |
64 * Creates a download object to be passed to the page, following the expected | 86 * Creates a download object to be passed to the page, following the expected |
65 * backend format (see downloads_dom_handler.cc). | 87 * backend format (see downloads_dom_handler.cc). |
66 * @param {number} id A unique ID for the download. | 88 * @param {number} id A unique ID for the download. |
67 * @param {number} timestamp The time the download purportedly started. | 89 * @param {number} timestamp The time the download purportedly started. |
68 * @return {!Object} A fake download object. | 90 * @return {!Object} A fake download object. |
69 */ | 91 */ |
70 createDownload: function(id, timestamp) { | 92 createDownload: function(id, timestamp) { |
71 this.createdDownloads.unshift({ | 93 this.createdDownloads.unshift({ |
72 id: id, | 94 id: id, |
73 started: timestamp, | 95 started: timestamp, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // "Clear all" should only be showing when deletions are allowed. | 168 // "Clear all" should only be showing when deletions are allowed. |
147 expectEquals(!visible, $('clear-all').hidden); | 169 expectEquals(!visible, $('clear-all').hidden); |
148 | 170 |
149 // "Remove from list" links should only exist when deletions are allowed. | 171 // "Remove from list" links should only exist when deletions are allowed. |
150 var query = '#downloads-display .safe .remove'; | 172 var query = '#downloads-display .safe .remove'; |
151 if (!visible) | 173 if (!visible) |
152 query += '[hidden]'; | 174 query += '[hidden]'; |
153 expectEquals(TOTAL_RESULT_COUNT, document.querySelectorAll(query).length); | 175 expectEquals(TOTAL_RESULT_COUNT, document.querySelectorAll(query).length); |
154 }, | 176 }, |
155 }; | 177 }; |
OLD | NEW |