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

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

Issue 2720613002: Downloads: Added transient flag to download item and download database (Closed)
Patch Set: fix tests Created 3 years, 8 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 EXPECT_CALL(*item, GetLastReason()) 236 EXPECT_CALL(*item, GetLastReason())
237 .WillRepeatedly(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE)); 237 .WillRepeatedly(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE));
238 EXPECT_CALL(*item, GetReceivedBytes()).WillRepeatedly(Return(0)); 238 EXPECT_CALL(*item, GetReceivedBytes()).WillRepeatedly(Return(0));
239 EXPECT_CALL(*item, GetReceivedSlices()).WillRepeatedly( 239 EXPECT_CALL(*item, GetReceivedSlices()).WillRepeatedly(
240 ReturnRefOfCopy(std::vector<content::DownloadItem::ReceivedSlice>())); 240 ReturnRefOfCopy(std::vector<content::DownloadItem::ReceivedSlice>()));
241 EXPECT_CALL(*item, GetTotalBytes()).WillRepeatedly(Return(0)); 241 EXPECT_CALL(*item, GetTotalBytes()).WillRepeatedly(Return(0));
242 EXPECT_CALL(*item, GetTargetDisposition()).WillRepeatedly( 242 EXPECT_CALL(*item, GetTargetDisposition()).WillRepeatedly(
243 Return(content::DownloadItem::TARGET_DISPOSITION_OVERWRITE)); 243 Return(content::DownloadItem::TARGET_DISPOSITION_OVERWRITE));
244 EXPECT_CALL(*item, GetOpened()).WillRepeatedly(Return(false)); 244 EXPECT_CALL(*item, GetOpened()).WillRepeatedly(Return(false));
245 EXPECT_CALL(*item, GetLastAccessTime()).WillRepeatedly(Return(base::Time())); 245 EXPECT_CALL(*item, GetLastAccessTime()).WillRepeatedly(Return(base::Time()));
246 EXPECT_CALL(*item, IsTransient()).WillRepeatedly(Return(false));
246 EXPECT_CALL(*item, GetMimeType()).WillRepeatedly(Return(std::string())); 247 EXPECT_CALL(*item, GetMimeType()).WillRepeatedly(Return(std::string()));
247 EXPECT_CALL(*item, GetURL()).WillRepeatedly(ReturnRefOfCopy(GURL())); 248 EXPECT_CALL(*item, GetURL()).WillRepeatedly(ReturnRefOfCopy(GURL()));
248 EXPECT_CALL(*item, GetWebContents()).WillRepeatedly(Return(nullptr)); 249 EXPECT_CALL(*item, GetWebContents()).WillRepeatedly(Return(nullptr));
249 EXPECT_CALL(*item, IsTemporary()).WillRepeatedly(Return(false)); 250 EXPECT_CALL(*item, IsTemporary()).WillRepeatedly(Return(false));
250 return item; 251 return item;
251 } 252 }
252 253
253 std::unique_ptr<DownloadUIController::Delegate> 254 std::unique_ptr<DownloadUIController::Delegate>
254 DownloadUIControllerTest::GetTestDelegate() { 255 DownloadUIControllerTest::GetTestDelegate() {
255 std::unique_ptr<DownloadUIController::Delegate> delegate( 256 std::unique_ptr<DownloadUIController::Delegate> delegate(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // DownloadUIController. It should ignore the download since it's marked as 358 // DownloadUIController. It should ignore the download since it's marked as
358 // being restored from history. 359 // being restored from history.
359 ASSERT_TRUE(manager_observer()); 360 ASSERT_TRUE(manager_observer());
360 manager_observer()->OnDownloadCreated(manager(), item.get()); 361 manager_observer()->OnDownloadCreated(manager(), item.get());
361 362
362 // Finally, the expectation we've been waiting for: 363 // Finally, the expectation we've been waiting for:
363 EXPECT_FALSE(notified_item()); 364 EXPECT_FALSE(notified_item());
364 } 365 }
365 366
366 } // namespace 367 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698