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
3 // found in the LICENSE file.
5 GEN_INCLUDE(['downloads_ui_browsertest_base.js']);
6 GEN('#include "chrome/browser/ui/webui/downloads_ui_browsertest.h"');
8 // Test UI when removing entries is allowed.
9 TEST_F('BaseDownloadsWebUITest', 'DeleteAllowed', function() {
10 this.expectDeleteControlsVisible(true);
11 // TODO(pamg): Mock out the back-end calls, so we can also test removing a
16 TEST_F('BaseDownloadsWebUITest', 'NoResultsHiddenWhenDownloads', function() {
17 assertNotEquals(0, downloads
.size());
18 expectFalse($('downloads-display').hidden
);
19 expectTrue($('no-downloads-or-results').hidden
);
22 TEST_F('BaseDownloadsWebUITest', 'NoSearchResultsShown', function() {
23 expectFalse($('downloads-display').hidden
);
24 var noResults
= $('no-downloads-or-results');
25 expectTrue(noResults
.hidden
);
27 setSearch('just try to search for me!');
30 expectTrue($('downloads-display').hidden
);
31 this.checkShowing(noResults
, loadTimeData
.getString('no_search_results'));
34 TEST_F('BaseDownloadsWebUITest', 'NoDownloadsAfterClearAll', function() {
35 expectFalse($('downloads-display').hidden
);
36 var noResults
= $('no-downloads-or-results');
37 expectTrue(noResults
.hidden
);
42 expectTrue($('downloads-display').hidden
);
43 this.checkShowing(noResults
, loadTimeData
.getString('no_downloads'));
48 * @extends {BaseDownloadsWebUITest}
50 function EmptyDownloadsWebUITest() {}
52 EmptyDownloadsWebUITest
.prototype = {
53 __proto__
: BaseDownloadsWebUITest
.prototype,
57 // Doesn't create any fake downloads.
58 assertEquals(0, downloads
.size());
62 TEST_F('EmptyDownloadsWebUITest', 'NoDownloadsMessageShowing', function() {
63 expectTrue($('downloads-display').hidden
);
64 var noResults
= $('no-downloads-or-results');
65 this.checkShowing(noResults
, loadTimeData
.getString('no_downloads'));
68 TEST_F('EmptyDownloadsWebUITest', 'NoSearchResultsWithNoDownloads', function() {
72 expectTrue($('downloads-display').hidden
);
73 var noResults
= $('no-downloads-or-results');
74 this.checkShowing(noResults
, loadTimeData
.getString('no_search_results'));
78 * Fixture for Downloads WebUI testing when deletions are prohibited.
79 * @extends {BaseDownloadsWebUITest}
82 function DownloadsWebUIDeleteProhibitedTest() {}
84 DownloadsWebUIDeleteProhibitedTest
.prototype = {
85 __proto__
: BaseDownloadsWebUITest
.prototype,
88 testGenPreamble: function() {
89 GEN(' SetDeleteAllowed(false);');
93 // Test UI when removing entries is prohibited.
94 TEST_F('DownloadsWebUIDeleteProhibitedTest', 'DeleteProhibited', function() {
95 this.expectDeleteControlsVisible(false);
96 // TODO(pamg): Mock out the back-end calls, so we can also test removing a