OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "content/browser/byte_stream.h" | 10 #include "content/browser/byte_stream.h" |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 request_handle.reset(mock_request_handle); | 489 request_handle.reset(mock_request_handle); |
490 | 490 |
491 ON_CALL(*mock_download_file, FullPath()) | 491 ON_CALL(*mock_download_file, FullPath()) |
492 .WillByDefault(Return(base::FilePath())); | 492 .WillByDefault(Return(base::FilePath())); |
493 | 493 |
494 // It's too complicated to set up a WebContents instance that would cause | 494 // It's too complicated to set up a WebContents instance that would cause |
495 // the MockDownloadItemDelegate's ResumeInterruptedDownload() function | 495 // the MockDownloadItemDelegate's ResumeInterruptedDownload() function |
496 // to be callled, so we simply verify that GetWebContents() is called. | 496 // to be callled, so we simply verify that GetWebContents() is called. |
497 if (i < (DownloadItemImpl::kMaxAutoResumeAttempts - 1)) { | 497 if (i < (DownloadItemImpl::kMaxAutoResumeAttempts - 1)) { |
498 EXPECT_CALL(*mock_request_handle, GetWebContents()) | 498 EXPECT_CALL(*mock_request_handle, GetWebContents()) |
499 .WillOnce(Return(static_cast<WebContents*>(NULL))); | 499 .WillRepeatedly(Return(static_cast<WebContents*>(NULL))); |
500 } | 500 } |
501 | 501 |
502 // Copied key parts of DoIntermediateRename & AddDownloadFileToDownloadItem | 502 // Copied key parts of DoIntermediateRename & AddDownloadFileToDownloadItem |
503 // to allow for holding onto the request handle. | 503 // to allow for holding onto the request handle. |
504 item->Start(download_file.Pass(), request_handle.Pass()); | 504 item->Start(download_file.Pass(), request_handle.Pass()); |
505 RunAllPendingInMessageLoops(); | 505 RunAllPendingInMessageLoops(); |
506 if (i == 0) { | 506 if (i == 0) { |
507 // Target determination is only done the first time through. | 507 // Target determination is only done the first time through. |
508 base::FilePath target_path(kDummyPath); | 508 base::FilePath target_path(kDummyPath); |
509 base::FilePath intermediate_path( | 509 base::FilePath intermediate_path( |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 base::Unretained(&returned_path))); | 1267 base::Unretained(&returned_path))); |
1268 RunAllPendingInMessageLoops(); | 1268 RunAllPendingInMessageLoops(); |
1269 EXPECT_TRUE(returned_path.empty()); | 1269 EXPECT_TRUE(returned_path.empty()); |
1270 } | 1270 } |
1271 | 1271 |
1272 TEST(MockDownloadItem, Compiles) { | 1272 TEST(MockDownloadItem, Compiles) { |
1273 MockDownloadItem mock_item; | 1273 MockDownloadItem mock_item; |
1274 } | 1274 } |
1275 | 1275 |
1276 } // namespace content | 1276 } // namespace content |
OLD | NEW |