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 <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 Loading... | |
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()) |
223 .WillRepeatedly(testing::ReturnRefOfCopy(GURL())); | 223 .WillRepeatedly(ReturnRefOfCopy(GURL())); |
224 EXPECT_CALL(*item, GetTabUrl()) | 224 EXPECT_CALL(*item, GetTabUrl()) |
225 .WillRepeatedly(testing::ReturnRefOfCopy(GURL())); | 225 .WillRepeatedly(ReturnRefOfCopy(GURL())); |
226 EXPECT_CALL(*item, GetTabReferrerUrl()) | 226 EXPECT_CALL(*item, GetTabReferrerUrl()) |
227 .WillRepeatedly(testing::ReturnRefOfCopy(GURL())); | 227 .WillRepeatedly(ReturnRefOfCopy(GURL())); |
228 EXPECT_CALL(*item, GetSiteInstanceUrl()) | |
svaldez
2016/05/05 14:23:27
nit: Same order as elsewhere (Referrer->SiteInstan
asanka
2016/05/05 17:38:05
Done.
| |
229 .WillRepeatedly(ReturnRefOfCopy(GURL())); | |
228 EXPECT_CALL(*item, GetStartTime()).WillRepeatedly(Return(base::Time())); | 230 EXPECT_CALL(*item, GetStartTime()).WillRepeatedly(Return(base::Time())); |
229 EXPECT_CALL(*item, GetEndTime()).WillRepeatedly(Return(base::Time())); | 231 EXPECT_CALL(*item, GetEndTime()).WillRepeatedly(Return(base::Time())); |
230 EXPECT_CALL(*item, GetETag()).WillRepeatedly(ReturnRefOfCopy(std::string())); | 232 EXPECT_CALL(*item, GetETag()).WillRepeatedly(ReturnRefOfCopy(std::string())); |
231 EXPECT_CALL(*item, GetLastModifiedTime()) | 233 EXPECT_CALL(*item, GetLastModifiedTime()) |
232 .WillRepeatedly(ReturnRefOfCopy(std::string())); | 234 .WillRepeatedly(ReturnRefOfCopy(std::string())); |
233 EXPECT_CALL(*item, GetDangerType()) | 235 EXPECT_CALL(*item, GetDangerType()) |
234 .WillRepeatedly(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); | 236 .WillRepeatedly(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); |
235 EXPECT_CALL(*item, GetLastReason()) | 237 EXPECT_CALL(*item, GetLastReason()) |
236 .WillRepeatedly(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE)); | 238 .WillRepeatedly(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE)); |
237 EXPECT_CALL(*item, GetReceivedBytes()).WillRepeatedly(Return(0)); | 239 EXPECT_CALL(*item, GetReceivedBytes()).WillRepeatedly(Return(0)); |
238 EXPECT_CALL(*item, GetTotalBytes()).WillRepeatedly(Return(0)); | 240 EXPECT_CALL(*item, GetTotalBytes()).WillRepeatedly(Return(0)); |
239 EXPECT_CALL(*item, GetTargetDisposition()).WillRepeatedly( | 241 EXPECT_CALL(*item, GetTargetDisposition()).WillRepeatedly( |
240 Return(content::DownloadItem::TARGET_DISPOSITION_OVERWRITE)); | 242 Return(content::DownloadItem::TARGET_DISPOSITION_OVERWRITE)); |
241 EXPECT_CALL(*item, GetOpened()).WillRepeatedly(Return(false)); | 243 EXPECT_CALL(*item, GetOpened()).WillRepeatedly(Return(false)); |
242 EXPECT_CALL(*item, GetMimeType()).WillRepeatedly(Return(std::string())); | 244 EXPECT_CALL(*item, GetMimeType()).WillRepeatedly(Return(std::string())); |
243 EXPECT_CALL(*item, GetURL()).WillRepeatedly(testing::ReturnRefOfCopy(GURL())); | 245 EXPECT_CALL(*item, GetURL()).WillRepeatedly(ReturnRefOfCopy(GURL())); |
244 EXPECT_CALL(*item, GetWebContents()).WillRepeatedly(Return(nullptr)); | 246 EXPECT_CALL(*item, GetWebContents()).WillRepeatedly(Return(nullptr)); |
245 EXPECT_CALL(*item, IsTemporary()).WillRepeatedly(Return(false)); | 247 EXPECT_CALL(*item, IsTemporary()).WillRepeatedly(Return(false)); |
246 return item; | 248 return item; |
247 } | 249 } |
248 | 250 |
249 std::unique_ptr<DownloadUIController::Delegate> | 251 std::unique_ptr<DownloadUIController::Delegate> |
250 DownloadUIControllerTest::GetTestDelegate() { | 252 DownloadUIControllerTest::GetTestDelegate() { |
251 std::unique_ptr<DownloadUIController::Delegate> delegate( | 253 std::unique_ptr<DownloadUIController::Delegate> delegate( |
252 new TestDelegate(notified_item_receiver_factory_.GetWeakPtr())); | 254 new TestDelegate(notified_item_receiver_factory_.GetWeakPtr())); |
253 return delegate; | 255 return delegate; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
353 // DownloadUIController. It should ignore the download since it's marked as | 355 // DownloadUIController. It should ignore the download since it's marked as |
354 // being restored from history. | 356 // being restored from history. |
355 ASSERT_TRUE(manager_observer()); | 357 ASSERT_TRUE(manager_observer()); |
356 manager_observer()->OnDownloadCreated(manager(), item.get()); | 358 manager_observer()->OnDownloadCreated(manager(), item.get()); |
357 | 359 |
358 // Finally, the expectation we've been waiting for: | 360 // Finally, the expectation we've been waiting for: |
359 EXPECT_FALSE(notified_item()); | 361 EXPECT_FALSE(notified_item()); |
360 } | 362 } |
361 | 363 |
362 } // namespace | 364 } // namespace |
OLD | NEW |