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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 DownloadInterruptReason interrupt_reason, | 720 DownloadInterruptReason interrupt_reason, |
721 const base::FilePath& new_path) { | 721 const base::FilePath& new_path) { |
722 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); | 722 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
723 *did_run_callback = true; | 723 *did_run_callback = true; |
724 closure.Run(); | 724 closure.Run(); |
725 } | 725 } |
726 | 726 |
727 } // namespace | 727 } // namespace |
728 | 728 |
729 // Test that the retry logic works. This test assumes that DownloadFileImpl will | 729 // Test that the retry logic works. This test assumes that DownloadFileImpl will |
730 // post tasks to the current message loop (acting as the FILE thread) | 730 // post tasks to the current message loop (acting as the download sequence) |
731 // asynchronously to retry the renames. We will stuff RunLoop::QuitClosures() | 731 // asynchronously to retry the renames. We will stuff RunLoop::QuitClosures() |
732 // in between the retry tasks to stagger them and then allow the rename to | 732 // in between the retry tasks to stagger them and then allow the rename to |
733 // succeed. | 733 // succeed. |
734 // | 734 // |
735 // Note that there is only one queue of tasks to run, and that is in the tests' | 735 // Note that there is only one queue of tasks to run, and that is in the tests' |
736 // base::MessageLoop::current(). Each RunLoop processes that queue until it sees | 736 // base::MessageLoop::current(). Each RunLoop processes that queue until it sees |
737 // a QuitClosure() targeted at itself, at which point it stops processing. | 737 // a QuitClosure() targeted at itself, at which point it stops processing. |
738 TEST_P(DownloadFileTestWithRename, RenameWithErrorRetry) { | 738 TEST_P(DownloadFileTestWithRename, RenameWithErrorRetry) { |
739 ASSERT_TRUE(CreateDownloadFile(0, true)); | 739 ASSERT_TRUE(CreateDownloadFile(0, true)); |
740 base::FilePath initial_path(download_file_->FullPath()); | 740 base::FilePath initial_path(download_file_->FullPath()); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 std::unique_ptr<MockByteStreamReader>(additional_streams_[0]), 0, | 1052 std::unique_ptr<MockByteStreamReader>(additional_streams_[0]), 0, |
1053 DownloadSaveInfo::kLengthFullContent); | 1053 DownloadSaveInfo::kLengthFullContent); |
1054 | 1054 |
1055 // The stream should get terminated and reset the callback. | 1055 // The stream should get terminated and reset the callback. |
1056 EXPECT_TRUE(sink_callback_.is_null()); | 1056 EXPECT_TRUE(sink_callback_.is_null()); |
1057 download_file_->Cancel(); | 1057 download_file_->Cancel(); |
1058 DestroyDownloadFile(0, false); | 1058 DestroyDownloadFile(0, false); |
1059 } | 1059 } |
1060 | 1060 |
1061 } // namespace content | 1061 } // namespace content |
OLD | NEW |