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/files/file.h" | 5 #include "base/files/file.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 // Send some data, wait 3/4s of a second, run the message loop, and | 771 // Send some data, wait 3/4s of a second, run the message loop, and |
772 // confirm the values the observer received are correct. | 772 // confirm the values the observer received are correct. |
773 TEST_F(DownloadFileTest, ConfirmUpdate) { | 773 TEST_F(DownloadFileTest, ConfirmUpdate) { |
774 CreateDownloadFile(0, true); | 774 CreateDownloadFile(0, true); |
775 | 775 |
776 const char* chunks1[] = { kTestData1, kTestData2 }; | 776 const char* chunks1[] = { kTestData1, kTestData2 }; |
777 AppendDataToFile(chunks1, 2); | 777 AppendDataToFile(chunks1, 2); |
778 | 778 |
779 // Run the message loops for 750ms and check for results. | 779 // Run the message loops for 750ms and check for results. |
780 loop_.task_runner()->PostDelayedTask(FROM_HERE, | 780 loop_.task_runner()->PostDelayedTask(FROM_HERE, |
781 base::MessageLoop::QuitClosure(), | 781 base::MessageLoop::QuitWhenIdleClosure(), |
782 base::TimeDelta::FromMilliseconds(750)); | 782 base::TimeDelta::FromMilliseconds(750)); |
783 loop_.Run(); | 783 loop_.Run(); |
784 | 784 |
785 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), | 785 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), |
786 bytes_); | 786 bytes_); |
787 EXPECT_EQ(download_file_->GetHashState(), hash_state_); | 787 EXPECT_EQ(download_file_->GetHashState(), hash_state_); |
788 | 788 |
789 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); | 789 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); |
790 DestroyDownloadFile(0); | 790 DestroyDownloadFile(0); |
791 } | 791 } |
792 | 792 |
793 } // namespace content | 793 } // namespace content |
OLD | NEW |