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(['downloads_ui_browsertest_base.js']); | 5 GEN_INCLUDE(['downloads_ui_browsertest_base.js']); |
6 GEN('#include "chrome/browser/ui/webui/downloads_ui_browsertest.h"'); | 6 GEN('#include "chrome/browser/ui/webui/downloads_ui_browsertest.h"'); |
7 | 7 |
8 // Test UI when removing entries is allowed. | 8 // Test UI when removing entries is allowed. |
9 TEST_F('BaseDownloadsWebUITest', 'DeleteAllowed', function() { | 9 TEST_F('BaseDownloadsWebUITest', 'DeleteAllowed', function() { |
10 this.testHelper(true, false); | 10 this.testHelper(true, false); |
11 // TODO(pamg): Mock out the back-end calls, so we can also test removing a | 11 // TODO(pamg): Mock out the back-end calls, so we can also test removing a |
12 // single item. | 12 // single item. |
13 testDone(); | 13 testDone(); |
14 }); | 14 }); |
15 | 15 |
| 16 TEST_F('BaseDownloadsWebUITest', 'NoResultsHiddenWhenDownloads', function() { |
| 17 assertNotEquals(0, downloads.size()); |
| 18 expectFalse($('downloads-display').hidden); |
| 19 expectTrue($('no-downloads-or-results').hidden); |
| 20 }); |
| 21 |
| 22 /** |
| 23 * @constructor |
| 24 * @extends {BaseDownloadsWebUITest} |
| 25 */ |
| 26 function EmptyDownloadsWebUITest() {} |
| 27 |
| 28 EmptyDownloadsWebUITest.prototype = { |
| 29 __proto__: BaseDownloadsWebUITest.prototype, |
| 30 |
| 31 /** @override */ |
| 32 setUp: function() { |
| 33 // Doesn't create any fake downloads. |
| 34 assertEquals(0, downloads.size()); |
| 35 }, |
| 36 }; |
| 37 |
| 38 TEST_F('EmptyDownloadsWebUITest', 'NoDownloadsMessageShowing', function() { |
| 39 expectTrue($('downloads-display').hidden); |
| 40 expectFalse($('no-downloads-or-results').hidden); |
| 41 }); |
| 42 |
16 /** | 43 /** |
17 * Fixture for Downloads WebUI testing when deletions are prohibited. | 44 * Fixture for Downloads WebUI testing when deletions are prohibited. |
18 * @extends {BaseDownloadsWebUITest} | 45 * @extends {BaseDownloadsWebUITest} |
19 * @constructor | 46 * @constructor |
20 */ | 47 */ |
21 function DownloadsWebUIDeleteProhibitedTest() {} | 48 function DownloadsWebUIDeleteProhibitedTest() {} |
22 | 49 |
23 DownloadsWebUIDeleteProhibitedTest.prototype = { | 50 DownloadsWebUIDeleteProhibitedTest.prototype = { |
24 __proto__: BaseDownloadsWebUITest.prototype, | 51 __proto__: BaseDownloadsWebUITest.prototype, |
25 | 52 |
26 /** @override */ | 53 /** @override */ |
27 testGenPreamble: function() { | 54 testGenPreamble: function() { |
28 GEN(' SetDeleteAllowed(false);'); | 55 GEN(' SetDeleteAllowed(false);'); |
29 }, | 56 }, |
30 }; | 57 }; |
31 | 58 |
32 // Test UI when removing entries is prohibited. | 59 // Test UI when removing entries is prohibited. |
33 TEST_F('DownloadsWebUIDeleteProhibitedTest', 'DeleteProhibited', function() { | 60 TEST_F('DownloadsWebUIDeleteProhibitedTest', 'DeleteProhibited', function() { |
34 this.testHelper(false, false); | 61 this.testHelper(false, false); |
35 // TODO(pamg): Mock out the back-end calls, so we can also test removing a | 62 // TODO(pamg): Mock out the back-end calls, so we can also test removing a |
36 // single item. | 63 // single item. |
37 testDone(); | 64 testDone(); |
38 }); | 65 }); |
OLD | NEW |