Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: chrome/browser/download/download_commands_unittest.cc

Issue 2623613009: Disable "pause" item in context menu for "Save Page As..." downloads. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/download/download_commands.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/download/download_commands.h" 5 #include "chrome/browser/download/download_commands.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/public/test/mock_download_item.h" 10 #include "content/public/test/mock_download_item.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 TEST_F(DownloadCommandsTest, PausedUnresumable) { 121 TEST_F(DownloadCommandsTest, PausedUnresumable) {
122 ON_CALL(item(), IsPaused()).WillByDefault(Return(true)); 122 ON_CALL(item(), IsPaused()).WillByDefault(Return(true));
123 ON_CALL(item(), CanResume()).WillByDefault(Return(false)); 123 ON_CALL(item(), CanResume()).WillByDefault(Return(false));
124 124
125 EXPECT_FALSE(IsCommandEnabled(DownloadCommands::PAUSE)); 125 EXPECT_FALSE(IsCommandEnabled(DownloadCommands::PAUSE));
126 EXPECT_FALSE(IsCommandEnabled(DownloadCommands::RESUME)); 126 EXPECT_FALSE(IsCommandEnabled(DownloadCommands::RESUME));
127 } 127 }
128 128
129 TEST_F(DownloadCommandsTest, CantPauseSavePackage) {
130 ON_CALL(item(), IsSavePackageDownload()).WillByDefault(Return(true));
131 EXPECT_FALSE(IsCommandEnabled(DownloadCommands::PAUSE));
132 }
133
129 TEST_F(DownloadCommandsTest, DoOpenWhenComplete) { 134 TEST_F(DownloadCommandsTest, DoOpenWhenComplete) {
130 // Open when complete. 135 // Open when complete.
131 EXPECT_CALL(item(), OpenDownload()).Times(1); 136 EXPECT_CALL(item(), OpenDownload()).Times(1);
132 commands().ExecuteCommand(DownloadCommands::OPEN_WHEN_COMPLETE); 137 commands().ExecuteCommand(DownloadCommands::OPEN_WHEN_COMPLETE);
133 } 138 }
134 139
135 TEST_F(DownloadCommandsTest, DoShowInFolder) { 140 TEST_F(DownloadCommandsTest, DoShowInFolder) {
136 // Open when complete. 141 // Open when complete.
137 EXPECT_CALL(item(), ShowDownloadInShell()).Times(1); 142 EXPECT_CALL(item(), ShowDownloadInShell()).Times(1);
138 commands().ExecuteCommand(DownloadCommands::SHOW_IN_FOLDER); 143 commands().ExecuteCommand(DownloadCommands::SHOW_IN_FOLDER);
(...skipping 21 matching lines...) Expand all
160 GetLearnMoreURLForInterruptedDownload_ContainsContext) { 165 GetLearnMoreURLForInterruptedDownload_ContainsContext) {
161 EXPECT_CALL(item(), GetLastReason()) 166 EXPECT_CALL(item(), GetLastReason())
162 .WillOnce( 167 .WillOnce(
163 Return(content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED)); 168 Return(content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED));
164 GURL learn_more_url = commands().GetLearnMoreURLForInterruptedDownload(); 169 GURL learn_more_url = commands().GetLearnMoreURLForInterruptedDownload();
165 std::string name_value_pair = base::StringPrintf( 170 std::string name_value_pair = base::StringPrintf(
166 "ctx=%d", content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED); 171 "ctx=%d", content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED);
167 EXPECT_LT(0u, learn_more_url.query().find(name_value_pair)) 172 EXPECT_LT(0u, learn_more_url.query().find(name_value_pair))
168 << learn_more_url.spec(); 173 << learn_more_url.spec();
169 } 174 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_commands.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698