| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/ui/webui/downloads_ui_browsertest.h"'); | 5 GEN('#include "chrome/browser/ui/webui/downloads_ui_browsertest.h"'); |
| 6 | 6 |
| 7 /** @const */ var TOTAL_RESULT_COUNT = 25; | 7 /** @const */ var TOTAL_RESULT_COUNT = 25; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Test C++ fixture for downloads WebUI testing. | 10 * Test C++ fixture for downloads WebUI testing. |
| 11 * @constructor | 11 * @constructor |
| 12 * @extends {testing.Test} | 12 * @extends {testing.Test} |
| 13 */ | 13 */ |
| 14 function DownloadsUIBrowserTest() {} | 14 function DownloadsUIBrowserTest() {} |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Base fixture for Downloads WebUI testing. | 17 * Base fixture for Downloads WebUI testing. |
| 18 * @extends {testing.Test} | 18 * @extends {testing.Test} |
| 19 * @constructor | 19 * @constructor |
| 20 */ | 20 */ |
| 21 function BaseDownloadsWebUITest() {} | 21 function BaseDownloadsWebUITest() {} |
| 22 | 22 |
| 23 BaseDownloadsWebUITest.prototype = { | 23 BaseDownloadsWebUITest.prototype = { |
| 24 __proto__: testing.Test.prototype, | 24 __proto__: testing.Test.prototype, |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Browse to the downloads page & call our preLoad(). | 27 * Browse to the downloads page & call our preLoad(). |
| 28 */ | 28 */ |
| 29 browsePreload: 'chrome://downloads', | 29 browsePreload: 'chrome://downloads/', |
| 30 | 30 |
| 31 /** @override */ | 31 /** @override */ |
| 32 typedefCppFixture: 'DownloadsUIBrowserTest', | 32 typedefCppFixture: 'DownloadsUIBrowserTest', |
| 33 | 33 |
| 34 /** @override */ | 34 /** @override */ |
| 35 testGenPreamble: function() { | 35 testGenPreamble: function() { |
| 36 GEN(' SetDeleteAllowed(true);'); | 36 GEN(' SetDeleteAllowed(true);'); |
| 37 }, | 37 }, |
| 38 | 38 |
| 39 /** | 39 /** |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 // Test UI when removing entries is allowed. | 132 // Test UI when removing entries is allowed. |
| 133 TEST_F('BaseDownloadsWebUITest', 'DeleteAllowed', function() { | 133 TEST_F('BaseDownloadsWebUITest', 'DeleteAllowed', function() { |
| 134 this.testHelper(true, false); | 134 this.testHelper(true, false); |
| 135 // TODO(pamg): Mock out the back-end calls, so we can also test removing a | 135 // TODO(pamg): Mock out the back-end calls, so we can also test removing a |
| 136 // single item. | 136 // single item. |
| 137 testDone(); | 137 testDone(); |
| 138 }); | 138 }); |
| 139 | 139 |
| 140 // Test that clicking <a href=#> doesn't actually go to #. |
| 141 TEST_F('BaseDownloadsWebUITest', 'PoundLinkClicksDontChangeUrl', function() { |
| 142 assertEquals(this.browsePreload, document.location.href); |
| 143 document.querySelector('.clear-all-link').click(); |
| 144 assertEquals(this.browsePreload, document.location.href); |
| 145 testDone(); |
| 146 }); |
| 147 |
| 140 /** | 148 /** |
| 141 * Fixture for Downloads WebUI testing when deletions are prohibited. | 149 * Fixture for Downloads WebUI testing when deletions are prohibited. |
| 142 * @extends {BaseDownloadsWebUITest} | 150 * @extends {BaseDownloadsWebUITest} |
| 143 * @constructor | 151 * @constructor |
| 144 */ | 152 */ |
| 145 function DownloadsWebUIDeleteProhibitedTest() {} | 153 function DownloadsWebUIDeleteProhibitedTest() {} |
| 146 | 154 |
| 147 DownloadsWebUIDeleteProhibitedTest.prototype = { | 155 DownloadsWebUIDeleteProhibitedTest.prototype = { |
| 148 __proto__: BaseDownloadsWebUITest.prototype, | 156 __proto__: BaseDownloadsWebUITest.prototype, |
| 149 | 157 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 174 /** @override */ | 182 /** @override */ |
| 175 typedefCppFixture: 'DownloadsWebUIForSupervisedUsersTest', | 183 typedefCppFixture: 'DownloadsWebUIForSupervisedUsersTest', |
| 176 }; | 184 }; |
| 177 | 185 |
| 178 // Test UI for supervised users, removing entries should be disabled | 186 // Test UI for supervised users, removing entries should be disabled |
| 179 // and removal controls should be hidden. | 187 // and removal controls should be hidden. |
| 180 TEST_F('DownloadsWebUIForSupervisedUsersTest', 'SupervisedUsers', function() { | 188 TEST_F('DownloadsWebUIForSupervisedUsersTest', 'SupervisedUsers', function() { |
| 181 this.testHelper(false, true); | 189 this.testHelper(false, true); |
| 182 testDone(); | 190 testDone(); |
| 183 }); | 191 }); |
| OLD | NEW |