Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(901)

Side by Side Diff: content/browser/download/download_file_unittest.cc

Issue 1398153002: Don't use base::MessageLoop::{Quit,QuitClosure} in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | content/browser/download/drag_download_file_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698