| 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.expectDeleteControlsVisible(true); |   10   this.expectDeleteControlsVisible(true); | 
|   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 }); |   13 }); | 
|   14  |   14  | 
|   15 TEST_F('BaseDownloadsWebUITest', 'NoResultsHiddenWhenDownloads', function() { |   15 TEST_F('BaseDownloadsWebUITest', 'NoResultsHiddenWhenDownloads', function() { | 
|   16   assertNotEquals(0, downloads.Manager.size()); |   16   assertNotEquals(0, downloads.Manager.size()); | 
|   17   expectFalse($('downloads-display').hidden); |   17   expectFalse($('downloads-display').hidden); | 
|   18   expectTrue($('no-downloads-or-results').hidden); |   18   expectTrue($('no-downloads-or-results').hidden); | 
|   19 }); |   19 }); | 
|   20  |   20  | 
|   21 TEST_F('BaseDownloadsWebUITest', 'NoSearchResultsShown', function() { |   21 TEST_F('BaseDownloadsWebUITest', 'NoSearchResultsShown', function() { | 
|   22   expectFalse($('downloads-display').hidden); |   22   expectFalse($('downloads-display').hidden); | 
|   23   var noResults = $('no-downloads-or-results'); |   23   var noResults = $('no-downloads-or-results'); | 
|   24   expectTrue(noResults.hidden); |   24   expectTrue(noResults.hidden); | 
|   25  |   25  | 
|   26   downloads.Manager.setSearchText('just try to search for me!'); |   26   downloads.Manager.setSearchText('just try to search for me!'); | 
|   27   this.sendEmptyList(); |   27   this.sendEmptyList(); | 
|   28  |   28  | 
|   29   expectTrue($('downloads-display').hidden); |   29   expectTrue($('downloads-display').hidden); | 
|   30   this.checkShowing(noResults, loadTimeData.getString('no_search_results')); |   30   this.checkShowing(noResults, loadTimeData.getString('noSearchResults')); | 
|   31 }); |   31 }); | 
|   32  |   32  | 
|   33 TEST_F('BaseDownloadsWebUITest', 'NoDownloadsAfterClearAll', function() { |   33 TEST_F('BaseDownloadsWebUITest', 'NoDownloadsAfterClearAll', function() { | 
|   34   expectFalse($('downloads-display').hidden); |   34   expectFalse($('downloads-display').hidden); | 
|   35   var noResults = $('no-downloads-or-results'); |   35   var noResults = $('no-downloads-or-results'); | 
|   36   expectTrue(noResults.hidden); |   36   expectTrue(noResults.hidden); | 
|   37  |   37  | 
|   38   $('clear-all').click(); |   38   $('clear-all').click(); | 
|   39   this.sendEmptyList(); |   39   this.sendEmptyList(); | 
|   40  |   40  | 
|   41   expectTrue($('downloads-display').hidden); |   41   expectTrue($('downloads-display').hidden); | 
|   42   this.checkShowing(noResults, loadTimeData.getString('no_downloads')); |   42   this.checkShowing(noResults, loadTimeData.getString('noDownloads')); | 
|   43 }); |   43 }); | 
|   44  |   44  | 
|   45 TEST_F('BaseDownloadsWebUITest', 'PauseResumeFocus', function() { |   45 TEST_F('BaseDownloadsWebUITest', 'PauseResumeFocus', function() { | 
|   46   assertGE(downloads.Manager.size(), 0); |   46   assertGE(downloads.Manager.size(), 0); | 
|   47  |   47  | 
|   48   var freshestDownload = this.createdDownloads[0]; |   48   var freshestDownload = this.createdDownloads[0]; | 
|   49   freshestDownload.state = downloads.States.IN_PROGRESS; |   49   freshestDownload.state = downloads.States.IN_PROGRESS; | 
|   50   freshestDownload.resume = false; |   50   freshestDownload.resume = false; | 
|   51   downloads.Manager.updateItem(freshestDownload); |   51   downloads.Manager.updateItem(freshestDownload); | 
|   52  |   52  | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  119   /** @override */ |  119   /** @override */ | 
|  120   setUp: function() { |  120   setUp: function() { | 
|  121     // Doesn't create any fake downloads. |  121     // Doesn't create any fake downloads. | 
|  122     assertEquals(0, downloads.Manager.size()); |  122     assertEquals(0, downloads.Manager.size()); | 
|  123   }, |  123   }, | 
|  124 }; |  124 }; | 
|  125  |  125  | 
|  126 TEST_F('EmptyDownloadsWebUITest', 'NoDownloadsMessageShowing', function() { |  126 TEST_F('EmptyDownloadsWebUITest', 'NoDownloadsMessageShowing', function() { | 
|  127   expectTrue($('downloads-display').hidden); |  127   expectTrue($('downloads-display').hidden); | 
|  128   var noResults = $('no-downloads-or-results'); |  128   var noResults = $('no-downloads-or-results'); | 
|  129   this.checkShowing(noResults, loadTimeData.getString('no_downloads')); |  129   this.checkShowing(noResults, loadTimeData.getString('noDownloads')); | 
|  130 }); |  130 }); | 
|  131  |  131  | 
|  132 TEST_F('EmptyDownloadsWebUITest', 'NoSearchResultsWithNoDownloads', function() { |  132 TEST_F('EmptyDownloadsWebUITest', 'NoSearchResultsWithNoDownloads', function() { | 
|  133   downloads.Manager.setSearchText('bananas'); |  133   downloads.Manager.setSearchText('bananas'); | 
|  134   this.sendEmptyList(); |  134   this.sendEmptyList(); | 
|  135  |  135  | 
|  136   expectTrue($('downloads-display').hidden); |  136   expectTrue($('downloads-display').hidden); | 
|  137   var noResults = $('no-downloads-or-results'); |  137   var noResults = $('no-downloads-or-results'); | 
|  138   this.checkShowing(noResults, loadTimeData.getString('no_search_results')); |  138   this.checkShowing(noResults, loadTimeData.getString('noSearchResults')); | 
|  139 }); |  139 }); | 
|  140  |  140  | 
|  141 /** |  141 /** | 
|  142  * Fixture for Downloads WebUI testing when deletions are prohibited. |  142  * Fixture for Downloads WebUI testing when deletions are prohibited. | 
|  143  * @extends {BaseDownloadsWebUITest} |  143  * @extends {BaseDownloadsWebUITest} | 
|  144  * @constructor |  144  * @constructor | 
|  145  */ |  145  */ | 
|  146 function DownloadsWebUIDeleteProhibitedTest() {} |  146 function DownloadsWebUIDeleteProhibitedTest() {} | 
|  147  |  147  | 
|  148 DownloadsWebUIDeleteProhibitedTest.prototype = { |  148 DownloadsWebUIDeleteProhibitedTest.prototype = { | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|  159   this.expectDeleteControlsVisible(false); |  159   this.expectDeleteControlsVisible(false); | 
|  160   // TODO(pamg): Mock out the back-end calls, so we can also test removing a |  160   // TODO(pamg): Mock out the back-end calls, so we can also test removing a | 
|  161   // single item. |  161   // single item. | 
|  162 }); |  162 }); | 
|  163  |  163  | 
|  164 TEST_F('DownloadsWebUIDeleteProhibitedTest', 'ClearLeavesSearch', function() { |  164 TEST_F('DownloadsWebUIDeleteProhibitedTest', 'ClearLeavesSearch', function() { | 
|  165   downloads.Manager.setSearchText('muhahaha'); |  165   downloads.Manager.setSearchText('muhahaha'); | 
|  166   $('clear-all').click(); |  166   $('clear-all').click(); | 
|  167   expectGE(downloads.Manager.getInstance().searchText_.length, 0); |  167   expectGE(downloads.Manager.getInstance().searchText_.length, 0); | 
|  168 }); |  168 }); | 
| OLD | NEW |