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 #include "chrome/browser/download/download_ui_controller.h" | 5 #include "chrome/browser/download/download_ui_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 download_service->set_download_history(std::move(download_history)); | 199 download_service->set_download_history(std::move(download_history)); |
200 } | 200 } |
201 | 201 |
202 scoped_ptr<MockDownloadItem> | 202 scoped_ptr<MockDownloadItem> |
203 DownloadUIControllerTest::CreateMockInProgressDownload() { | 203 DownloadUIControllerTest::CreateMockInProgressDownload() { |
204 scoped_ptr<MockDownloadItem> item( | 204 scoped_ptr<MockDownloadItem> item( |
205 new testing::StrictMock<MockDownloadItem>()); | 205 new testing::StrictMock<MockDownloadItem>()); |
206 EXPECT_CALL(*item, GetBrowserContext()) | 206 EXPECT_CALL(*item, GetBrowserContext()) |
207 .WillRepeatedly(Return(browser_context())); | 207 .WillRepeatedly(Return(browser_context())); |
208 EXPECT_CALL(*item, GetId()).WillRepeatedly(Return(1)); | 208 EXPECT_CALL(*item, GetId()).WillRepeatedly(Return(1)); |
209 EXPECT_CALL(*item, GetTargetFilePath()).WillRepeatedly( | 209 EXPECT_CALL(*item, GetGuid()) |
210 ReturnRefOfCopy(base::FilePath(FILE_PATH_LITERAL("foo")))); | 210 .WillRepeatedly( |
| 211 ReturnRefOfCopy(std::string("14CA04AF-ECEC-4B13-8829-817477EFAB83"))); |
| 212 EXPECT_CALL(*item, GetTargetFilePath()) |
| 213 .WillRepeatedly( |
| 214 ReturnRefOfCopy(base::FilePath(FILE_PATH_LITERAL("foo")))); |
211 EXPECT_CALL(*item, GetFullPath()).WillRepeatedly( | 215 EXPECT_CALL(*item, GetFullPath()).WillRepeatedly( |
212 ReturnRefOfCopy(base::FilePath(FILE_PATH_LITERAL("foo")))); | 216 ReturnRefOfCopy(base::FilePath(FILE_PATH_LITERAL("foo")))); |
213 EXPECT_CALL(*item, GetState()) | 217 EXPECT_CALL(*item, GetState()) |
214 .WillRepeatedly(Return(content::DownloadItem::IN_PROGRESS)); | 218 .WillRepeatedly(Return(content::DownloadItem::IN_PROGRESS)); |
215 EXPECT_CALL(*item, GetUrlChain()) | 219 EXPECT_CALL(*item, GetUrlChain()) |
216 .WillRepeatedly(testing::ReturnRefOfCopy(std::vector<GURL>())); | 220 .WillRepeatedly(testing::ReturnRefOfCopy(std::vector<GURL>())); |
217 EXPECT_CALL(*item, GetReferrerUrl()) | 221 EXPECT_CALL(*item, GetReferrerUrl()) |
218 .WillRepeatedly(testing::ReturnRefOfCopy(GURL())); | 222 .WillRepeatedly(testing::ReturnRefOfCopy(GURL())); |
219 EXPECT_CALL(*item, GetStartTime()).WillRepeatedly(Return(base::Time())); | 223 EXPECT_CALL(*item, GetStartTime()).WillRepeatedly(Return(base::Time())); |
220 EXPECT_CALL(*item, GetEndTime()).WillRepeatedly(Return(base::Time())); | 224 EXPECT_CALL(*item, GetEndTime()).WillRepeatedly(Return(base::Time())); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 // DownloadUIController. It should ignore the download since it's marked as | 348 // DownloadUIController. It should ignore the download since it's marked as |
345 // being restored from history. | 349 // being restored from history. |
346 ASSERT_TRUE(manager_observer()); | 350 ASSERT_TRUE(manager_observer()); |
347 manager_observer()->OnDownloadCreated(manager(), item.get()); | 351 manager_observer()->OnDownloadCreated(manager(), item.get()); |
348 | 352 |
349 // Finally, the expectation we've been waiting for: | 353 // Finally, the expectation we've been waiting for: |
350 EXPECT_FALSE(notified_item()); | 354 EXPECT_FALSE(notified_item()); |
351 } | 355 } |
352 | 356 |
353 } // namespace | 357 } // namespace |
OLD | NEW |