ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / ui / webui / downloads_ui_browsertest.js
blob1fc22a0a061fa61b4b6849a079f3e09179e8f90a
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
12 // single item.
13 testDone();
14 });
16 TEST_F('BaseDownloadsWebUITest', 'NoResultsHiddenWhenDownloads', function() {
17 assertNotEquals(0, downloads.size());
18 expectFalse($('downloads-display').hidden);
19 expectTrue($('no-downloads-or-results').hidden);
20 });
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!');
28 this.sendEmptyList();
30 expectTrue($('downloads-display').hidden);
31 this.checkShowing(noResults, loadTimeData.getString('no_search_results'));
32 });
34 TEST_F('BaseDownloadsWebUITest', 'NoDownloadsAfterClearAll', function() {
35 expectFalse($('downloads-display').hidden);
36 var noResults = $('no-downloads-or-results');
37 expectTrue(noResults.hidden);
39 clearAll();
40 this.sendEmptyList();
42 expectTrue($('downloads-display').hidden);
43 this.checkShowing(noResults, loadTimeData.getString('no_downloads'));
44 });
46 /**
47 * @constructor
48 * @extends {BaseDownloadsWebUITest}
50 function EmptyDownloadsWebUITest() {}
52 EmptyDownloadsWebUITest.prototype = {
53 __proto__: BaseDownloadsWebUITest.prototype,
55 /** @override */
56 setUp: function() {
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'));
66 });
68 TEST_F('EmptyDownloadsWebUITest', 'NoSearchResultsWithNoDownloads', function() {
69 setSearch('bananas');
70 this.sendEmptyList();
72 expectTrue($('downloads-display').hidden);
73 var noResults = $('no-downloads-or-results');
74 this.checkShowing(noResults, loadTimeData.getString('no_search_results'));
75 });
77 /**
78 * Fixture for Downloads WebUI testing when deletions are prohibited.
79 * @extends {BaseDownloadsWebUITest}
80 * @constructor
82 function DownloadsWebUIDeleteProhibitedTest() {}
84 DownloadsWebUIDeleteProhibitedTest.prototype = {
85 __proto__: BaseDownloadsWebUITest.prototype,
87 /** @override */
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
97 // single item.
98 testDone();
99 });