| OLD | NEW |
| 1 // Copyright 2013 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 GEN('#include "chrome/browser/ui/webui/downloads_ui_browsertest.h"'); | |
| 6 | |
| 7 /** @const */ var TOTAL_RESULT_COUNT = 25; | 5 /** @const */ var TOTAL_RESULT_COUNT = 25; |
| 8 | 6 |
| 9 /** | 7 /** |
| 10 * Test C++ fixture for downloads WebUI testing. | 8 * Test C++ fixture for downloads WebUI testing. |
| 11 * @constructor | 9 * @constructor |
| 12 * @extends {testing.Test} | 10 * @extends {testing.Test} |
| 13 */ | 11 */ |
| 14 function DownloadsUIBrowserTest() {} | 12 function DownloadsUIBrowserTest() {} |
| 15 | 13 |
| 16 /** | 14 /** |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } else { | 119 } else { |
| 122 expectEquals(expectControlsHidden, disabledElements[0].hidden); | 120 expectEquals(expectControlsHidden, disabledElements[0].hidden); |
| 123 } | 121 } |
| 124 | 122 |
| 125 // The model is updated synchronously, even though the actual | 123 // The model is updated synchronously, even though the actual |
| 126 // back-end removal (tested elsewhere) is asynchronous. | 124 // back-end removal (tested elsewhere) is asynchronous. |
| 127 clearAll(); | 125 clearAll(); |
| 128 expectEquals(allowDelete ? 0 : TOTAL_RESULT_COUNT, downloads.size()); | 126 expectEquals(allowDelete ? 0 : TOTAL_RESULT_COUNT, downloads.size()); |
| 129 }, | 127 }, |
| 130 }; | 128 }; |
| 131 | |
| 132 // Test UI when removing entries is allowed. | |
| 133 TEST_F('BaseDownloadsWebUITest', 'DeleteAllowed', function() { | |
| 134 this.testHelper(true, false); | |
| 135 // TODO(pamg): Mock out the back-end calls, so we can also test removing a | |
| 136 // single item. | |
| 137 testDone(); | |
| 138 }); | |
| 139 | |
| 140 /** | |
| 141 * Fixture for Downloads WebUI testing when deletions are prohibited. | |
| 142 * @extends {BaseDownloadsWebUITest} | |
| 143 * @constructor | |
| 144 */ | |
| 145 function DownloadsWebUIDeleteProhibitedTest() {} | |
| 146 | |
| 147 DownloadsWebUIDeleteProhibitedTest.prototype = { | |
| 148 __proto__: BaseDownloadsWebUITest.prototype, | |
| 149 | |
| 150 /** @override */ | |
| 151 testGenPreamble: function() { | |
| 152 GEN(' SetDeleteAllowed(false);'); | |
| 153 }, | |
| 154 }; | |
| 155 | |
| 156 // Test UI when removing entries is prohibited. | |
| 157 TEST_F('DownloadsWebUIDeleteProhibitedTest', 'DeleteProhibited', function() { | |
| 158 this.testHelper(false, false); | |
| 159 // TODO(pamg): Mock out the back-end calls, so we can also test removing a | |
| 160 // single item. | |
| 161 testDone(); | |
| 162 }); | |
| 163 | |
| 164 /** | |
| 165 * Fixture for Downloads WebUI testing for a supervised user. | |
| 166 * @extends {BaseDownloadsWebUITest} | |
| 167 * @constructor | |
| 168 */ | |
| 169 function DownloadsWebUIForSupervisedUsersTest() {} | |
| 170 | |
| 171 DownloadsWebUIForSupervisedUsersTest.prototype = { | |
| 172 __proto__: BaseDownloadsWebUITest.prototype, | |
| 173 | |
| 174 /** @override */ | |
| 175 typedefCppFixture: 'DownloadsWebUIForSupervisedUsersTest', | |
| 176 }; | |
| 177 | |
| 178 // Test UI for supervised users, removing entries should be disabled | |
| 179 // and removal controls should be hidden. | |
| 180 TEST_F('DownloadsWebUIForSupervisedUsersTest', 'SupervisedUsers', function() { | |
| 181 this.testHelper(false, true); | |
| 182 testDone(); | |
| 183 }); | |
| OLD | NEW |