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

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

Issue 1924473003: [Downloads] Use the initiating StoragePartition for resumption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in comment Created 4 years, 7 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
OLDNEW
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 #include "chrome/browser/download/download_ui_controller.h" 5 #include "chrome/browser/download/download_ui_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 .WillRepeatedly( 211 .WillRepeatedly(
212 ReturnRefOfCopy(std::string("14CA04AF-ECEC-4B13-8829-817477EFAB83"))); 212 ReturnRefOfCopy(std::string("14CA04AF-ECEC-4B13-8829-817477EFAB83")));
213 EXPECT_CALL(*item, GetTargetFilePath()) 213 EXPECT_CALL(*item, GetTargetFilePath())
214 .WillRepeatedly( 214 .WillRepeatedly(
215 ReturnRefOfCopy(base::FilePath(FILE_PATH_LITERAL("foo")))); 215 ReturnRefOfCopy(base::FilePath(FILE_PATH_LITERAL("foo"))));
216 EXPECT_CALL(*item, GetFullPath()).WillRepeatedly( 216 EXPECT_CALL(*item, GetFullPath()).WillRepeatedly(
217 ReturnRefOfCopy(base::FilePath(FILE_PATH_LITERAL("foo")))); 217 ReturnRefOfCopy(base::FilePath(FILE_PATH_LITERAL("foo"))));
218 EXPECT_CALL(*item, GetState()) 218 EXPECT_CALL(*item, GetState())
219 .WillRepeatedly(Return(content::DownloadItem::IN_PROGRESS)); 219 .WillRepeatedly(Return(content::DownloadItem::IN_PROGRESS));
220 EXPECT_CALL(*item, GetUrlChain()) 220 EXPECT_CALL(*item, GetUrlChain())
221 .WillRepeatedly(testing::ReturnRefOfCopy(std::vector<GURL>())); 221 .WillRepeatedly(ReturnRefOfCopy(std::vector<GURL>()));
222 EXPECT_CALL(*item, GetReferrerUrl()) 222 EXPECT_CALL(*item, GetReferrerUrl()).WillRepeatedly(ReturnRefOfCopy(GURL()));
223 .WillRepeatedly(testing::ReturnRefOfCopy(GURL())); 223 EXPECT_CALL(*item, GetSiteUrl()).WillRepeatedly(ReturnRefOfCopy(GURL()));
224 EXPECT_CALL(*item, GetTabUrl()) 224 EXPECT_CALL(*item, GetTabUrl()).WillRepeatedly(ReturnRefOfCopy(GURL()));
225 .WillRepeatedly(testing::ReturnRefOfCopy(GURL()));
226 EXPECT_CALL(*item, GetTabReferrerUrl()) 225 EXPECT_CALL(*item, GetTabReferrerUrl())
227 .WillRepeatedly(testing::ReturnRefOfCopy(GURL())); 226 .WillRepeatedly(ReturnRefOfCopy(GURL()));
228 EXPECT_CALL(*item, GetStartTime()).WillRepeatedly(Return(base::Time())); 227 EXPECT_CALL(*item, GetStartTime()).WillRepeatedly(Return(base::Time()));
229 EXPECT_CALL(*item, GetEndTime()).WillRepeatedly(Return(base::Time())); 228 EXPECT_CALL(*item, GetEndTime()).WillRepeatedly(Return(base::Time()));
230 EXPECT_CALL(*item, GetETag()).WillRepeatedly(ReturnRefOfCopy(std::string())); 229 EXPECT_CALL(*item, GetETag()).WillRepeatedly(ReturnRefOfCopy(std::string()));
231 EXPECT_CALL(*item, GetLastModifiedTime()) 230 EXPECT_CALL(*item, GetLastModifiedTime())
232 .WillRepeatedly(ReturnRefOfCopy(std::string())); 231 .WillRepeatedly(ReturnRefOfCopy(std::string()));
233 EXPECT_CALL(*item, GetDangerType()) 232 EXPECT_CALL(*item, GetDangerType())
234 .WillRepeatedly(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); 233 .WillRepeatedly(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS));
235 EXPECT_CALL(*item, GetLastReason()) 234 EXPECT_CALL(*item, GetLastReason())
236 .WillRepeatedly(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE)); 235 .WillRepeatedly(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE));
237 EXPECT_CALL(*item, GetReceivedBytes()).WillRepeatedly(Return(0)); 236 EXPECT_CALL(*item, GetReceivedBytes()).WillRepeatedly(Return(0));
238 EXPECT_CALL(*item, GetTotalBytes()).WillRepeatedly(Return(0)); 237 EXPECT_CALL(*item, GetTotalBytes()).WillRepeatedly(Return(0));
239 EXPECT_CALL(*item, GetTargetDisposition()).WillRepeatedly( 238 EXPECT_CALL(*item, GetTargetDisposition()).WillRepeatedly(
240 Return(content::DownloadItem::TARGET_DISPOSITION_OVERWRITE)); 239 Return(content::DownloadItem::TARGET_DISPOSITION_OVERWRITE));
241 EXPECT_CALL(*item, GetOpened()).WillRepeatedly(Return(false)); 240 EXPECT_CALL(*item, GetOpened()).WillRepeatedly(Return(false));
242 EXPECT_CALL(*item, GetMimeType()).WillRepeatedly(Return(std::string())); 241 EXPECT_CALL(*item, GetMimeType()).WillRepeatedly(Return(std::string()));
243 EXPECT_CALL(*item, GetURL()).WillRepeatedly(testing::ReturnRefOfCopy(GURL())); 242 EXPECT_CALL(*item, GetURL()).WillRepeatedly(ReturnRefOfCopy(GURL()));
244 EXPECT_CALL(*item, GetWebContents()).WillRepeatedly(Return(nullptr)); 243 EXPECT_CALL(*item, GetWebContents()).WillRepeatedly(Return(nullptr));
245 EXPECT_CALL(*item, IsTemporary()).WillRepeatedly(Return(false)); 244 EXPECT_CALL(*item, IsTemporary()).WillRepeatedly(Return(false));
246 return item; 245 return item;
247 } 246 }
248 247
249 std::unique_ptr<DownloadUIController::Delegate> 248 std::unique_ptr<DownloadUIController::Delegate>
250 DownloadUIControllerTest::GetTestDelegate() { 249 DownloadUIControllerTest::GetTestDelegate() {
251 std::unique_ptr<DownloadUIController::Delegate> delegate( 250 std::unique_ptr<DownloadUIController::Delegate> delegate(
252 new TestDelegate(notified_item_receiver_factory_.GetWeakPtr())); 251 new TestDelegate(notified_item_receiver_factory_.GetWeakPtr()));
253 return delegate; 252 return delegate;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // DownloadUIController. It should ignore the download since it's marked as 352 // DownloadUIController. It should ignore the download since it's marked as
354 // being restored from history. 353 // being restored from history.
355 ASSERT_TRUE(manager_observer()); 354 ASSERT_TRUE(manager_observer());
356 manager_observer()->OnDownloadCreated(manager(), item.get()); 355 manager_observer()->OnDownloadCreated(manager(), item.get());
357 356
358 // Finally, the expectation we've been waiting for: 357 // Finally, the expectation we've been waiting for:
359 EXPECT_FALSE(notified_item()); 358 EXPECT_FALSE(notified_item());
360 } 359 }
361 360
362 } // namespace 361 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/download_history_unittest.cc ('k') | chrome/browser/extensions/api/downloads/downloads_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698