diff options
158 files changed, 1123 insertions, 1088 deletions
diff --git a/net/android/network_change_notifier_android_unittest.cc b/net/android/network_change_notifier_android_unittest.cc index 7fb8e6b..e629ace 100644 --- a/net/android/network_change_notifier_android_unittest.cc +++ b/net/android/network_change_notifier_android_unittest.cc @@ -93,13 +93,13 @@ class BaseNetworkChangeNotifierAndroidTest : public testing::Test { void SetOnline() { delegate_.SetOnline(); // Note that this is needed because ObserverListThreadSafe uses PostTask(). - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } void SetOffline() { delegate_.SetOffline(); // See comment above. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } NetworkChangeNotifierDelegateAndroid delegate_; diff --git a/net/base/address_tracker_linux.cc b/net/base/address_tracker_linux.cc index b88b033..886811a 100644 --- a/net/base/address_tracker_linux.cc +++ b/net/base/address_tracker_linux.cc @@ -157,8 +157,8 @@ void AddressTrackerLinux::Init() { is_offline_initialized_cv_.Signal(); } - rv = MessageLoopForIO::current()->WatchFileDescriptor( - netlink_fd_, true, MessageLoopForIO::WATCH_READ, &watcher_, this); + rv = base::MessageLoopForIO::current()->WatchFileDescriptor( + netlink_fd_, true, base::MessageLoopForIO::WATCH_READ, &watcher_, this); if (rv < 0) { PLOG(ERROR) << "Could not watch NETLINK socket"; AbortAndForceOnline(); diff --git a/net/base/address_tracker_linux.h b/net/base/address_tracker_linux.h index 87ce139..ee108c3 100644 --- a/net/base/address_tracker_linux.h +++ b/net/base/address_tracker_linux.h @@ -28,8 +28,8 @@ namespace internal { // Keeps track of network interface addresses using rtnetlink. Used by // NetworkChangeNotifier to provide signals to registered IPAddressObservers. -class NET_EXPORT_PRIVATE AddressTrackerLinux - : public MessageLoopForIO::Watcher { +class NET_EXPORT_PRIVATE AddressTrackerLinux : + public base::MessageLoopForIO::Watcher { public: typedef std::map<IPAddressNumber, struct ifaddrmsg> AddressMap; @@ -79,7 +79,7 @@ class NET_EXPORT_PRIVATE AddressTrackerLinux base::Closure link_callback_; int netlink_fd_; - MessageLoopForIO::FileDescriptorWatcher watcher_; + base::MessageLoopForIO::FileDescriptorWatcher watcher_; mutable base::Lock address_map_lock_; AddressMap address_map_; diff --git a/net/base/directory_lister_unittest.cc b/net/base/directory_lister_unittest.cc index b088c8e..770aa6d 100644 --- a/net/base/directory_lister_unittest.cc +++ b/net/base/directory_lister_unittest.cc @@ -32,12 +32,12 @@ class ListerDelegate : public DirectoryLister::DirectoryListerDelegate { file_list_.push_back(data.info); paths_.push_back(data.path); if (quit_loop_after_each_file_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } virtual void OnListDone(int error) OVERRIDE { error_ = error; - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); if (recursive_) CheckRecursiveSort(); else @@ -143,7 +143,7 @@ TEST_F(DirectoryListerTest, BigDirTest) { DirectoryLister lister(root_path(), &delegate); lister.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(OK, delegate.error()); } @@ -154,7 +154,7 @@ TEST_F(DirectoryListerTest, BigDirRecursiveTest) { &delegate); lister.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(OK, delegate.error()); } @@ -164,13 +164,13 @@ TEST_F(DirectoryListerTest, CancelTest) { DirectoryLister lister(root_path(), &delegate); lister.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int num_files = delegate.num_files(); lister.Cancel(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(num_files, delegate.num_files()); } @@ -185,7 +185,7 @@ TEST_F(DirectoryListerTest, EmptyDirTest) { DirectoryLister lister(tempDir.path(), &delegate); lister.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Contains only the parent directory ("..") EXPECT_EQ(1, delegate.num_files()); diff --git a/net/base/dns_reloader.cc b/net/base/dns_reloader.cc index 0cabd4c..f17c109 100644 --- a/net/base/dns_reloader.cc +++ b/net/base/dns_reloader.cc @@ -47,7 +47,7 @@ class DnsReloader : public net::NetworkChangeNotifier::DNSObserver { // NetworkChangeNotifier::DNSObserver: virtual void OnDNSChanged() OVERRIDE { - DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_IO); + DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_IO); base::AutoLock l(lock_); resolver_generation_++; } diff --git a/net/base/file_stream_context.h b/net/base/file_stream_context.h index 34effea..6f71efa 100644 --- a/net/base/file_stream_context.h +++ b/net/base/file_stream_context.h @@ -48,7 +48,7 @@ namespace net { class IOBuffer; #if defined(OS_WIN) -class FileStream::Context : public MessageLoopForIO::IOHandler { +class FileStream::Context : public base::MessageLoopForIO::IOHandler { #elif defined(OS_POSIX) class FileStream::Context { #endif @@ -192,7 +192,7 @@ class FileStream::Context { void IOCompletionIsPending(const CompletionCallback& callback, IOBuffer* buf); // Implementation of MessageLoopForIO::IOHandler. - virtual void OnIOCompleted(MessageLoopForIO::IOContext* context, + virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, DWORD bytes_read, DWORD error) OVERRIDE; #elif defined(OS_POSIX) @@ -213,7 +213,7 @@ class FileStream::Context { BoundNetLog bound_net_log_; #if defined(OS_WIN) - MessageLoopForIO::IOContext io_context_; + base::MessageLoopForIO::IOContext io_context_; CompletionCallback callback_; scoped_refptr<IOBuffer> in_flight_buf_; FileErrorSource error_source_; diff --git a/net/base/file_stream_context_win.cc b/net/base/file_stream_context_win.cc index 7072f1d..565e18b 100644 --- a/net/base/file_stream_context_win.cc +++ b/net/base/file_stream_context_win.cc @@ -170,7 +170,7 @@ int FileStream::Context::Truncate(int64 bytes) { } void FileStream::Context::OnAsyncFileOpened() { - MessageLoopForIO::current()->RegisterIOHandler(file_, this); + base::MessageLoopForIO::current()->RegisterIOHandler(file_, this); } FileStream::Context::IOResult FileStream::Context::SeekFileImpl(Whence whence, @@ -202,9 +202,10 @@ void FileStream::Context::IOCompletionIsPending( async_in_progress_ = true; } -void FileStream::Context::OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD bytes_read, - DWORD error) { +void FileStream::Context::OnIOCompleted( + base::MessageLoopForIO::IOContext* context, + DWORD bytes_read, + DWORD error) { DCHECK_EQ(&io_context_, context); DCHECK(!callback_.is_null()); DCHECK(async_in_progress_); diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index 0593c4f..efbde33 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -239,7 +239,7 @@ TEST_F(FileStreamTest, AsyncRead_EarlyDelete) { if (rv < 0) { EXPECT_EQ(ERR_IO_PENDING, rv); // The callback should not be called if the request is cancelled. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(callback.have_result()); } else { EXPECT_EQ(std::string(kTestData, rv), std::string(buf->data(), rv)); @@ -460,7 +460,7 @@ TEST_F(FileStreamTest, AsyncWrite_EarlyDelete) { if (rv < 0) { EXPECT_EQ(ERR_IO_PENDING, rv); // The callback should not be called if the request is cancelled. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(callback.have_result()); } else { ok = file_util::GetFileSize(temp_file_path(), &file_size); @@ -780,7 +780,7 @@ class TestWriteReadCompletionCallback { DCHECK(!waiting_for_result_); while (!have_result_) { waiting_for_result_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_result_ = false; } have_result_ = false; // auto-reset for next callback @@ -818,7 +818,8 @@ class TestWriteReadCompletionCallback { scoped_refptr<IOBufferWithSize> buf = new IOBufferWithSize(4); rv = stream_->Read(buf, buf->size(), callback.callback()); if (rv == ERR_IO_PENDING) { - MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); + base::MessageLoop::ScopedNestableTaskAllower allow( + base::MessageLoop::current()); rv = callback.WaitForResult(); } EXPECT_LE(0, rv); @@ -832,7 +833,7 @@ class TestWriteReadCompletionCallback { result_ = *total_bytes_written_; have_result_ = true; if (waiting_for_result_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } int result_; @@ -913,7 +914,7 @@ class TestWriteCloseCompletionCallback { DCHECK(!waiting_for_result_); while (!have_result_) { waiting_for_result_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_result_ = false; } have_result_ = false; // auto-reset for next callback @@ -944,7 +945,7 @@ class TestWriteCloseCompletionCallback { result_ = *total_bytes_written_; have_result_ = true; if (waiting_for_result_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } int result_; @@ -1037,7 +1038,7 @@ TEST_F(FileStreamTest, AsyncOpenAndDelete) { // complete. Should be safe. stream.reset(); // open_callback won't be called. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(open_callback.have_result()); } diff --git a/net/base/network_change_notifier_linux.cc b/net/base/network_change_notifier_linux.cc index 1a16f04..19da249 100644 --- a/net/base/network_change_notifier_linux.cc +++ b/net/base/network_change_notifier_linux.cc @@ -74,7 +74,7 @@ NetworkChangeNotifierLinux::NetworkChangeNotifierLinux() // We create this notifier thread because the notification implementation // needs a MessageLoopForIO, and there's no guarantee that // MessageLoop::current() meets that criterion. - base::Thread::Options thread_options(MessageLoop::TYPE_IO, 0); + base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); notifier_thread_->StartWithOptions(thread_options); } diff --git a/net/base/network_change_notifier_mac.cc b/net/base/network_change_notifier_mac.cc index 2c350df..4fe0641 100644 --- a/net/base/network_change_notifier_mac.cc +++ b/net/base/network_change_notifier_mac.cc @@ -73,7 +73,7 @@ NetworkChangeNotifierMac::NetworkChangeNotifierMac() // SetInitialConnectionType(). config_watcher_.reset(new NetworkConfigWatcherMac(&forwarder_)); dns_config_service_thread_->StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0)); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); } NetworkChangeNotifierMac::~NetworkChangeNotifierMac() { diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc index f24ec53..ad18c1c 100644 --- a/net/base/network_change_notifier_win.cc +++ b/net/base/network_change_notifier_win.cc @@ -61,7 +61,7 @@ NetworkChangeNotifierWin::NetworkChangeNotifierWin() memset(&addr_overlapped_, 0, sizeof addr_overlapped_); addr_overlapped_.hEvent = WSACreateEvent(); dns_config_service_thread_->StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0)); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); } NetworkChangeNotifierWin::~NetworkChangeNotifierWin() { @@ -253,7 +253,7 @@ void NetworkChangeNotifierWin::WatchForAddressChange() { sequential_failures_); } - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&NetworkChangeNotifierWin::WatchForAddressChange, weak_factory_.GetWeakPtr()), diff --git a/net/base/network_change_notifier_win_unittest.cc b/net/base/network_change_notifier_win_unittest.cc index a418ba7..f9c7fb4 100644 --- a/net/base/network_change_notifier_win_unittest.cc +++ b/net/base/network_change_notifier_win_unittest.cc @@ -61,7 +61,7 @@ class TestIPAddressObserver }; bool ExitMessageLoopAndReturnFalse() { - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); return false; } @@ -89,7 +89,7 @@ class NetworkChangeNotifierWinTest : public testing::Test { // If a task to notify observers of the IP address change event was // incorrectly posted, make sure it gets run to trigger a failure. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Calls WatchForAddressChange, and simulates a WatchForAddressChangeInternal @@ -112,7 +112,7 @@ class NetworkChangeNotifierWinTest : public testing::Test { // If a task to notify observers of the IP address change event was // incorrectly posted, make sure it gets run. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Simulates a network change event, resulting in a call to OnObjectSignaled. @@ -132,7 +132,7 @@ class NetworkChangeNotifierWinTest : public testing::Test { EXPECT_EQ(0, network_change_notifier_.sequential_failures()); // Run the task to notify observers of the IP address change event. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Simulates a network change event, resulting in a call to OnObjectSignaled. @@ -154,7 +154,7 @@ class NetworkChangeNotifierWinTest : public testing::Test { EXPECT_LT(0, network_change_notifier_.sequential_failures()); // Run the task to notify observers of the IP address change event. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Runs the message loop until WatchForAddressChange is called again, as a @@ -165,14 +165,13 @@ class NetworkChangeNotifierWinTest : public testing::Test { EXPECT_FALSE(network_change_notifier_.is_watching()); EXPECT_LT(0, network_change_notifier_.sequential_failures()); - EXPECT_CALL(test_ip_address_observer_, OnIPAddressChanged()) - .Times(1) - .WillOnce(Invoke(MessageLoop::current(), &MessageLoop::Quit)); + EXPECT_CALL(test_ip_address_observer_, OnIPAddressChanged()).Times(1) + .WillOnce( + Invoke(base::MessageLoop::current(), &base::MessageLoop::Quit)); EXPECT_CALL(network_change_notifier_, WatchForAddressChangeInternal()) - .Times(1) - .WillOnce(Return(true)); + .Times(1).WillOnce(Return(true)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(network_change_notifier_.is_watching()); EXPECT_EQ(0, network_change_notifier_.sequential_failures()); @@ -196,7 +195,7 @@ class NetworkChangeNotifierWinTest : public testing::Test { .Times(AtLeast(1)) .WillRepeatedly(Invoke(ExitMessageLoopAndReturnFalse)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_FALSE(network_change_notifier_.is_watching()); EXPECT_LT(initial_sequential_failures, @@ -204,7 +203,7 @@ class NetworkChangeNotifierWinTest : public testing::Test { // If a task to notify observers of the IP address change event was // incorrectly posted, make sure it gets run. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } private: diff --git a/net/base/network_config_watcher_mac.cc b/net/base/network_config_watcher_mac.cc index 60d5b71..6d044ac 100644 --- a/net/base/network_config_watcher_mac.cc +++ b/net/base/network_config_watcher_mac.cc @@ -123,7 +123,7 @@ NetworkConfigWatcherMac::NetworkConfigWatcherMac(Delegate* delegate) // We create this notifier thread because the notification implementation // needs a thread with a CFRunLoop, and there's no guarantee that // MessageLoop::current() meets that criterion. - base::Thread::Options thread_options(MessageLoop::TYPE_UI, 0); + base::Thread::Options thread_options(base::MessageLoop::TYPE_UI, 0); notifier_thread_->StartWithOptions(thread_options); } diff --git a/net/base/network_time_notifier.cc b/net/base/network_time_notifier.cc index fedd052..61ac14f 100644 --- a/net/base/network_time_notifier.cc +++ b/net/base/network_time_notifier.cc @@ -65,7 +65,7 @@ void NetworkTimeNotifier::UpdateNetworkTime(const base::Time& network_time, base::TimeDelta::FromMilliseconds(kTicksResolutionMs); for (size_t i = 0; i < observers_.size(); ++i) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(observers_[i], network_time_, @@ -79,7 +79,7 @@ void NetworkTimeNotifier::AddObserver( DCHECK(thread_checker_.CalledOnValidThread()); observers_.push_back(observer_callback); if (!network_time_.is_null()) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(observer_callback, network_time_, diff --git a/net/base/test_completion_callback.cc b/net/base/test_completion_callback.cc index 99d0832..6ad84f7 100644 --- a/net/base/test_completion_callback.cc +++ b/net/base/test_completion_callback.cc @@ -17,14 +17,14 @@ namespace internal { void TestCompletionCallbackBaseInternal::DidSetResult() { have_result_ = true; if (waiting_for_result_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } void TestCompletionCallbackBaseInternal::WaitForResult() { DCHECK(!waiting_for_result_); while (!have_result_) { waiting_for_result_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_result_ = false; } have_result_ = false; // Auto-reset for next callback. diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc index e408a70..20b59e1 100644 --- a/net/base/test_completion_callback_unittest.cc +++ b/net/base/test_completion_callback_unittest.cc @@ -43,9 +43,9 @@ class ExampleEmployer::ExampleWorker public: ExampleWorker(ExampleEmployer* employer, const net::CompletionCallback& callback) - : employer_(employer), callback_(callback), - origin_loop_(MessageLoop::current()) { - } + : employer_(employer), + callback_(callback), + origin_loop_(base::MessageLoop::current()) {} void DoWork(); void DoCallback(); private: @@ -58,7 +58,7 @@ class ExampleEmployer::ExampleWorker net::CompletionCallback callback_; // Used to post ourselves onto the origin thread. base::Lock origin_loop_lock_; - MessageLoop* origin_loop_; + base::MessageLoop* origin_loop_; }; void ExampleEmployer::ExampleWorker::DoWork() { diff --git a/net/base/upload_data_stream_unittest.cc b/net/base/upload_data_stream_unittest.cc index c639535..f3856f1 100644 --- a/net/base/upload_data_stream_unittest.cc +++ b/net/base/upload_data_stream_unittest.cc @@ -89,8 +89,8 @@ class MockUploadElementReader : public UploadElementReader { private: void OnInit(const CompletionCallback& callback) { - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(callback, init_result_)); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::Bind(callback, init_result_)); } int OnRead(IOBuffer* buf, @@ -101,8 +101,8 @@ class MockUploadElementReader : public UploadElementReader { if (IsInMemory()) { return read_result_; } else { - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(callback, read_result_)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(callback, read_result_)); return ERR_IO_PENDING; } } @@ -490,7 +490,7 @@ TEST_F(UploadDataStreamTest, ReadAsync) { TestCompletionCallback read_callback1; EXPECT_EQ(static_cast<int>(kTestDataSize), stream.Read(buf, kTestDataSize, read_callback1.callback())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(read_callback1.have_result()); // Consume the second element. diff --git a/net/cert/cert_database_mac.cc b/net/cert/cert_database_mac.cc index c8fcf47..56bf0d7 100644 --- a/net/cert/cert_database_mac.cc +++ b/net/cert/cert_database_mac.cc @@ -26,12 +26,12 @@ class CertDatabase::Notifier { // Creates a new Notifier that will forward Keychain events to |cert_db|. // |message_loop| must refer to a thread with an associated CFRunLoop - a // TYPE_UI thread. Events will be dispatched from this message loop. - Notifier(CertDatabase* cert_db, MessageLoop* message_loop) + Notifier(CertDatabase* cert_db, base::MessageLoop* message_loop) : cert_db_(cert_db), registered_(false), called_shutdown_(false) { // Ensure an associated CFRunLoop. - DCHECK(message_loop->IsType(MessageLoop::TYPE_UI)); + DCHECK(message_loop->IsType(base::MessageLoop::TYPE_UI)); task_runner_ = message_loop->message_loop_proxy(); task_runner_->PostTask(FROM_HERE, base::Bind(&Notifier::Init, @@ -115,7 +115,7 @@ void CertDatabase::SetMessageLoopForKeychainEvents() { if (notifier_.get()) notifier_.release()->Shutdown(); - notifier_.reset(new Notifier(this, MessageLoopForUI::current())); + notifier_.reset(new Notifier(this, base::MessageLoopForUI::current())); } CertDatabase::CertDatabase() diff --git a/net/cert/multi_threaded_cert_verifier.cc b/net/cert/multi_threaded_cert_verifier.cc index daac0d0..432dda05 100644 --- a/net/cert/multi_threaded_cert_verifier.cc +++ b/net/cert/multi_threaded_cert_verifier.cc @@ -196,7 +196,7 @@ class CertVerifierWorker { flags_(flags), crl_set_(crl_set), additional_trust_anchors_(additional_trust_anchors), - origin_loop_(MessageLoop::current()), + origin_loop_(base::MessageLoop::current()), cert_verifier_(cert_verifier), canceled_(false), error_(ERR_FAILED) { @@ -207,7 +207,7 @@ class CertVerifierWorker { X509Certificate* certificate() const { return cert_; } bool Start() { - DCHECK_EQ(MessageLoop::current(), origin_loop_); + DCHECK_EQ(base::MessageLoop::current(), origin_loop_); return base::WorkerPool::PostTask( FROM_HERE, base::Bind(&CertVerifierWorker::Run, base::Unretained(this)), @@ -217,7 +217,7 @@ class CertVerifierWorker { // Cancel is called from the origin loop when the MultiThreadedCertVerifier is // getting deleted. void Cancel() { - DCHECK_EQ(MessageLoop::current(), origin_loop_); + DCHECK_EQ(base::MessageLoop::current(), origin_loop_); base::AutoLock locked(lock_); canceled_ = true; } @@ -242,7 +242,7 @@ class CertVerifierWorker { // DoReply runs on the origin thread. void DoReply() { - DCHECK_EQ(MessageLoop::current(), origin_loop_); + DCHECK_EQ(base::MessageLoop::current(), origin_loop_); { // We lock here because the worker thread could still be in Finished, // after the PostTask, but before unlocking |lock_|. If we do not lock in @@ -291,7 +291,7 @@ class CertVerifierWorker { const int flags_; scoped_refptr<CRLSet> crl_set_; const CertificateList additional_trust_anchors_; - MessageLoop* const origin_loop_; + base::MessageLoop* const origin_loop_; MultiThreadedCertVerifier* const cert_verifier_; // lock_ protects canceled_. diff --git a/net/cert/nss_cert_database_unittest.cc b/net/cert/nss_cert_database_unittest.cc index 2f6fbeb..db27125 100644 --- a/net/cert/nss_cert_database_unittest.cc +++ b/net/cert/nss_cert_database_unittest.cc @@ -59,7 +59,7 @@ class CertDatabaseNSSTest : public testing::Test { // Run the message loop to process any observer callbacks (e.g. for the // ClientSocketFactory singleton) so that the scoped ref ptrs created in // NSSCertDatabase::NotifyObservers* get released. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0U, ListCertsInSlot(slot_->os_module_handle()).size()); } diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc index fea5e3b3..9cb26f0 100644 --- a/net/cookies/cookie_monster.cc +++ b/net/cookies/cookie_monster.cc @@ -1225,7 +1225,7 @@ void CookieMonster::FlushStore(const base::Closure& callback) { if (initialized_ && store_) store_->Flush(callback); else if (!callback.is_null()) - MessageLoop::current()->PostTask(FROM_HERE, callback); + base::MessageLoop::current()->PostTask(FROM_HERE, callback); } bool CookieMonster::SetCookieWithOptions(const GURL& url, diff --git a/net/cookies/cookie_monster_perftest.cc b/net/cookies/cookie_monster_perftest.cc index a765716..cc8604d 100644 --- a/net/cookies/cookie_monster_perftest.cc +++ b/net/cookies/cookie_monster_perftest.cc @@ -30,10 +30,10 @@ int CountInString(const std::string& str, char c) { class CookieMonsterTest : public testing::Test { public: - CookieMonsterTest() : message_loop_(new MessageLoopForIO()) {} + CookieMonsterTest() : message_loop_(new base::MessageLoopForIO()) {} private: - scoped_ptr<MessageLoop> message_loop_; + scoped_ptr<base::MessageLoop> message_loop_; }; class BaseCallback { @@ -47,7 +47,7 @@ class BaseCallback { // Therefore, callbacks will actually always complete synchronously. If the // tests get more advanced we need to add other means of signaling // completion. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(has_run_); has_run_ = false; } @@ -145,7 +145,7 @@ TEST_F(CookieMonsterTest, TestAddCookiesOnSingleHost) { PerfTimeLogger timer3("Cookie_monster_deleteall_single_host"); cm->DeleteAllAsync(CookieMonster::DeleteCallback()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); timer3.Done(); } @@ -178,7 +178,7 @@ TEST_F(CookieMonsterTest, TestAddCookieOnManyHosts) { PerfTimeLogger timer3("Cookie_monster_deleteall_many_hosts"); cm->DeleteAllAsync(CookieMonster::DeleteCallback()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); timer3.Done(); } diff --git a/net/cookies/cookie_monster_store_test.cc b/net/cookies/cookie_monster_store_test.cc index 9892fe7..04e39ed 100644 --- a/net/cookies/cookie_monster_store_test.cc +++ b/net/cookies/cookie_monster_store_test.cc @@ -41,9 +41,10 @@ void MockPersistentCookieStore::Load(const LoadedCallback& loaded_callback) { out_cookies = load_result_; loaded_ = true; } - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&LoadedCallbackTask::Run, - new LoadedCallbackTask(loaded_callback, out_cookies))); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&LoadedCallbackTask::Run, + new LoadedCallbackTask(loaded_callback, out_cookies))); } void MockPersistentCookieStore::LoadCookiesForKey( @@ -52,10 +53,11 @@ void MockPersistentCookieStore::LoadCookiesForKey( if (!loaded_) { Load(loaded_callback); } else { - MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&LoadedCallbackTask::Run, - new LoadedCallbackTask(loaded_callback, - std::vector<CanonicalCookie*>()))); + new LoadedCallbackTask(loaded_callback, + std::vector<CanonicalCookie*>()))); } } @@ -77,7 +79,7 @@ void MockPersistentCookieStore::DeleteCookie(const CanonicalCookie& cookie) { void MockPersistentCookieStore::Flush(const base::Closure& callback) { if (!callback.is_null()) - MessageLoop::current()->PostTask(FROM_HERE, callback); + base::MessageLoop::current()->PostTask(FROM_HERE, callback); } void MockPersistentCookieStore::SetForceKeepSessionState() { @@ -144,9 +146,10 @@ void MockSimplePersistentCookieStore::Load( it != cookies_.end(); it++) out_cookies.push_back(new CanonicalCookie(it->second)); - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&LoadedCallbackTask::Run, - new LoadedCallbackTask(loaded_callback, out_cookies))); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&LoadedCallbackTask::Run, + new LoadedCallbackTask(loaded_callback, out_cookies))); loaded_ = true; } @@ -155,10 +158,11 @@ void MockSimplePersistentCookieStore::LoadCookiesForKey(const std::string& key, if (!loaded_) { Load(loaded_callback); } else { - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&LoadedCallbackTask::Run, - new LoadedCallbackTask(loaded_callback, - std::vector<CanonicalCookie*>()))); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&LoadedCallbackTask::Run, + new LoadedCallbackTask(loaded_callback, + std::vector<CanonicalCookie*>()))); } } @@ -185,7 +189,7 @@ void MockSimplePersistentCookieStore::DeleteCookie( void MockSimplePersistentCookieStore::Flush(const base::Closure& callback) { if (!callback.is_null()) - MessageLoop::current()->PostTask(FROM_HERE, callback); + base::MessageLoop::current()->PostTask(FROM_HERE, callback); } void MockSimplePersistentCookieStore::SetForceKeepSessionState() { diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc index 0fbfe4e..7b45a4b 100644 --- a/net/cookies/cookie_monster_unittest.cc +++ b/net/cookies/cookie_monster_unittest.cc @@ -637,7 +637,8 @@ struct CookiesInputInfo { }; ACTION(QuitCurrentMessageLoop) { - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } // TODO(erikwright): When the synchronous helpers 'GetCookies' etc. are removed, @@ -2003,9 +2004,10 @@ class FlushablePersistentStore : public CookieMonster::PersistentCookieStore { virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE { std::vector<CanonicalCookie*> out_cookies; - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&net::LoadedCallbackTask::Run, - new net::LoadedCallbackTask(loaded_callback, out_cookies))); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&net::LoadedCallbackTask::Run, + new net::LoadedCallbackTask(loaded_callback, out_cookies))); } virtual void LoadCookiesForKey( @@ -2068,14 +2070,14 @@ TEST_F(CookieMonsterTest, FlushStore) { // Before initialization, FlushStore() should just run the callback. cm->FlushStore(base::Bind(&CallbackCounter::Callback, counter.get())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_EQ(0, store->flush_count()); ASSERT_EQ(1, counter->callback_count()); // NULL callback is safe. cm->FlushStore(base::Closure()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_EQ(0, store->flush_count()); ASSERT_EQ(1, counter->callback_count()); @@ -2083,14 +2085,14 @@ TEST_F(CookieMonsterTest, FlushStore) { // After initialization, FlushStore() should delegate to the store. GetAllCookies(cm); // Force init. cm->FlushStore(base::Bind(&CallbackCounter::Callback, counter.get())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_EQ(1, store->flush_count()); ASSERT_EQ(2, counter->callback_count()); // NULL callback is still safe. cm->FlushStore(base::Closure()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_EQ(2, store->flush_count()); ASSERT_EQ(2, counter->callback_count()); @@ -2099,12 +2101,12 @@ TEST_F(CookieMonsterTest, FlushStore) { cm = new CookieMonster(NULL, NULL); GetAllCookies(cm); // Force init. cm->FlushStore(base::Closure()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_EQ(2, counter->callback_count()); cm->FlushStore(base::Bind(&CallbackCounter::Callback, counter.get())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_EQ(3, counter->callback_count()); } diff --git a/net/cookies/cookie_store_test_callbacks.cc b/net/cookies/cookie_store_test_callbacks.cc index 861a512..638d95f 100644 --- a/net/cookies/cookie_store_test_callbacks.cc +++ b/net/cookies/cookie_store_test_callbacks.cc @@ -14,18 +14,18 @@ CookieCallback::CookieCallback(base::Thread* run_in_thread) : did_run_(false), run_in_thread_(run_in_thread), run_in_loop_(NULL), - parent_loop_(MessageLoop::current()), - loop_to_quit_(MessageLoop::current()) {} + parent_loop_(base::MessageLoop::current()), + loop_to_quit_(base::MessageLoop::current()) {} CookieCallback::CookieCallback() : did_run_(false), run_in_thread_(NULL), - run_in_loop_(MessageLoop::current()), + run_in_loop_(base::MessageLoop::current()), parent_loop_(NULL), - loop_to_quit_(MessageLoop::current()) {} + loop_to_quit_(base::MessageLoop::current()) {} void CookieCallback::CallbackEpilogue() { - MessageLoop* expected_loop = NULL; + base::MessageLoop* expected_loop = NULL; if (run_in_thread_) { DCHECK(!run_in_loop_); expected_loop = run_in_thread_->message_loop(); @@ -35,8 +35,8 @@ void CookieCallback::CallbackEpilogue() { ASSERT_TRUE(expected_loop != NULL); did_run_ = true; - EXPECT_EQ(expected_loop, MessageLoop::current()); - loop_to_quit_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + EXPECT_EQ(expected_loop, base::MessageLoop::current()); + loop_to_quit_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } BoolResultCookieCallback::BoolResultCookieCallback() : result_(false) {} diff --git a/net/cookies/cookie_store_test_helpers.cc b/net/cookies/cookie_store_test_helpers.cc index 6ae4357d..dfd1abc 100644 --- a/net/cookies/cookie_store_test_helpers.cc +++ b/net/cookies/cookie_store_test_helpers.cc @@ -42,10 +42,11 @@ void DelayedCookieMonster::SetCookieWithOptionsAsync( base::Bind(&DelayedCookieMonster::SetCookiesInternalCallback, base::Unretained(this))); DCHECK_EQ(did_run_, true); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&DelayedCookieMonster::InvokeSetCookiesCallback, - base::Unretained(this), callback), + base::Unretained(this), + callback), base::TimeDelta::FromMilliseconds(kDelayedTime)); } @@ -59,10 +60,11 @@ void DelayedCookieMonster::GetCookiesWithOptionsAsync( base::Bind(&DelayedCookieMonster::GetCookiesWithOptionsInternalCallback, base::Unretained(this))); DCHECK_EQ(did_run_, true); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&DelayedCookieMonster::InvokeGetCookieStringCallback, - base::Unretained(this), callback), + base::Unretained(this), + callback), base::TimeDelta::FromMilliseconds(kDelayedTime)); } diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h index bb0d42e..1ff1d29 100644 --- a/net/cookies/cookie_store_unittest.h +++ b/net/cookies/cookie_store_unittest.h @@ -75,10 +75,10 @@ class CookieStoreTest : public testing::Test { url_google_bar_(kUrlGoogleBar) { // This test may be used outside of the net test suite, and thus may not // have a message loop. - if (!MessageLoop::current()) - message_loop_.reset(new MessageLoop); - weak_factory_.reset( - new base::WeakPtrFactory<MessageLoop>(MessageLoop::current())); + if (!base::MessageLoop::current()) + message_loop_.reset(new base::MessageLoop); + weak_factory_.reset(new base::WeakPtrFactory<base::MessageLoop>( + base::MessageLoop::current())); } // Helper methods for the asynchronous Cookie Store API that call the @@ -185,10 +185,11 @@ class CookieStoreTest : public testing::Test { void RunFor(int ms) { // Runs the test thread message loop for up to |ms| milliseconds. - MessageLoop::current()->PostDelayedTask( - FROM_HERE, base::Bind(&MessageLoop::Quit, weak_factory_->GetWeakPtr()), + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&base::MessageLoop::Quit, weak_factory_->GetWeakPtr()), base::TimeDelta::FromMilliseconds(ms)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); weak_factory_->InvalidateWeakPtrs(); } @@ -226,8 +227,8 @@ class CookieStoreTest : public testing::Test { GURL url_google_foo_; GURL url_google_bar_; - scoped_ptr<base::WeakPtrFactory<MessageLoop> > weak_factory_; - scoped_ptr<MessageLoop> message_loop_; + scoped_ptr<base::WeakPtrFactory<base::MessageLoop> > weak_factory_; + scoped_ptr<base::MessageLoop> message_loop_; private: // Returns a set of strings of type "name=value". Fails in case of duplicate. diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 87c50c7..105d7dad 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -1000,8 +1000,8 @@ void BackendImpl::CriticalError(int error) { disabled_ = true; if (!num_refs_) - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&BackendImpl::RestartCache, GetWeakPtr(), true)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&BackendImpl::RestartCache, GetWeakPtr(), true)); } void BackendImpl::ReportError(int error) { @@ -1779,8 +1779,8 @@ void BackendImpl::DecreaseNumRefs() { num_refs_--; if (!num_refs_ && disabled_) - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&BackendImpl::RestartCache, GetWeakPtr(), true)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&BackendImpl::RestartCache, GetWeakPtr(), true)); } void BackendImpl::IncreaseNumEntries() { diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index a50fc19..ecec7b7 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -228,7 +228,7 @@ TEST_F(DiskCacheTest, CreateBackend) { ASSERT_TRUE(CleanupCacheDir()); base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); // Test the private factory method(s). disk_cache::Backend* cache = NULL; @@ -258,7 +258,7 @@ TEST_F(DiskCacheTest, CreateBackend) { delete cache; } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Tests that |BackendImpl| fails to initialize with a missing file. @@ -268,7 +268,7 @@ TEST_F(DiskCacheBackendTest, CreateBackend_MissingFile) { file_util::Delete(filename, false); base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); net::TestCompletionCallback cb; bool prev = base::ThreadRestrictions::SetIOAllowed(false); @@ -313,7 +313,7 @@ void DiskCacheBackendTest::BackendShutdownWithPendingFileIO(bool fast) { ASSERT_TRUE(CleanupCacheDir()); base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); uint32 flags = disk_cache::kNoBuffering; if (!fast) @@ -359,7 +359,7 @@ void DiskCacheBackendTest::BackendShutdownWithPendingFileIO(bool fast) { } } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); #if defined(OS_WIN) // Wait for the actual operation to complete, or we'll keep a file handle that @@ -390,7 +390,7 @@ void DiskCacheBackendTest::BackendShutdownWithPendingIO(bool fast) { ASSERT_TRUE(CleanupCacheDir()); base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); uint32 flags = disk_cache::kNoBuffering; if (!fast) @@ -410,7 +410,7 @@ void DiskCacheBackendTest::BackendShutdownWithPendingIO(bool fast) { cache_ = NULL; } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(DiskCacheBackendTest, ShutdownWithPendingIO) { @@ -433,7 +433,7 @@ void DiskCacheBackendTest::BackendShutdownWithPendingCreate(bool fast) { ASSERT_TRUE(CleanupCacheDir()); base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); disk_cache::BackendFlags flags = fast ? disk_cache::kNone : disk_cache::kNoRandom; @@ -449,7 +449,7 @@ void DiskCacheBackendTest::BackendShutdownWithPendingCreate(bool fast) { EXPECT_FALSE(cb.have_result()); } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(DiskCacheBackendTest, ShutdownWithPendingCreate) { @@ -471,7 +471,7 @@ TEST_F(DiskCacheTest, TruncatedIndex) { base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); net::TestCompletionCallback cb; disk_cache::Backend* backend = NULL; @@ -921,7 +921,7 @@ void DiskCacheBackendTest::BackendTrimInvalidEntry() { // If we evicted the entry in less than 20mS, we have one entry in the cache; // if it took more than that, we posted a task and we'll delete the second // entry too. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // This may be not thread-safe in general, but for now it's OK so add some // ThreadSanitizer annotations to ignore data races on cache_. @@ -986,7 +986,7 @@ void DiskCacheBackendTest::BackendTrimInvalidEntry2() { FlushQueueForTest(); // We may abort the eviction before cleaning up everything. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); FlushQueueForTest(); // If it's not clear enough: we may still have eviction tasks running at this // time, so the number of entries is changing while we read it. @@ -1670,7 +1670,7 @@ TEST_F(DiskCacheTest, WrongVersion) { ASSERT_TRUE(CopyTestCache("wrong_version")); base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); net::TestCompletionCallback cb; disk_cache::BackendImpl* cache = new disk_cache::BackendImpl( @@ -1687,7 +1687,7 @@ TEST_F(DiskCacheBackendTest, DeleteOld) { SetNewEviction(); base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); net::TestCompletionCallback cb; bool prev = base::ThreadRestrictions::SetIOAllowed(false); @@ -2481,7 +2481,7 @@ void DiskCacheBackendTest::BackendDoomAll() { ASSERT_EQ(0, cache_->GetEntryCount()); // We should stop posting tasks at some point (if we post any). - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); disk_cache::Entry *entry3, *entry4; EXPECT_NE(net::OK, OpenEntry("third", &entry3)); @@ -2572,7 +2572,7 @@ TEST_F(DiskCacheTest, MultipleInstances) { base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); net::TestCompletionCallback cb; const int kNumberOfCaches = 2; @@ -2982,7 +2982,7 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOverBlockfileCache) { // Check that the |SimpleBackendImpl| does not favor this structure. base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); disk_cache::SimpleBackendImpl* simple_cache = new disk_cache::SimpleBackendImpl(cache_path_, 0, net::DISK_CACHE, cache_thread.message_loop_proxy(), @@ -3013,11 +3013,9 @@ TEST_F(DiskCacheBackendTest, BlockfileCacheOverSimpleCache) { // Check that the |BackendImpl| does not favor this structure. base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); - disk_cache::BackendImpl* cache = - new disk_cache::BackendImpl(cache_path_, - base::MessageLoopProxy::current(), - NULL); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); + disk_cache::BackendImpl* cache = new disk_cache::BackendImpl( + cache_path_, base::MessageLoopProxy::current(), NULL); cache->SetUnitTestMode(); net::TestCompletionCallback cb; int rv = cache->Init(cb.callback()); diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc index 66c1131..97b5655 100644 --- a/net/disk_cache/disk_cache_perftest.cc +++ b/net/disk_cache/disk_cache_perftest.cc @@ -161,7 +161,7 @@ TEST_F(DiskCacheTest, Hash) { TEST_F(DiskCacheTest, CacheBackendPerformance) { base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); ASSERT_TRUE(CleanupCacheDir()); net::TestCompletionCallback cb; @@ -180,7 +180,7 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) { EXPECT_TRUE(TimeWrite(num_entries, cache, &entries)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); delete cache; ASSERT_TRUE(file_util::EvictFileFromSystemCache( @@ -204,7 +204,7 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) { EXPECT_TRUE(TimeRead(num_entries, cache, entries, false)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); delete cache; } @@ -247,6 +247,6 @@ TEST_F(DiskCacheTest, BlockFilesPerformance) { } timer2.Done(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); delete[] address; } diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index 8a0e81c..af47321 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -20,8 +20,8 @@ DiskCacheTest::DiskCacheTest() { CHECK(temp_dir_.CreateUniqueTempDir()); cache_path_ = temp_dir_.path(); - if (!MessageLoop::current()) - message_loop_.reset(new MessageLoopForIO()); + if (!base::MessageLoop::current()) + message_loop_.reset(new base::MessageLoopForIO()); } DiskCacheTest::~DiskCacheTest() { @@ -256,7 +256,7 @@ void DiskCacheTestWithCache::InitDiskCache() { if (!cache_thread_.IsRunning()) { ASSERT_TRUE(cache_thread_.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); } ASSERT_TRUE(cache_thread_.message_loop() != NULL); diff --git a/net/disk_cache/disk_cache_test_base.h b/net/disk_cache/disk_cache_test_base.h index ef6306b..69e0920 100644 --- a/net/disk_cache/disk_cache_test_base.h +++ b/net/disk_cache/disk_cache_test_base.h @@ -51,7 +51,7 @@ class DiskCacheTest : public PlatformTest { private: base::ScopedTempDir temp_dir_; - scoped_ptr<MessageLoop> message_loop_; + scoped_ptr<base::MessageLoop> message_loop_; }; // Provides basic support for cache related tests. diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc index 2ea19b6..70c8997 100644 --- a/net/disk_cache/disk_cache_test_util.cc +++ b/net/disk_cache/disk_cache_test_util.cc @@ -97,7 +97,7 @@ bool MessageLoopHelper::WaitUntilCacheIoFinished(int num_callbacks) { if (!timer_.IsRunning()) timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(50), this, &MessageLoopHelper::TimerExpired); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); return completed_; } @@ -107,7 +107,7 @@ void MessageLoopHelper::TimerExpired() { CHECK_LE(callbacks_called_, num_callbacks_); if (callbacks_called_ == num_callbacks_) { completed_ = true; - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } else { // Not finished yet. See if we have to abort. if (last_ == callbacks_called_) @@ -115,7 +115,7 @@ void MessageLoopHelper::TimerExpired() { else last_ = callbacks_called_; if (40 == num_iterations_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } } diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index 7ada07e..7563131 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -1878,7 +1878,7 @@ void DiskCacheEntryTest::DoomSparseEntry() { // Make sure we do all needed work. This may fail for entry2 if between Close // and DoomEntry the system decides to remove all traces of the file from the // system cache so we don't see that there is pending IO. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); if (memory_only_) { EXPECT_EQ(0, cache_->GetEntryCount()); @@ -1888,7 +1888,7 @@ void DiskCacheEntryTest::DoomSparseEntry() { // (it's always async on Posix so it is easy to miss). Unfortunately we // don't have any signal to watch for so we can only wait. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(500)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } EXPECT_EQ(0, cache_->GetEntryCount()); } @@ -2592,7 +2592,7 @@ TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic4) { // Finish running the pending tasks so that we fully complete the close // operation and destroy the entry object. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // At this point the |entry| must have been destroyed, and called // RemoveSelfFromBackend(). @@ -2739,7 +2739,7 @@ TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheCreateDoomRace) { // Finish running the pending tasks so that we fully complete the close // operation and destroy the entry object. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); for (int i = 0; i < disk_cache::kSimpleEntryFileCount; ++i) { base::FilePath entry_file_path = cache_path_.AppendASCII( diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc index 097f48c..d2378e6 100644 --- a/net/disk_cache/eviction.cc +++ b/net/disk_cache/eviction.cc @@ -142,8 +142,9 @@ void Eviction::TrimCache(bool empty) { } if (!empty && (deleted_entries > 20 || (TimeTicks::Now() - start).InMilliseconds() > 20)) { - MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &Eviction::TrimCache, ptr_factory_.GetWeakPtr(), false)); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&Eviction::TrimCache, ptr_factory_.GetWeakPtr(), false)); break; } } @@ -209,7 +210,8 @@ void Eviction::PostDelayedTrim() { return; delay_trim_ = true; trim_delays_++; - MessageLoop::current()->PostDelayedTask(FROM_HERE, + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, base::Bind(&Eviction::DelayedTrim, ptr_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds(1000)); } @@ -365,8 +367,9 @@ void Eviction::TrimCacheV2(bool empty) { } if (!empty && (deleted_entries > 20 || (TimeTicks::Now() - start).InMilliseconds() > 20)) { - MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &Eviction::TrimCache, ptr_factory_.GetWeakPtr(), false)); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&Eviction::TrimCache, ptr_factory_.GetWeakPtr(), false)); break; } } @@ -377,7 +380,8 @@ void Eviction::TrimCacheV2(bool empty) { if (empty) { TrimDeleted(true); } else if (ShouldTrimDeleted()) { - MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&Eviction::TrimDeleted, ptr_factory_.GetWeakPtr(), empty)); } @@ -509,7 +513,8 @@ void Eviction::TrimDeleted(bool empty) { } if (deleted_entries && !empty && ShouldTrimDeleted()) { - MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&Eviction::TrimDeleted, ptr_factory_.GetWeakPtr(), false)); } diff --git a/net/disk_cache/file_win.cc b/net/disk_cache/file_win.cc index 422a3ce..83a5189 100644 --- a/net/disk_cache/file_win.cc +++ b/net/disk_cache/file_win.cc @@ -21,7 +21,7 @@ struct MyOverlapped { return &context_.overlapped; } - MessageLoopForIO::IOContext context_; + base::MessageLoopForIO::IOContext context_; scoped_refptr<disk_cache::File> file_; disk_cache::FileIOCallback* callback_; }; @@ -29,16 +29,19 @@ struct MyOverlapped { COMPILE_ASSERT(!offsetof(MyOverlapped, context_), starts_with_overlapped); // Helper class to handle the IO completion notifications from the message loop. -class CompletionHandler : public MessageLoopForIO::IOHandler { - virtual void OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD actual_bytes, DWORD error); +class CompletionHandler : public base::MessageLoopForIO::IOHandler { + virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, + DWORD actual_bytes, + DWORD error); }; static base::LazyInstance<CompletionHandler> g_completion_handler = LAZY_INSTANCE_INITIALIZER; -void CompletionHandler::OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD actual_bytes, DWORD error) { +void CompletionHandler::OnIOCompleted( + base::MessageLoopForIO::IOContext* context, + DWORD actual_bytes, + DWORD error) { MyOverlapped* data = reinterpret_cast<MyOverlapped*>(context); if (error) { @@ -84,7 +87,7 @@ bool File::Init(const base::FilePath& name) { if (INVALID_HANDLE_VALUE == platform_file_) return false; - MessageLoopForIO::current()->RegisterIOHandler( + base::MessageLoopForIO::current()->RegisterIOHandler( platform_file_, g_completion_handler.Pointer()); init_ = true; @@ -259,8 +262,8 @@ void File::WaitForPendingIO(int* num_pending_io) { while (*num_pending_io) { // Asynchronous IO operations may be in flight and the completion may end // up calling us back so let's wait for them. - MessageLoopForIO::IOHandler* handler = g_completion_handler.Pointer(); - MessageLoopForIO::current()->WaitForIOCompletion(100, handler); + base::MessageLoopForIO::IOHandler* handler = g_completion_handler.Pointer(); + base::MessageLoopForIO::current()->WaitForIOCompletion(100, handler); } } diff --git a/net/disk_cache/sparse_control.cc b/net/disk_cache/sparse_control.cc index 81370fc..8c3d5dd 100644 --- a/net/disk_cache/sparse_control.cc +++ b/net/disk_cache/sparse_control.cc @@ -136,8 +136,8 @@ void ChildrenDeleter::DeleteChildren() { children_map_.Set(child_id, false); // Post a task to delete the next child. - MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &ChildrenDeleter::DeleteChildren, this)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&ChildrenDeleter::DeleteChildren, this)); } // Returns the NetLog event type corresponding to a SparseOperation. @@ -357,11 +357,13 @@ void SparseControl::DeleteChildren(EntryImpl* entry) { deleter->AddRef(); if (buffer) { - MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &ChildrenDeleter::Start, deleter, buffer, data_len)); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&ChildrenDeleter::Start, deleter, buffer, data_len)); } else { - MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &ChildrenDeleter::ReadData, deleter, address, data_len)); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&ChildrenDeleter::ReadData, deleter, address, data_len)); } } diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index 8096caa..59abe2a 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -108,7 +108,7 @@ void StressTheCache(int iteration) { base::Thread cache_thread("CacheThread"); if (!cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))) + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))) return; disk_cache::BackendImpl* cache = @@ -188,11 +188,11 @@ void StressTheCache(int iteration) { bool g_crashing = false; // RunSoon() and CrashCallback() reference each other, unfortunately. -void RunSoon(MessageLoop* target_loop); +void RunSoon(base::MessageLoop* target_loop); void CrashCallback() { // Keep trying to run. - RunSoon(MessageLoop::current()); + RunSoon(base::MessageLoop::current()); if (g_crashing) return; @@ -210,7 +210,7 @@ void CrashCallback() { } } -void RunSoon(MessageLoop* target_loop) { +void RunSoon(base::MessageLoop* target_loop) { const base::TimeDelta kTaskDelay = base::TimeDelta::FromSeconds(10); target_loop->PostDelayedTask( FROM_HERE, base::Bind(&CrashCallback), kTaskDelay); @@ -275,7 +275,7 @@ int main(int argc, const char* argv[]) { // Some time for the memory manager to flush stuff. base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(3)); - MessageLoop message_loop(MessageLoop::TYPE_IO); + base::MessageLoop message_loop(base::MessageLoop::TYPE_IO); char* end; long int iteration = strtol(argv[1], &end, 0); diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc index 72cd247..5f0f8244 100644 --- a/net/dns/dns_config_service_posix.cc +++ b/net/dns/dns_config_service_posix.cc @@ -140,7 +140,7 @@ class DnsConfigServicePosix::Watcher { void OnConfigChanged(bool succeeded) { // Ignore transient flutter of resolv.conf by delaying the signal a bit. const base::TimeDelta kDelay = base::TimeDelta::FromMilliseconds(50); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&Watcher::OnConfigChangedDelayed, weak_factory_.GetWeakPtr(), diff --git a/net/dns/dns_config_service_unittest.cc b/net/dns/dns_config_service_unittest.cc index af2c221..6121670 100644 --- a/net/dns/dns_config_service_unittest.cc +++ b/net/dns/dns_config_service_unittest.cc @@ -21,7 +21,7 @@ class DnsConfigServiceTest : public testing::Test { void OnConfigChanged(const DnsConfig& config) { last_config_ = config; if (quit_on_config_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } protected: @@ -53,12 +53,11 @@ class DnsConfigServiceTest : public testing::Test { }; void WaitForConfig(base::TimeDelta timeout) { - base::CancelableClosure closure(MessageLoop::QuitClosure()); - MessageLoop::current()->PostDelayedTask(FROM_HERE, - closure.callback(), - timeout); + base::CancelableClosure closure(base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, closure.callback(), timeout); quit_on_config_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); quit_on_config_ = false; closure.Cancel(); } diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc index 127746e..e1f6b23 100644 --- a/net/dns/dns_config_service_win.cc +++ b/net/dns/dns_config_service_win.cc @@ -622,7 +622,7 @@ class DnsConfigServiceWin::ConfigReader : public SerialWorker { } else { LOG(WARNING) << "Failed to read DnsConfig."; // Try again in a while in case DnsConfigWatcher missed the signal. - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&ConfigReader::WorkNow, this), base::TimeDelta::FromSeconds(kRetryIntervalSeconds)); diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc index 237646b..d725a32 100644 --- a/net/dns/dns_test_util.cc +++ b/net/dns/dns_test_util.cc @@ -65,9 +65,8 @@ class MockTransaction : public DnsTransaction, if (MockDnsClientRule::FAIL_SYNC == result_) return ERR_NAME_NOT_RESOLVED; // Using WeakPtr to cleanly cancel when transaction is destroyed. - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&MockTransaction::Finish, AsWeakPtr())); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&MockTransaction::Finish, AsWeakPtr())); return ERR_IO_PENDING; } diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index fdd2eb2..c297566 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc @@ -541,7 +541,7 @@ class DnsTransactionImpl : public DnsTransaction, AttemptResult result = ProcessAttemptResult(StartQuery()); if (result.rv == OK) { // DnsTransaction must never succeed synchronously. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&DnsTransactionImpl::DoCallback, AsWeakPtr(), result)); return ERR_IO_PENDING; diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc index 71b5d79..f6fb8e5 100644 --- a/net/dns/dns_transaction_unittest.cc +++ b/net/dns/dns_transaction_unittest.cc @@ -276,7 +276,7 @@ class TransactionHelper { // Tell MessageLoop to quit now, in case any ASSERT_* fails. if (quit_in_callback_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); if (expected_answer_count_ >= 0) { ASSERT_EQ(OK, rv); @@ -303,7 +303,7 @@ class TransactionHelper { bool Run(DnsTransactionFactory* factory) { StartTransaction(factory); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); return has_completed(); } @@ -311,7 +311,7 @@ class TransactionHelper { bool RunUntilDone(DnsTransactionFactory* factory) { set_quit_in_callback(); StartTransaction(factory); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); return has_completed(); } @@ -498,7 +498,7 @@ TEST_F(DnsTransactionTest, ConcurrentLookup) { TransactionHelper helper1(kT1HostName, kT1Qtype, kT1RecordCount); helper1.StartTransaction(transaction_factory_.get()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(helper0.has_completed()); EXPECT_TRUE(helper1.has_completed()); @@ -517,7 +517,7 @@ TEST_F(DnsTransactionTest, CancelLookup) { helper0.Cancel(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(helper0.has_completed()); EXPECT_TRUE(helper1.has_completed()); @@ -533,7 +533,7 @@ TEST_F(DnsTransactionTest, DestroyFactory) { // Destroying the client does not affect running requests. transaction_factory_.reset(NULL); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(helper0.has_completed()); } @@ -624,7 +624,7 @@ TEST_F(DnsTransactionTest, Timeout) { TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_DNS_TIMED_OUT); EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); - MessageLoop::current()->AssertIdle(); + base::MessageLoop::current()->AssertIdle(); } TEST_F(DnsTransactionTest, ServerFallbackAndRotate) { diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc index 213661d..b677af4 100644 --- a/net/dns/host_resolver_impl_unittest.cc +++ b/net/dns/host_resolver_impl_unittest.cc @@ -257,12 +257,11 @@ class Request { int WaitForResult() { if (completed()) return result_; - base::CancelableClosure closure(MessageLoop::QuitClosure()); - MessageLoop::current()->PostDelayedTask(FROM_HERE, - closure.callback(), - TestTimeouts::action_max_timeout()); + base::CancelableClosure closure(base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, closure.callback(), TestTimeouts::action_max_timeout()); quit_on_complete_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); bool did_quit = !quit_on_complete_; quit_on_complete_ = false; closure.Cancel(); @@ -286,7 +285,7 @@ class Request { if (handler_) handler_->Handle(this); if (quit_on_complete_) { - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); quit_on_complete_ = false; } } @@ -713,7 +712,8 @@ TEST_F(HostResolverImplTest, DeleteWithinCallback) { // Quit after returning from OnCompleted (to give it a chance at // incorrectly running the cancelled tasks). - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } }; set_handler(new MyHandler()); @@ -725,7 +725,7 @@ TEST_F(HostResolverImplTest, DeleteWithinCallback) { proc_->SignalMultiple(1u); // One for "a". // |MyHandler| will send quit message once all the requests have finished. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(HostResolverImplTest, DeleteWithinAbortedCallback) { @@ -738,7 +738,8 @@ TEST_F(HostResolverImplTest, DeleteWithinAbortedCallback) { // Quit after returning from OnCompleted (to give it a chance at // incorrectly running the cancelled tasks). - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } }; set_handler(new MyHandler()); @@ -757,7 +758,7 @@ TEST_F(HostResolverImplTest, DeleteWithinAbortedCallback) { NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); // |MyHandler| will send quit message once all the requests have finished. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(ERR_NETWORK_CHANGED, requests_[0]->result()); EXPECT_EQ(ERR_IO_PENDING, requests_[1]->result()); @@ -816,7 +817,7 @@ TEST_F(HostResolverImplTest, BypassCache) { EXPECT_EQ(ERR_IO_PENDING, CreateRequest(info)->Resolve()); } else if (71 == req->info().port()) { // Test is done. - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } else { FAIL() << "Unexpected request"; } @@ -828,7 +829,7 @@ TEST_F(HostResolverImplTest, BypassCache) { proc_->SignalMultiple(3u); // Only need two, but be generous. // |verifier| will send quit message once all the requests have finished. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(2u, proc_->GetCaptureList().size()); } @@ -845,7 +846,7 @@ TEST_F(HostResolverImplTest, FlushCacheOnIPAddressChange) { // Flush cache by triggering an IP address change. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); // Notification happens async. + base::MessageLoop::current()->RunUntilIdle(); // Notification happens async. // Resolve "host1" again -- this time it won't be served from cache, so it // will complete asynchronously. @@ -862,7 +863,7 @@ TEST_F(HostResolverImplTest, AbortOnIPAddressChanged) { EXPECT_TRUE(proc_->WaitFor(1u)); // Triggering an IP address change. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); // Notification happens async. + base::MessageLoop::current()->RunUntilIdle(); // Notification happens async. proc_->SignalAll(); EXPECT_EQ(ERR_NETWORK_CHANGED, req->WaitForResult()); @@ -880,7 +881,7 @@ TEST_F(HostResolverImplTest, ObeyPoolConstraintsAfterIPAddressChange) { EXPECT_TRUE(proc_->WaitFor(1u)); // Triggering an IP address change. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); // Notification happens async. + base::MessageLoop::current()->RunUntilIdle(); // Notification happens async. proc_->SignalMultiple(3u); // Let the false-start go so that we can catch it. EXPECT_EQ(ERR_NETWORK_CHANGED, requests_[0]->WaitForResult()); @@ -924,7 +925,7 @@ TEST_F(HostResolverImplTest, AbortOnlyExistingRequestsOnIPAddressChange) { // Trigger an IP address change. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); // This should abort all running jobs. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_NETWORK_CHANGED, requests_[0]->result()); EXPECT_EQ(ERR_NETWORK_CHANGED, requests_[1]->result()); EXPECT_EQ(ERR_NETWORK_CHANGED, requests_[2]->result()); @@ -1232,7 +1233,7 @@ TEST_F(HostResolverImplTest, MultipleAttempts) { resolver_proc->WaitForAllAttemptsToFinish( base::TimeDelta::FromMilliseconds(60000)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(resolver_proc->total_attempts_resolved(), kTotalAttempts); EXPECT_EQ(resolver_proc->resolved_attempt_number(), kAttemptNumberToResolve); @@ -1287,7 +1288,7 @@ class HostResolverImplDnsTest : public HostResolverImplTest { void ChangeDnsConfig(const DnsConfig& config) { NetworkChangeNotifier::SetDnsConfig(config); // Notification is delivered asynchronously. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } MockDnsClientRuleList dns_rules_; diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc index 5b75bfb..7fe0adb 100644 --- a/net/dns/mock_host_resolver.cc +++ b/net/dns/mock_host_resolver.cc @@ -88,7 +88,7 @@ int MockHostResolverBase::Resolve(const RequestInfo& info, *handle = reinterpret_cast<RequestHandle>(id); if (!ondemand_mode_) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&MockHostResolverBase::ResolveNow, AsWeakPtr(), id)); } @@ -127,7 +127,7 @@ void MockHostResolverBase::ResolveAllPending() { DCHECK(CalledOnValidThread()); DCHECK(ondemand_mode_); for (RequestMap::iterator i = requests_.begin(); i != requests_.end(); ++i) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&MockHostResolverBase::ResolveNow, AsWeakPtr(), i->first)); } diff --git a/net/dns/notify_watcher_mac.cc b/net/dns/notify_watcher_mac.cc index 67cee01..286f18b 100644 --- a/net/dns/notify_watcher_mac.cc +++ b/net/dns/notify_watcher_mac.cc @@ -26,10 +26,10 @@ bool NotifyWatcherMac::Watch(const char* key, const CallbackType& callback) { if (status != NOTIFY_STATUS_OK) return false; DCHECK_GE(notify_fd_, 0); - if (!MessageLoopForIO::current()->WatchFileDescriptor( + if (!base::MessageLoopForIO::current()->WatchFileDescriptor( notify_fd_, true, - MessageLoopForIO::WATCH_READ, + base::MessageLoopForIO::WATCH_READ, &watcher_, this)) { Cancel(); diff --git a/net/dns/notify_watcher_mac.h b/net/dns/notify_watcher_mac.h index a05eda2..24e9974 100644 --- a/net/dns/notify_watcher_mac.h +++ b/net/dns/notify_watcher_mac.h @@ -12,7 +12,7 @@ namespace net { // Watches for notifications from Libnotify and delivers them to a Callback. // After failure the watch is cancelled and will have to be restarted. -class NotifyWatcherMac : public MessageLoopForIO::Watcher { +class NotifyWatcherMac : public base::MessageLoopForIO::Watcher { public: // Called on received notification with true on success and false on error. typedef base::Callback<void(bool succeeded)> CallbackType; @@ -37,7 +37,7 @@ class NotifyWatcherMac : public MessageLoopForIO::Watcher { int notify_fd_; int notify_token_; CallbackType callback_; - MessageLoopForIO::FileDescriptorWatcher watcher_; + base::MessageLoopForIO::FileDescriptorWatcher watcher_; DISALLOW_COPY_AND_ASSIGN(NotifyWatcherMac); }; diff --git a/net/dns/serial_worker_unittest.cc b/net/dns/serial_worker_unittest.cc index 7fe0ef7..1265a21 100644 --- a/net/dns/serial_worker_unittest.cc +++ b/net/dns/serial_worker_unittest.cc @@ -55,7 +55,7 @@ class SerialWorkerTest : public testing::Test { } void OnWorkFinished() { - EXPECT_TRUE(message_loop_ == MessageLoop::current()); + EXPECT_TRUE(message_loop_ == base::MessageLoop::current()); EXPECT_EQ(output_value_, input_value_); BreakNow("OnWorkFinished"); } @@ -63,7 +63,7 @@ class SerialWorkerTest : public testing::Test { protected: void BreakCallback(std::string breakpoint) { breakpoint_ = breakpoint; - MessageLoop::current()->QuitNow(); + base::MessageLoop::current()->QuitNow(); } void BreakNow(std::string b) { @@ -97,7 +97,7 @@ class SerialWorkerTest : public testing::Test { // test::Test methods virtual void SetUp() OVERRIDE { - message_loop_ = MessageLoop::current(); + message_loop_ = base::MessageLoop::current(); worker_ = new TestSerialWorker(this); } @@ -126,7 +126,7 @@ class SerialWorkerTest : public testing::Test { base::Lock work_lock_; // Loop for this thread. - MessageLoop* message_loop_; + base::MessageLoop* message_loop_; // WatcherDelegate under test. scoped_refptr<TestSerialWorker> worker_; diff --git a/net/http/http_auth_handler_mock.cc b/net/http/http_auth_handler_mock.cc index 7ddead7..fb2d524 100644 --- a/net/http/http_auth_handler_mock.cc +++ b/net/http/http_auth_handler_mock.cc @@ -59,10 +59,10 @@ int HttpAuthHandlerMock::ResolveCanonicalName( EXPECT_TRUE(callback_.is_null()); rv = ERR_IO_PENDING; callback_ = callback; - MessageLoop::current()->PostTask( - FROM_HERE, base::Bind( - &HttpAuthHandlerMock::OnResolveCanonicalName, - weak_factory_.GetWeakPtr())); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&HttpAuthHandlerMock::OnResolveCanonicalName, + weak_factory_.GetWeakPtr())); break; default: NOTREACHED(); @@ -118,10 +118,10 @@ int HttpAuthHandlerMock::GenerateAuthTokenImpl( EXPECT_TRUE(auth_token_ == NULL); callback_ = callback; auth_token_ = auth_token; - MessageLoop::current()->PostTask( - FROM_HERE, base::Bind( - &HttpAuthHandlerMock::OnGenerateAuthToken, - weak_factory_.GetWeakPtr())); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&HttpAuthHandlerMock::OnGenerateAuthToken, + weak_factory_.GetWeakPtr())); return ERR_IO_PENDING; } else { if (generate_rv_ == OK) diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 8905695..b689c9e 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -966,11 +966,9 @@ void HttpCache::ProcessPendingQueue(ActiveEntry* entry) { return; entry->will_process_pending_queue = true; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(&HttpCache::OnProcessPendingQueue, - AsWeakPtr(), - entry)); + base::Bind(&HttpCache::OnProcessPendingQueue, AsWeakPtr(), entry)); } void HttpCache::OnProcessPendingQueue(ActiveEntry* entry) { @@ -1126,10 +1124,10 @@ void HttpCache::OnBackendCreated(int result, PendingOp* pending_op) { // go away from the callback. pending_op->writer = pending_item; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(&HttpCache::OnBackendCreated, AsWeakPtr(), - result, pending_op)); + base::Bind( + &HttpCache::OnBackendCreated, AsWeakPtr(), result, pending_op)); } else { building_backend_ = false; DeletePendingOp(pending_op); diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 7843e8f..82b3078 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -2425,7 +2425,7 @@ void HttpCache::Transaction::OnIOComplete(int result) { void HttpCache::Transaction::ScheduleDelayedLoop(base::TimeDelta delay, int result) { - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&HttpCache::Transaction::RunDelayedLoop, weak_factory_.GetWeakPtr(), diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index 113359c..8c0f55d 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -1316,7 +1316,7 @@ TEST(HttpCache, SimpleGET_ManyReaders) { } // Allow all requests to move from the Create queue to the active entry. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The first request should be a writer at this point, and the subsequent // requests should be pending. @@ -1382,7 +1382,7 @@ TEST(HttpCache, SimpleGET_RacingReaders) { } // Allow all requests to move from the Create queue to the active entry. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The first request should be a writer at this point, and the subsequent // requests should be pending. @@ -1513,7 +1513,7 @@ TEST(HttpCache, FastNoStoreGET_DoneWithPending) { } // Allow all requests to move from the Create queue to the active entry. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The first request should be a writer at this point, and the subsequent // requests should be pending. @@ -1561,7 +1561,7 @@ TEST(HttpCache, SimpleGET_ManyWriters_CancelFirst) { } // Allow all requests to move from the Create queue to the active entry. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The first request should be a writer at this point, and the subsequent // requests should be pending. @@ -1678,7 +1678,7 @@ TEST(HttpCache, SimpleGET_CancelCreate) { cache.disk_cache()->ReleaseAll(); delete c; - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1, cache.disk_cache()->create_count()); } @@ -1757,7 +1757,7 @@ TEST(HttpCache, SimpleGET_AbandonedCacheRead) { // Make sure we pump any pending events, which should include a call to // HttpCache::Transaction::OnCacheReadCompleted. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Tests that we can delete the HttpCache and deal with queued transactions @@ -1828,14 +1828,14 @@ TEST(HttpCache, SimpleGET_WaitForBackend) { &request2, context_list[2]->callback.callback(), net::BoundNetLog()); // Just to make sure that everything is still pending. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The first request should be creating the disk cache. EXPECT_FALSE(context_list[0]->callback.have_result()); factory->FinishCreation(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(3, cache.network_layer()->transaction_count()); EXPECT_EQ(3, cache.disk_cache()->create_count()); @@ -1875,7 +1875,7 @@ TEST(HttpCache, SimpleGET_WaitForBackend_CancelCreate) { &request2, context_list[2]->callback.callback(), net::BoundNetLog()); // Just to make sure that everything is still pending. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The first request should be creating the disk cache. EXPECT_FALSE(context_list[0]->callback.have_result()); @@ -1916,7 +1916,7 @@ TEST(HttpCache, DeleteCacheWaitingForBackend) { c->trans->Start(&request, c->callback.callback(), net::BoundNetLog()); // Just to make sure that everything is still pending. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The request should be creating the disk cache. EXPECT_FALSE(c->callback.have_result()); @@ -1927,7 +1927,7 @@ TEST(HttpCache, DeleteCacheWaitingForBackend) { disk_cache::Backend** backend = factory->backend(); cache.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); *backend = NULL; callback.Run(net::ERR_ABORTED); @@ -1960,7 +1960,7 @@ TEST(HttpCache, DeleteCacheWaitingForBackend2) { EXPECT_EQ(net::ERR_IO_PENDING, rv); // Just to make sure that everything is still pending. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The request should be queued. EXPECT_FALSE(c->callback.have_result()); @@ -1970,7 +1970,7 @@ TEST(HttpCache, DeleteCacheWaitingForBackend2) { rv = cb.WaitForResult(); // The cache should be gone by now. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(net::OK, c->callback.GetResult(c->result)); EXPECT_FALSE(cb2.have_result()); } @@ -3360,7 +3360,7 @@ TEST(HttpCache, RangeGET_OK) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure we are done with the previous transaction. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Write to the cache (30-39). MockTransaction transaction(kRangeGET_TransactionOK); @@ -3374,7 +3374,7 @@ TEST(HttpCache, RangeGET_OK) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure we are done with the previous transaction. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Write and read from the cache (20-59). transaction.request_headers = "Range: bytes = 20-59\r\n" EXTRA_HEADER; @@ -3421,7 +3421,7 @@ TEST(HttpCache, RangeGET_SyncOK) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure we are done with the previous transaction. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Write to the cache (30-39). transaction.request_headers = "Range: bytes = 30-39\r\n" EXTRA_HEADER; @@ -3434,7 +3434,7 @@ TEST(HttpCache, RangeGET_SyncOK) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure we are done with the previous transaction. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Write and read from the cache (20-59). transaction.request_headers = "Range: bytes = 20-59\r\n" EXTRA_HEADER; @@ -3645,7 +3645,7 @@ TEST(HttpCache, UnknownRangeGET_1) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure we are done with the previous transaction. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Write and read from the cache (60-79). transaction.request_headers = "Range: bytes = 60-\r\n" EXTRA_HEADER; @@ -3684,7 +3684,7 @@ TEST(HttpCache, UnknownRangeGET_2) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure we are done with the previous transaction. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Write and read from the cache (60-79). transaction.request_headers = "Range: bytes = -20\r\n" EXTRA_HEADER; @@ -4027,7 +4027,7 @@ TEST(HttpCache, RangeGET_Previous200) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // The last transaction has finished so make sure the entry is deactivated. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Make a request for an invalid range. MockTransaction transaction3(kRangeGET_TransactionOK); @@ -4041,14 +4041,14 @@ TEST(HttpCache, RangeGET_Previous200) { EXPECT_EQ(std::string::npos, headers.find("Content-Length: 80")); // Make sure the entry is deactivated. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Even though the request was invalid, we should have the entry. RunTransactionTest(cache.http_cache(), transaction2); EXPECT_EQ(3, cache.disk_cache()->open_count()); // Make sure the entry is deactivated. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now we should receive a range from the server and drop the stored entry. handler.set_not_modified(false); @@ -4268,14 +4268,14 @@ TEST(HttpCache, RangeGET_Cancel3) { EXPECT_EQ(net::ERR_IO_PENDING, rv); MockDiskEntry::IgnoreCallbacks(true); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); MockDiskEntry::IgnoreCallbacks(false); // The new transaction is waiting for the query range callback. delete c; // And we should not crash when the callback is delivered. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(2, cache.network_layer()->transaction_count()); EXPECT_EQ(1, cache.disk_cache()->open_count()); @@ -4995,7 +4995,7 @@ TEST(HttpCache, GET_IncompleteResource_Cancel) { EXPECT_EQ(1, cache.disk_cache()->open_count()); EXPECT_EQ(2, cache.disk_cache()->create_count()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); RemoveMockTransaction(&transaction); } @@ -5218,7 +5218,7 @@ TEST(HttpCache, SyncRead) { r3.load_flags |= net::LOAD_ONLY_FROM_CACHE; c3.Start(&r3, net::BoundNetLog()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(c1.is_done()); EXPECT_TRUE(c2.is_done()); @@ -5559,7 +5559,7 @@ TEST(HttpCache, WriteMetadata_OK) { buf = NULL; // Makes sure we finish pending operations. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction, &response); @@ -5593,7 +5593,7 @@ TEST(HttpCache, WriteMetadata_Fail) { expected_time, buf, buf->size()); // Makes sure we finish pending operations. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction, &response); @@ -5624,7 +5624,7 @@ TEST(HttpCache, ReadMetadata) { response.response_time, buf, buf->size()); // Makes sure we finish pending operations. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Start with a READ mode transaction. MockTransaction trans1(kTypicalGET_Transaction); @@ -5638,7 +5638,7 @@ TEST(HttpCache, ReadMetadata) { EXPECT_EQ(1, cache.network_layer()->transaction_count()); EXPECT_EQ(2, cache.disk_cache()->open_count()); EXPECT_EQ(1, cache.disk_cache()->create_count()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now make sure that the entry is re-validated with the server. trans1.load_flags = net::LOAD_VALIDATE_CACHE; @@ -5652,7 +5652,7 @@ TEST(HttpCache, ReadMetadata) { EXPECT_EQ(2, cache.network_layer()->transaction_count()); EXPECT_EQ(3, cache.disk_cache()->open_count()); EXPECT_EQ(1, cache.disk_cache()->create_count()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); RemoveMockTransaction(&trans1); // Now return 200 when validating the entry so the metadata will be lost. @@ -5691,7 +5691,7 @@ TEST(HttpCache, FilterCompletion) { } // Make sure that the ActiveEntry is gone. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Read from the cache. RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction); @@ -5730,7 +5730,7 @@ TEST(HttpCache, StopCachingDeletesEntry) { } // Make sure that the ActiveEntry is gone. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that the entry is gone. RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction); diff --git a/net/http/http_network_transaction_spdy2_unittest.cc b/net/http/http_network_transaction_spdy2_unittest.cc index e3ae0f6..c334e76 100644 --- a/net/http/http_network_transaction_spdy2_unittest.cc +++ b/net/http/http_network_transaction_spdy2_unittest.cc @@ -265,17 +265,17 @@ class HttpNetworkTransactionSpdy2Test : public PlatformTest { virtual void SetUp() { NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } virtual void TearDown() { NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); PlatformTest::TearDown(); NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); HttpStreamFactory::set_use_alternate_protocols(false); HttpStreamFactory::SetNextProtos(std::vector<std::string>()); } @@ -1343,7 +1343,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, KeepAliveEarlyClose) { EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, rv); trans.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); } @@ -1381,7 +1381,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, KeepAliveEarlyClose2) { EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, rv); trans.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); } @@ -4270,13 +4270,13 @@ TEST_F(HttpNetworkTransactionSpdy2Test, // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the TCPClientSocket was not added back to // the pool. EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session)); trans.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Make sure that the socket didn't get recycled after calling the destructor. EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session)); } @@ -4330,7 +4330,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, RecycleSocket) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); @@ -4389,7 +4389,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, RecycleSSLSocket) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInSSLSocketPool(session)); @@ -4457,7 +4457,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, RecycleDeadSSLSocket) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInSSLSocketPool(session)); @@ -4484,7 +4484,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, RecycleDeadSSLSocket) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInSSLSocketPool(session)); @@ -4541,7 +4541,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, RecycleSocketAfterZeroContentLength) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); @@ -4711,7 +4711,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, AuthIdentityInURL) { EXPECT_EQ(100, response->headers->GetContentLength()); // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test the request-challenge-retry sequence for basic auth when there is an @@ -4821,7 +4821,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, WrongAuthIdentityInURL) { EXPECT_EQ(100, response->headers->GetContentLength()); // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test that previously tried username/passwords for a realm get re-used. @@ -9759,7 +9759,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, SimpleCancel) { EXPECT_EQ(ERR_IO_PENDING, rv); trans.reset(); // Cancel the transaction here. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test a basic GET request through a proxy. @@ -10811,7 +10811,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, DoNotUseSpdySessionForHttp) { TestCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, trans1.Start(&request1, callback1.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback1.WaitForResult()); EXPECT_TRUE(trans1.GetResponseInfo()->was_fetched_via_spdy); @@ -10825,7 +10825,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, DoNotUseSpdySessionForHttp) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback2.WaitForResult()); EXPECT_FALSE(trans2.GetResponseInfo()->was_fetched_via_spdy); @@ -10904,7 +10904,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, DoNotUseSpdySessionForHttpOverTunnel) { TestCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, trans1.Start(&request1, callback1.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data1.RunFor(4); EXPECT_EQ(OK, callback1.WaitForResult()); @@ -10924,7 +10924,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, DoNotUseSpdySessionForHttpOverTunnel) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data1.RunFor(3); EXPECT_EQ(OK, callback2.WaitForResult()); @@ -10987,7 +10987,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, UseSpdySessionForHttpWhenForced) { TestCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, trans1.Start(&request1, callback1.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback1.WaitForResult()); EXPECT_TRUE(trans1.GetResponseInfo()->was_fetched_via_spdy); @@ -11001,7 +11001,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, UseSpdySessionForHttpWhenForced) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback2.WaitForResult()); EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); @@ -11134,7 +11134,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, DoNotUseSpdySessionIfCertDoesNotMatch) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data2->RunFor(3); ASSERT_TRUE(callback2.have_result()); @@ -11200,7 +11200,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, ErrorSocketNotConnected) { TestCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, trans1.Start(&request1, callback1.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_CONNECTION_CLOSED, callback1.WaitForResult()); // Now, start the second request and make sure it succeeds. @@ -11212,7 +11212,7 @@ TEST_F(HttpNetworkTransactionSpdy2Test, ErrorSocketNotConnected) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data2->RunFor(3); ASSERT_TRUE(callback2.have_result()); diff --git a/net/http/http_network_transaction_spdy3_unittest.cc b/net/http/http_network_transaction_spdy3_unittest.cc index bfe8f6b..450097d 100644 --- a/net/http/http_network_transaction_spdy3_unittest.cc +++ b/net/http/http_network_transaction_spdy3_unittest.cc @@ -266,17 +266,17 @@ class HttpNetworkTransactionSpdy3Test : public PlatformTest { virtual void SetUp() { NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } virtual void TearDown() { NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); PlatformTest::TearDown(); NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); HttpStreamFactory::set_use_alternate_protocols(false); HttpStreamFactory::SetNextProtos(std::vector<std::string>()); } @@ -1344,7 +1344,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, KeepAliveEarlyClose) { EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, rv); trans.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); } @@ -1382,7 +1382,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, KeepAliveEarlyClose2) { EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, rv); trans.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); } @@ -4255,13 +4255,13 @@ TEST_F(HttpNetworkTransactionSpdy3Test, // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the TCPClientSocket was not added back to // the pool. EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session)); trans.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Make sure that the socket didn't get recycled after calling the destructor. EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session)); } @@ -4315,7 +4315,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, RecycleSocket) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); @@ -4374,7 +4374,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, RecycleSSLSocket) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInSSLSocketPool(session)); @@ -4442,7 +4442,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, RecycleDeadSSLSocket) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInSSLSocketPool(session)); @@ -4469,7 +4469,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, RecycleDeadSSLSocket) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInSSLSocketPool(session)); @@ -4526,7 +4526,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, RecycleSocketAfterZeroContentLength) { // Empty the current queue. This is necessary because idle sockets are // added to the connection pool asynchronously with a PostTask. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now check to make sure the socket was added back to the pool. EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); @@ -4696,7 +4696,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, AuthIdentityInURL) { EXPECT_EQ(100, response->headers->GetContentLength()); // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test the request-challenge-retry sequence for basic auth when there is an @@ -4806,7 +4806,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, WrongAuthIdentityInURL) { EXPECT_EQ(100, response->headers->GetContentLength()); // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test that previously tried username/passwords for a realm get re-used. @@ -9742,7 +9742,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, SimpleCancel) { EXPECT_EQ(ERR_IO_PENDING, rv); trans.reset(); // Cancel the transaction here. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test a basic GET request through a proxy. @@ -10781,7 +10781,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, DoNotUseSpdySessionForHttp) { TestCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, trans1.Start(&request1, callback1.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback1.WaitForResult()); EXPECT_TRUE(trans1.GetResponseInfo()->was_fetched_via_spdy); @@ -10795,7 +10795,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, DoNotUseSpdySessionForHttp) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback2.WaitForResult()); EXPECT_FALSE(trans2.GetResponseInfo()->was_fetched_via_spdy); @@ -10866,7 +10866,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, DoNotUseSpdySessionForHttpOverTunnel) { TestCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, trans1.Start(&request1, callback1.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data1.RunFor(4); EXPECT_EQ(OK, callback1.WaitForResult()); @@ -10886,7 +10886,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, DoNotUseSpdySessionForHttpOverTunnel) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data1.RunFor(3); EXPECT_EQ(OK, callback2.WaitForResult()); @@ -10948,7 +10948,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, UseSpdySessionForHttpWhenForced) { TestCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, trans1.Start(&request1, callback1.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback1.WaitForResult()); EXPECT_TRUE(trans1.GetResponseInfo()->was_fetched_via_spdy); @@ -10962,7 +10962,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, UseSpdySessionForHttpWhenForced) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback2.WaitForResult()); EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); @@ -11086,7 +11086,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, DoNotUseSpdySessionIfCertDoesNotMatch) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data2->RunFor(3); ASSERT_TRUE(callback2.have_result()); @@ -11152,7 +11152,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, ErrorSocketNotConnected) { TestCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, trans1.Start(&request1, callback1.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_CONNECTION_CLOSED, callback1.WaitForResult()); // Now, start the second request and make sure it succeeds. @@ -11164,7 +11164,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, ErrorSocketNotConnected) { TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, trans2.Start(&request2, callback2.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data2->RunFor(3); ASSERT_TRUE(callback2.have_result()); diff --git a/net/http/http_pipelined_connection_impl.cc b/net/http/http_pipelined_connection_impl.cc index e72b7c5..c5ca00c 100644 --- a/net/http/http_pipelined_connection_impl.cc +++ b/net/http/http_pipelined_connection_impl.cc @@ -140,7 +140,7 @@ void HttpPipelinedConnectionImpl::InitializeParser( // In case our first stream doesn't SendRequest() immediately, we should still // allow others to use this pipeline. if (pipeline_id == 1) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&HttpPipelinedConnectionImpl::ActivatePipeline, weak_factory_.GetWeakPtr())); @@ -517,7 +517,7 @@ int HttpPipelinedConnectionImpl::DoReadStreamClosed() { return OK; } completed_one_request_ = true; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&HttpPipelinedConnectionImpl::StartNextDeferredRead, weak_factory_.GetWeakPtr())); @@ -773,7 +773,7 @@ void HttpPipelinedConnectionImpl::QueueUserCallback( const tracked_objects::Location& from_here) { CHECK(stream_info_map_[pipeline_id].pending_user_callback.is_null()); stream_info_map_[pipeline_id].pending_user_callback = callback; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( from_here, base::Bind(&HttpPipelinedConnectionImpl::FireUserCallback, weak_factory_.GetWeakPtr(), pipeline_id, rv)); diff --git a/net/http/http_pipelined_connection_impl_unittest.cc b/net/http/http_pipelined_connection_impl_unittest.cc index d8ee985..1bf7597 100644 --- a/net/http/http_pipelined_connection_impl_unittest.cc +++ b/net/http/http_pipelined_connection_impl_unittest.cc @@ -74,7 +74,7 @@ class MockPipelineDelegate : public HttpPipelinedConnection::Delegate { HttpPipelinedConnection::Feedback feedback)); }; -class SuddenCloseObserver : public MessageLoop::TaskObserver { +class SuddenCloseObserver : public base::MessageLoop::TaskObserver { public: SuddenCloseObserver(HttpStream* stream, int close_before_task) : stream_(stream), @@ -85,7 +85,7 @@ class SuddenCloseObserver : public MessageLoop::TaskObserver { ++current_task_; if (current_task_ == close_before_task_) { stream_->Close(false); - MessageLoop::current()->RemoveTaskObserver(this); + base::MessageLoop::current()->RemoveTaskObserver(this); } } @@ -106,7 +106,7 @@ class HttpPipelinedConnectionImplTest : public testing::Test { } void TearDown() { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } void Initialize(MockRead* reads, size_t reads_count, @@ -744,7 +744,7 @@ TEST_F(HttpPipelinedConnectionImplTest, AbortWhileSendingSecondRequest) { data_->RunFor(1); EXPECT_LE(OK, ok_callback.WaitForResult()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); aborted_stream->Close(true); EXPECT_EQ(ERR_PIPELINE_EVICTION, evicted_callback.WaitForResult()); evicted_stream->Close(true); @@ -989,8 +989,8 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseCalledBeforeReadCallback) { // 1. DoReadHeadersLoop, which will post: // 2. InvokeUserCallback SuddenCloseObserver observer(evicted_stream.get(), 2); - MessageLoop::current()->AddTaskObserver(&observer); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->AddTaskObserver(&observer); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(evicted_callback.have_result()); } @@ -1141,7 +1141,7 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseBeforeSendCallbackRuns) { close_stream.reset(); close_callback.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(HttpPipelinedConnectionImplTest, CloseBeforeReadCallbackRuns) { @@ -1175,7 +1175,7 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseBeforeReadCallbackRuns) { close_stream.reset(); close_callback.reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(HttpPipelinedConnectionImplTest, AbortWhileSendQueued) { @@ -1577,7 +1577,7 @@ TEST_F(HttpPipelinedConnectionImplTest, OnPipelineHasCapacity) { &response, callback_.callback())); EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(0); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); stream->Close(false); EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(1); @@ -1594,7 +1594,7 @@ TEST_F(HttpPipelinedConnectionImplTest, OnPipelineHasCapacityWithoutSend) { scoped_ptr<HttpStream> stream(NewTestStream("ok.html")); EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(1); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); stream->Close(false); EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(1); diff --git a/net/http/http_pipelined_network_transaction_unittest.cc b/net/http/http_pipelined_network_transaction_unittest.cc index 8fb1e55..027eb1a 100644 --- a/net/http/http_pipelined_network_transaction_unittest.cc +++ b/net/http/http_pipelined_network_transaction_unittest.cc @@ -722,7 +722,7 @@ TEST_F(HttpPipelinedNetworkTransactionTest, PipelinesImmediatelyIfKnownGood) { second_one_transaction.Start( GetRequestInfo("second-pipeline-one.html"), second_one_callback.callback(), BoundNetLog())); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); HttpNetworkTransaction second_two_transaction( DEFAULT_PRIORITY, session_.get()); @@ -745,7 +745,7 @@ TEST_F(HttpPipelinedNetworkTransactionTest, PipelinesImmediatelyIfKnownGood) { HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets); } -class DataRunnerObserver : public MessageLoop::TaskObserver { +class DataRunnerObserver : public base::MessageLoop::TaskObserver { public: DataRunnerObserver(DeterministicSocketData* data, int run_before_task) : data_(data), @@ -756,7 +756,7 @@ class DataRunnerObserver : public MessageLoop::TaskObserver { ++current_task_; if (current_task_ == run_before_task_) { data_->Run(); - MessageLoop::current()->RemoveTaskObserver(this); + base::MessageLoop::current()->RemoveTaskObserver(this); } } @@ -827,9 +827,9 @@ TEST_F(HttpPipelinedNetworkTransactionTest, OpenPipelinesWhileBinding) { // is called in between when task #3 is scheduled and when it runs. The // DataRunnerObserver does that. DataRunnerObserver observer(data_vector_[0], 3); - MessageLoop::current()->AddTaskObserver(&observer); + base::MessageLoop::current()->AddTaskObserver(&observer); data_vector_[0]->SetStop(4); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); data_vector_[0]->SetStop(10); EXPECT_EQ(OK, one_callback.WaitForResult()); diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc index d1e913b7..188cffa 100644 --- a/net/http/http_response_body_drainer_unittest.cc +++ b/net/http/http_response_body_drainer_unittest.cc @@ -40,7 +40,7 @@ class CloseResultWaiter { CHECK(!waiting_for_result_); while (!have_result_) { waiting_for_result_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_result_ = false; } return result_; @@ -50,7 +50,7 @@ class CloseResultWaiter { result_ = result; have_result_ = true; if (waiting_for_result_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } private: @@ -172,7 +172,7 @@ int MockHttpStream::ReadResponseBody(IOBuffer* buf, user_buf_ = buf; buf_len_ = buf_len; callback_ = callback; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&MockHttpStream::CompleteRead, weak_factory_.GetWeakPtr())); return ERR_IO_PENDING; diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index e93ca83..34eb217 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc @@ -197,7 +197,7 @@ void HttpStreamFactoryImpl::Job::Resume(Job* job) { // We know we're blocked if the next_state_ is STATE_WAIT_FOR_JOB_COMPLETE. // Unblock |this|. if (next_state_ == STATE_WAIT_FOR_JOB_COMPLETE) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&HttpStreamFactoryImpl::Job::OnIOComplete, ptr_factory_.GetWeakPtr(), OK)); @@ -406,7 +406,7 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) { DCHECK(result == OK || waiting_job_ == NULL); if (IsPreconnecting()) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &HttpStreamFactoryImpl::Job::OnPreconnectsComplete, @@ -419,7 +419,7 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) { GetSSLInfo(); next_state_ = STATE_WAITING_USER_ACTION; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &HttpStreamFactoryImpl::Job::OnCertificateErrorCallback, @@ -441,7 +441,7 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) { proxy_socket->GetConnectResponseInfo(); next_state_ = STATE_WAITING_USER_ACTION; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &HttpStreamFactoryImpl::Job::OnNeedsProxyAuthCallback, @@ -452,7 +452,7 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) { return ERR_IO_PENDING; case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &HttpStreamFactoryImpl::Job::OnNeedsClientAuthCallback, @@ -468,7 +468,7 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) { ProxyClientSocket* proxy_socket = static_cast<ProxyClientSocket*>(connection_->socket()); - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &HttpStreamFactoryImpl::Job::OnHttpsProxyTunnelResponseCallback, @@ -481,13 +481,13 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) { case OK: next_state_ = STATE_DONE; if (new_spdy_session_) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &HttpStreamFactoryImpl::Job::OnSpdySessionReadyCallback, ptr_factory_.GetWeakPtr())); } else { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &HttpStreamFactoryImpl::Job::OnStreamReadyCallback, @@ -496,7 +496,7 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) { return ERR_IO_PENDING; default: - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &HttpStreamFactoryImpl::Job::OnStreamFailedCallback, diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 97ebfa0..cac7f02 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc @@ -42,7 +42,7 @@ class MockHttpStreamFactoryImpl : public HttpStreamFactoryImpl { void WaitForPreconnects() { while (!preconnect_done_) { waiting_for_preconnect_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_preconnect_ = false; } } @@ -52,7 +52,7 @@ class MockHttpStreamFactoryImpl : public HttpStreamFactoryImpl { virtual void OnPreconnectsCompleteInternal() OVERRIDE { preconnect_done_ = true; if (waiting_for_preconnect_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } bool preconnect_done_; @@ -73,7 +73,7 @@ class StreamRequestWaiter : public HttpStreamRequest::Delegate { HttpStreamBase* stream) OVERRIDE { stream_done_ = true; if (waiting_for_stream_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); stream_.reset(stream); used_ssl_config_ = used_ssl_config; } @@ -103,7 +103,7 @@ class StreamRequestWaiter : public HttpStreamRequest::Delegate { void WaitForStream() { while (!stream_done_) { waiting_for_stream_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_stream_ = false; } } diff --git a/net/http/http_transaction_unittest.cc b/net/http/http_transaction_unittest.cc index ab5688d4..7b9ef46 100644 --- a/net/http/http_transaction_unittest.cc +++ b/net/http/http_transaction_unittest.cc @@ -197,7 +197,7 @@ void TestTransactionConsumer::DidFinish(int result) { state_ = DONE; error_ = result; if (--quit_counter_ == 0) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } void TestTransactionConsumer::Read() { @@ -373,7 +373,7 @@ void MockNetworkTransaction::SetPriority(net::RequestPriority priority) { void MockNetworkTransaction::CallbackLater( const net::CompletionCallback& callback, int result) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, weak_factory_.GetWeakPtr(), callback, result)); } diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc index 10fdab4b..a17af59 100644 --- a/net/http/mock_http_cache.cc +++ b/net/http/mock_http_cache.cc @@ -281,8 +281,9 @@ void MockDiskEntry::CallbackLater(const net::CompletionCallback& callback, int result) { if (ignore_callbacks_) return StoreAndDeliverCallbacks(true, this, callback, result); - MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &MockDiskEntry::RunCallback, this, callback, result)); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&MockDiskEntry::RunCallback, this, callback, result)); } void MockDiskEntry::RunCallback( @@ -472,7 +473,7 @@ void MockDiskCache::ReleaseAll() { void MockDiskCache::CallbackLater(const net::CompletionCallback& callback, int result) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&CallbackForwader, callback, result)); } diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc index f122841..350cdc9 100644 --- a/net/ocsp/nss_ocsp.cc +++ b/net/ocsp/nss_ocsp.cc @@ -59,7 +59,7 @@ class OCSPIOLoop { void StartUsing() { base::AutoLock autolock(lock_); used_ = true; - io_loop_ = MessageLoopForIO::current(); + io_loop_ = base::MessageLoopForIO::current(); DCHECK(io_loop_); } @@ -85,7 +85,7 @@ class OCSPIOLoop { void ReuseForTesting() { { base::AutoLock autolock(lock_); - DCHECK(MessageLoopForIO::current()); + DCHECK(base::MessageLoopForIO::current()); thread_checker_.DetachFromThread(); thread_checker_.CalledOnValidThread(); shutdown_ = false; @@ -107,7 +107,7 @@ class OCSPIOLoop { std::set<OCSPRequestSession*> requests_; // Protected by |lock_|. bool used_; // Protected by |lock_|. // This should not be modified after |used_|. - MessageLoopForIO* io_loop_; // Protected by |lock_|. + base::MessageLoopForIO* io_loop_; // Protected by |lock_|. base::ThreadChecker thread_checker_; DISALLOW_COPY_AND_ASSIGN(OCSPIOLoop); @@ -282,7 +282,7 @@ class OCSPRequestSession const GURL& new_url, bool* defer_redirect) OVERRIDE { DCHECK_EQ(request, request_); - DCHECK_EQ(MessageLoopForIO::current(), io_loop_); + DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); if (!new_url.SchemeIs("http")) { // Prevent redirects to non-HTTP schemes, including HTTPS. This matches @@ -293,7 +293,7 @@ class OCSPRequestSession virtual void OnResponseStarted(URLRequest* request) OVERRIDE { DCHECK_EQ(request, request_); - DCHECK_EQ(MessageLoopForIO::current(), io_loop_); + DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); int bytes_read = 0; if (request->status().is_success()) { @@ -308,7 +308,7 @@ class OCSPRequestSession virtual void OnReadCompleted(URLRequest* request, int bytes_read) OVERRIDE { DCHECK_EQ(request, request_); - DCHECK_EQ(MessageLoopForIO::current(), io_loop_); + DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); do { if (!request_->status().is_success() || bytes_read <= 0) @@ -336,7 +336,7 @@ class OCSPRequestSession { base::AutoLock autolock(lock_); if (io_loop_) - DCHECK_EQ(MessageLoopForIO::current(), io_loop_); + DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); } #endif if (request_) { @@ -389,7 +389,7 @@ class OCSPRequestSession { base::AutoLock autolock(lock_); DCHECK(!io_loop_); - io_loop_ = MessageLoopForIO::current(); + io_loop_ = base::MessageLoopForIO::current(); g_ocsp_io_loop.Get().AddRequest(this); } @@ -438,7 +438,7 @@ class OCSPRequestSession mutable base::Lock lock_; base::ConditionVariable cv_; - MessageLoop* io_loop_; // Message loop of the IO thread + base::MessageLoop* io_loop_; // Message loop of the IO thread bool finished_; DISALLOW_COPY_AND_ASSIGN(OCSPRequestSession); @@ -536,7 +536,7 @@ void OCSPIOLoop::PostTaskToIOLoop( void OCSPIOLoop::EnsureIOLoop() { base::AutoLock autolock(lock_); - DCHECK_EQ(MessageLoopForIO::current(), io_loop_); + DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); } void OCSPIOLoop::AddRequest(OCSPRequestSession* request) { @@ -940,7 +940,7 @@ char* GetAlternateOCSPAIAInfo(CERTCertificate *cert) { void SetMessageLoopForNSSHttpIO() { // Must have a MessageLoopForIO. - DCHECK(MessageLoopForIO::current()); + DCHECK(base::MessageLoopForIO::current()); bool used = g_ocsp_io_loop.Get().used(); diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc index 8c81cce..a8240c8 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc @@ -146,7 +146,7 @@ class FetcherClient { void FinishTestAllowCleanup() { fetcher_->FinishTest(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TestCompletionCallback callback_; @@ -203,7 +203,7 @@ TEST(DhcpProxyScriptAdapterFetcher, CancelWhileDhcp) { FetcherClient client; client.RunTest(); client.fetcher_->Cancel(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_FALSE(client.fetcher_->DidFinish()); ASSERT_TRUE(client.fetcher_->WasCancelled()); EXPECT_EQ(ERR_ABORTED, client.fetcher_->GetResult()); @@ -221,10 +221,10 @@ TEST(DhcpProxyScriptAdapterFetcher, CancelWhileFetcher) { int max_loops = 4; while (!client.fetcher_->IsWaitingForFetcher() && max_loops--) { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } client.fetcher_->Cancel(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_FALSE(client.fetcher_->DidFinish()); ASSERT_TRUE(client.fetcher_->WasCancelled()); EXPECT_EQ(ERR_ABORTED, client.fetcher_->GetResult()); diff --git a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc index 6e54559..d5b68c8 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc @@ -99,9 +99,9 @@ class RealFetchTester { void WaitUntilDone() { while (!finished_) { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Attempts to give worker threads time to finish. This is currently @@ -145,7 +145,7 @@ TEST(DhcpProxyScriptFetcherWin, RealFetchWithCancel) { // exercises the code without stubbing out dependencies. RealFetchTester fetcher; fetcher.RunTestWithCancel(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Attempt to avoid Valgrind leak reports in case worker thread is // still running. @@ -389,16 +389,16 @@ public: void RunMessageLoopUntilComplete() { while (!finished_) { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } void RunMessageLoopUntilWorkerDone() { DCHECK(fetcher_.adapter_query_.get()); while (!fetcher_.worker_finished_event_.TimedWait( base::TimeDelta::FromMilliseconds(10))) { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } } diff --git a/net/proxy/mock_proxy_resolver.cc b/net/proxy/mock_proxy_resolver.cc index c50f7d4..6878d24 100644 --- a/net/proxy/mock_proxy_resolver.cc +++ b/net/proxy/mock_proxy_resolver.cc @@ -10,14 +10,15 @@ namespace net { MockAsyncProxyResolverBase::Request::Request( - MockAsyncProxyResolverBase* resolver, const GURL& url, ProxyInfo* results, + MockAsyncProxyResolverBase* resolver, + const GURL& url, + ProxyInfo* results, const CompletionCallback& callback) - : resolver_(resolver), - url_(url), - results_(results), - callback_(callback), - origin_loop_(MessageLoop::current()) { - } + : resolver_(resolver), + url_(url), + results_(results), + callback_(callback), + origin_loop_(base::MessageLoop::current()) {} void MockAsyncProxyResolverBase::Request::CompleteNow(int rv) { CompletionCallback callback = callback_; @@ -30,16 +31,14 @@ MockAsyncProxyResolverBase::Request::Request( MockAsyncProxyResolverBase::Request::~Request() {} - MockAsyncProxyResolverBase::SetPacScriptRequest::SetPacScriptRequest( - MockAsyncProxyResolverBase* resolver, - const scoped_refptr<ProxyResolverScriptData>& script_data, - const CompletionCallback& callback) - : resolver_(resolver), - script_data_(script_data), - callback_(callback), - origin_loop_(MessageLoop::current()) { - } + MockAsyncProxyResolverBase* resolver, + const scoped_refptr<ProxyResolverScriptData>& script_data, + const CompletionCallback& callback) + : resolver_(resolver), + script_data_(script_data), + callback_(callback), + origin_loop_(base::MessageLoop::current()) {} MockAsyncProxyResolverBase::SetPacScriptRequest::~SetPacScriptRequest() {} diff --git a/net/proxy/mock_proxy_script_fetcher.cc b/net/proxy/mock_proxy_script_fetcher.cc index de4245b..ef1ff83 100644 --- a/net/proxy/mock_proxy_script_fetcher.cc +++ b/net/proxy/mock_proxy_script_fetcher.cc @@ -30,7 +30,7 @@ int MockProxyScriptFetcher::Fetch(const GURL& url, base::string16* text, pending_request_text_ = text; if (waiting_for_fetch_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); return ERR_IO_PENDING; } @@ -62,7 +62,7 @@ bool MockProxyScriptFetcher::has_pending_request() const { void MockProxyScriptFetcher::WaitUntilFetch() { DCHECK(!has_pending_request()); waiting_for_fetch_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_fetch_ = false; } diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc index 2eb42be..21ae9bc 100644 --- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc +++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc @@ -30,7 +30,7 @@ class MockProxyResolver : public ProxyResolver { public: MockProxyResolver() : ProxyResolver(true /*expects_pac_bytes*/), - wrong_loop_(MessageLoop::current()), + wrong_loop_(base::MessageLoop::current()), request_count_(0), purge_count_(0) {} @@ -100,10 +100,10 @@ class MockProxyResolver : public ProxyResolver { // message loop of MultiThreadedProxyResolver's worker thread, we do // know that it is going to be distinct from the loop running the // test, so at least make sure it isn't the main loop. - EXPECT_NE(MessageLoop::current(), wrong_loop_); + EXPECT_NE(base::MessageLoop::current(), wrong_loop_); } - MessageLoop* wrong_loop_; + base::MessageLoop* wrong_loop_; int request_count_; int purge_count_; scoped_refptr<ProxyResolverScriptData> last_script_data_; @@ -561,7 +561,7 @@ TEST(MultiThreadedProxyResolverTest, SingleThread_CancelRequestByDeleting) { resolver.reset(); // Give any posted tasks a chance to run (in case there is badness). - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Check that none of the outstanding requests were completed. EXPECT_FALSE(callback0.have_result()); @@ -645,7 +645,7 @@ TEST(MultiThreadedProxyResolverTest, ThreeThreads_Basic) { ASSERT_EQ(1u, factory->resolvers().size()); EXPECT_EQ(1, factory->resolvers()[0]->request_count()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now start 8 requests in parallel -- this will cause the maximum of // three threads to be provisioned (an additional two from what we already diff --git a/net/proxy/network_delegate_error_observer_unittest.cc b/net/proxy/network_delegate_error_observer_unittest.cc index 2517291..a786a4c 100644 --- a/net/proxy/network_delegate_error_observer_unittest.cc +++ b/net/proxy/network_delegate_error_observer_unittest.cc @@ -107,7 +107,7 @@ TEST(NetworkDelegateErrorObserverTest, CallOnThread) { base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, base::Unretained(&observer), 42, base::string16())); thread.Stop(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_TRUE(network_delegate.got_pac_error()); } @@ -122,7 +122,7 @@ TEST(NetworkDelegateErrorObserverTest, NoDelegate) { base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, base::Unretained(&observer), 42, base::string16())); thread.Stop(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Shouldn't have crashed until here... } diff --git a/net/proxy/proxy_config_service_android_unittest.cc b/net/proxy/proxy_config_service_android_unittest.cc index faa9fd1..cb8fa7a 100644 --- a/net/proxy/proxy_config_service_android_unittest.cc +++ b/net/proxy/proxy_config_service_android_unittest.cc @@ -53,12 +53,11 @@ class ProxyConfigServiceAndroidTestBase : public testing::Test { // suite (see net/test/net_test_suite.cc). ProxyConfigServiceAndroidTestBase(const StringMap& initial_configuration) : configuration_(initial_configuration), - message_loop_(MessageLoop::current()), - service_( - message_loop_->message_loop_proxy(), - message_loop_->message_loop_proxy(), - base::Bind(&ProxyConfigServiceAndroidTestBase::GetProperty, - base::Unretained(this))) {} + message_loop_(base::MessageLoop::current()), + service_(message_loop_->message_loop_proxy(), + message_loop_->message_loop_proxy(), + base::Bind(&ProxyConfigServiceAndroidTestBase::GetProperty, + base::Unretained(this))) {} virtual ~ProxyConfigServiceAndroidTestBase() {} @@ -104,7 +103,7 @@ class ProxyConfigServiceAndroidTestBase : public testing::Test { StringMap configuration_; TestObserver observer_; - MessageLoop* const message_loop_; + base::MessageLoop* const message_loop_; ProxyConfigServiceAndroid service_; }; diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index b1dda52..b735a92 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -231,7 +231,7 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter { } virtual bool Init(base::SingleThreadTaskRunner* glib_thread_task_runner, - MessageLoopForIO* file_loop) OVERRIDE { + base::MessageLoopForIO* file_loop) OVERRIDE { DCHECK(glib_thread_task_runner->BelongsToCurrentThread()); DCHECK(!client_); DCHECK(!task_runner_); @@ -559,7 +559,7 @@ class SettingGetterImplGSettings bool LoadAndCheckVersion(base::Environment* env); virtual bool Init(base::SingleThreadTaskRunner* glib_thread_task_runner, - MessageLoopForIO* file_loop) OVERRIDE { + base::MessageLoopForIO* file_loop) OVERRIDE { DCHECK(glib_thread_task_runner->BelongsToCurrentThread()); DCHECK(!client_); DCHECK(!task_runner_); @@ -917,7 +917,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, } virtual bool Init(base::SingleThreadTaskRunner* glib_thread_task_runner, - MessageLoopForIO* file_loop) OVERRIDE { + base::MessageLoopForIO* file_loop) OVERRIDE { // This has to be called on the UI thread (http://crbug.com/69057). base::ThreadRestrictions::ScopedAllowIO allow_io; DCHECK(inotify_fd_ < 0); @@ -952,7 +952,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, virtual bool SetUpNotifications( ProxyConfigServiceLinux::Delegate* delegate) OVERRIDE { DCHECK(inotify_fd_ >= 0); - DCHECK(MessageLoop::current() == file_loop_); + DCHECK(base::MessageLoop::current() == file_loop_); // We can't just watch the kioslaverc file directly, since KDE will write // a new copy of it and then rename it whenever settings are changed and // inotify watches inodes (so we'll be watching the old deleted file after @@ -962,8 +962,11 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, IN_MODIFY | IN_MOVED_TO) < 0) return false; notify_delegate_ = delegate; - if (!file_loop_->WatchFileDescriptor(inotify_fd_, true, - MessageLoopForIO::WATCH_READ, &inotify_watcher_, this)) + if (!file_loop_->WatchFileDescriptor(inotify_fd_, + true, + base::MessageLoopForIO::WATCH_READ, + &inotify_watcher_, + this)) return false; // Simulate a change to avoid possibly losing updates before this point. OnChangeNotification(); @@ -977,7 +980,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, // Implement base::MessagePumpLibevent::Watcher. virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE { DCHECK_EQ(fd, inotify_fd_); - DCHECK(MessageLoop::current() == file_loop_); + DCHECK(base::MessageLoop::current() == file_loop_); OnChangeNotification(); } virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE { @@ -1243,7 +1246,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, // This is the callback from the debounce timer. void OnDebouncedNotification() { - DCHECK(MessageLoop::current() == file_loop_); + DCHECK(base::MessageLoop::current() == file_loop_); VLOG(1) << "inotify change notification for kioslaverc"; UpdateCachedSettings(); CHECK(notify_delegate_); @@ -1256,7 +1259,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, // an event for kioslaverc is seen. void OnChangeNotification() { DCHECK_GE(inotify_fd_, 0); - DCHECK(MessageLoop::current() == file_loop_); + DCHECK(base::MessageLoop::current() == file_loop_); char event_buf[(sizeof(inotify_event) + NAME_MAX + 1) * 4]; bool kioslaverc_touched = false; ssize_t r; @@ -1329,7 +1332,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, // Message loop of the file thread, for reading kioslaverc. If NULL, // just read it directly (for testing). We also handle inotify events // on this thread. - MessageLoopForIO* file_loop_; + base::MessageLoopForIO* file_loop_; DISALLOW_COPY_AND_ASSIGN(SettingGetterImplKDE); }; @@ -1548,7 +1551,7 @@ ProxyConfigServiceLinux::Delegate::Delegate( void ProxyConfigServiceLinux::Delegate::SetUpAndFetchInitialConfig( base::SingleThreadTaskRunner* glib_thread_task_runner, base::SingleThreadTaskRunner* io_thread_task_runner, - MessageLoopForIO* file_loop) { + base::MessageLoopForIO* file_loop) { // We should be running on the default glib main loop thread right // now. gconf can only be accessed from this thread. DCHECK(glib_thread_task_runner->BelongsToCurrentThread()); diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc index 4e9409f..75c5cf1 100644 --- a/net/proxy/proxy_config_service_linux_unittest.cc +++ b/net/proxy/proxy_config_service_linux_unittest.cc @@ -176,7 +176,7 @@ class MockSettingGetter } virtual bool Init(base::SingleThreadTaskRunner* glib_thread_task_runner, - MessageLoopForIO* file_loop) OVERRIDE { + base::MessageLoopForIO* file_loop) OVERRIDE { return true; } @@ -265,7 +265,7 @@ class SynchConfigGetter { config_service_(config_service) { // Start an IO thread. base::Thread::Options options; - options.message_loop_type = MessageLoop::TYPE_IO; + options.message_loop_type = base::MessageLoop::TYPE_IO; io_thread_.StartWithOptions(options); // Make sure the thread started. @@ -288,12 +288,13 @@ class SynchConfigGetter { // all on the calling thread (meant to be the thread with the // default glib main loop, which is the UI thread). void SetupAndInitialFetch() { - MessageLoop* file_loop = io_thread_.message_loop(); - DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type()); + base::MessageLoop* file_loop = io_thread_.message_loop(); + DCHECK_EQ(base::MessageLoop::TYPE_IO, file_loop->type()); // We pass the mock IO thread as both the IO and file threads. config_service_->SetupAndFetchInitialConfig( - base::MessageLoopProxy::current(), io_thread_.message_loop_proxy(), - static_cast<MessageLoopForIO*>(file_loop)); + base::MessageLoopProxy::current(), + io_thread_.message_loop_proxy(), + static_cast<base::MessageLoopForIO*>(file_loop)); } // Synchronously gets the proxy config. net::ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig( @@ -322,7 +323,7 @@ class SynchConfigGetter { // [Runs on |io_thread_|] Signals |event_| on cleanup completion. void CleanUp() { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); event_.Signal(); } diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc index ddd82a5..63e94d9 100644 --- a/net/proxy/proxy_resolver_v8_tracing.cc +++ b/net/proxy/proxy_resolver_v8_tracing.cc @@ -134,7 +134,7 @@ class ProxyResolverV8Tracing::Job void ReleaseCallback(); ProxyResolverV8* v8_resolver(); - MessageLoop* worker_loop(); + base::MessageLoop* worker_loop(); HostResolver* host_resolver(); ProxyResolverErrorObserver* error_observer(); NetLog* net_log(); @@ -441,7 +441,7 @@ ProxyResolverV8Tracing::Job::~Job() { } void ProxyResolverV8Tracing::Job::CheckIsOnWorkerThread() const { - DCHECK_EQ(MessageLoop::current(), parent_->thread_->message_loop()); + DCHECK_EQ(base::MessageLoop::current(), parent_->thread_->message_loop()); } void ProxyResolverV8Tracing::Job::CheckIsOnOriginThread() const { diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc index 2c5ee2b..a4214bd 100644 --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc @@ -35,7 +35,7 @@ class ProxyResolverV8TracingTest : public testing::Test { // Drain any pending messages, which may be left over from cancellation. // This way they get reliably run as part of the current test, rather than // spilling into the next test's execution. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } }; @@ -776,7 +776,7 @@ class BlockableHostResolver : public HostResolver { // Indicate to the caller that a request was received. EXPECT_TRUE(waiting_for_resolve_); - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); // This line is intentionally after action_.Run(), since one of the // tests does a cancellation inside of Resolve(), and it is more @@ -807,7 +807,7 @@ class BlockableHostResolver : public HostResolver { // Waits until Resolve() has been called. void WaitUntilRequestIsReceived() { waiting_for_resolve_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); DCHECK(waiting_for_resolve_); waiting_for_resolve_ = false; } diff --git a/net/proxy/proxy_script_decider_unittest.cc b/net/proxy/proxy_script_decider_unittest.cc index 1517596..24808c1 100644 --- a/net/proxy/proxy_script_decider_unittest.cc +++ b/net/proxy/proxy_script_decider_unittest.cc @@ -542,7 +542,7 @@ class AsyncFailDhcpFetcher virtual int Fetch(base::string16* utf16_text, const CompletionCallback& callback) OVERRIDE { callback_ = callback; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&AsyncFailDhcpFetcher::CallbackWithFailure, AsWeakPtr())); return ERR_IO_PENDING; @@ -592,7 +592,7 @@ TEST(ProxyScriptDeciderTest, DhcpCancelledByDestructor) { // back. Before the fix linked to above, this would try to invoke on // the callback object provided by ProxyScriptDecider after it was // no longer valid. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } } // namespace diff --git a/net/proxy/proxy_script_fetcher_impl.cc b/net/proxy/proxy_script_fetcher_impl.cc index d13fc46..4338a67 100644 --- a/net/proxy/proxy_script_fetcher_impl.cc +++ b/net/proxy/proxy_script_fetcher_impl.cc @@ -157,9 +157,10 @@ int ProxyScriptFetcherImpl::Fetch( // Post a task to timeout this request if it takes too long. cur_request_id_ = ++next_id_; - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, - base::Bind(&ProxyScriptFetcherImpl::OnTimeout, weak_factory_.GetWeakPtr(), + base::Bind(&ProxyScriptFetcherImpl::OnTimeout, + weak_factory_.GetWeakPtr(), cur_request_id_), max_duration_); diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 7dd9435..c28c11d 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -591,7 +591,7 @@ class ProxyService::ProxyScriptDeciderPoller { void StartPollTimer() { DCHECK(!decider_.get()); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&ProxyScriptDeciderPoller::DoPoll, weak_factory_.GetWeakPtr()), @@ -638,14 +638,13 @@ class ProxyService::ProxyScriptDeciderPoller { // rather than calling it directly -- this is done to avoid an ugly // destruction sequence, since |this| might be destroyed as a result of // the notification. - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind( - &ProxyScriptDeciderPoller::NotifyProxyServiceOfChange, - weak_factory_.GetWeakPtr(), - result, - make_scoped_refptr(decider_->script_data()), - decider_->effective_config())); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&ProxyScriptDeciderPoller::NotifyProxyServiceOfChange, + weak_factory_.GetWeakPtr(), + result, + make_scoped_refptr(decider_->script_data()), + decider_->effective_config())); return; } @@ -1336,7 +1335,7 @@ void ProxyService::ForceReloadProxyConfig() { // static ProxyConfigService* ProxyService::CreateSystemProxyConfigService( base::SingleThreadTaskRunner* io_thread_task_runner, - MessageLoop* file_loop) { + base::MessageLoop* file_loop) { #if defined(OS_WIN) return new ProxyConfigServiceWin(); #elif defined(OS_IOS) @@ -1359,21 +1358,22 @@ ProxyConfigService* ProxyService::CreateSystemProxyConfigService( base::ThreadTaskRunnerHandle::Get(); // The file loop should be a MessageLoopForIO on Linux. - DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type()); + DCHECK_EQ(base::MessageLoop::TYPE_IO, file_loop->type()); // Synchronously fetch the current proxy config (since we are // running on glib_default_loop). Additionally register for // notifications (delivered in either |glib_default_loop| or // |file_loop|) to keep us updated when the proxy config changes. linux_config_service->SetupAndFetchInitialConfig( - glib_thread_task_runner, io_thread_task_runner, - static_cast<MessageLoopForIO*>(file_loop)); + glib_thread_task_runner, + io_thread_task_runner, + static_cast<base::MessageLoopForIO*>(file_loop)); return linux_config_service; #elif defined(OS_ANDROID) return new ProxyConfigServiceAndroid( io_thread_task_runner, - MessageLoop::current()->message_loop_proxy()); + base::MessageLoop::current()->message_loop_proxy()); #else LOG(WARNING) << "Failed to choose a system proxy settings fetcher " "for this platform."; @@ -1502,20 +1502,21 @@ void ProxyService::OnDNSChanged() { OnIPAddressChanged(); } -SyncProxyServiceHelper::SyncProxyServiceHelper(MessageLoop* io_message_loop, - ProxyService* proxy_service) +SyncProxyServiceHelper::SyncProxyServiceHelper( + base::MessageLoop* io_message_loop, + ProxyService* proxy_service) : io_message_loop_(io_message_loop), proxy_service_(proxy_service), event_(false, false), callback_(base::Bind(&SyncProxyServiceHelper::OnCompletion, base::Unretained(this))) { - DCHECK(io_message_loop_ != MessageLoop::current()); + DCHECK(io_message_loop_ != base::MessageLoop::current()); } int SyncProxyServiceHelper::ResolveProxy(const GURL& url, ProxyInfo* proxy_info, const BoundNetLog& net_log) { - DCHECK(io_message_loop_ != MessageLoop::current()); + DCHECK(io_message_loop_ != base::MessageLoop::current()); io_message_loop_->PostTask( FROM_HERE, @@ -1532,7 +1533,7 @@ int SyncProxyServiceHelper::ResolveProxy(const GURL& url, int SyncProxyServiceHelper::ReconsiderProxyAfterError( const GURL& url, ProxyInfo* proxy_info, const BoundNetLog& net_log) { - DCHECK(io_message_loop_ != MessageLoop::current()); + DCHECK(io_message_loop_ != base::MessageLoop::current()); io_message_loop_->PostTask( FROM_HERE, diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc index 53cc326..e9abcee 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc @@ -2156,7 +2156,7 @@ TEST_F(ProxyServiceTest, NetworkChangeTriggersPacRefetch) { // going to return the same PAC URL as before, but this URL needs to be // refetched on the new network. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); // Notification happens async. + base::MessageLoop::current()->RunUntilIdle(); // Notification happens async. // Start a second request. ProxyInfo info2; @@ -2278,7 +2278,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterFailure) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); fetcher->NotifyFetchCompletion(OK, kValidPacScript1); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now that the PAC script is downloaded, it should be used to initialize the // ProxyResolver. Simulate a successful parse. @@ -2390,7 +2390,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterContentChange) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); fetcher->NotifyFetchCompletion(OK, kValidPacScript2); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now that the PAC script is downloaded, it should be used to initialize the // ProxyResolver. Simulate a successful parse. @@ -2500,7 +2500,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterContentUnchanged) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); fetcher->NotifyFetchCompletion(OK, kValidPacScript1); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_FALSE(resolver->has_pending_set_pac_script_request()); @@ -2606,7 +2606,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterSuccess) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); fetcher->NotifyFetchCompletion(ERR_FAILED, std::string()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // At this point the ProxyService should have re-configured itself to use // DIRECT connections rather than the given proxy resolver. @@ -2775,7 +2775,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterActivity) { // Drain the message loop, so ProxyService is notified of the change // and has a chance to re-configure itself. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Start a third request -- this time we expect to get a direct connection // since the PAC script poller experienced a failure. diff --git a/net/quic/quic_client_session.cc b/net/quic/quic_client_session.cc index 5a993e6..493dac8 100644 --- a/net/quic/quic_client_session.cc +++ b/net/quic/quic_client_session.cc @@ -142,7 +142,7 @@ void QuicClientSession::StartReading() { // Data was read, process it. // Schedule the work through the message loop to avoid recursive // callbacks. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&QuicClientSession::OnReadComplete, weak_factory_.GetWeakPtr(), rv)); diff --git a/net/quic/quic_connection_helper_test.cc b/net/quic/quic_connection_helper_test.cc index fa7484a..9b6c86f 100644 --- a/net/quic/quic_connection_helper_test.cc +++ b/net/quic/quic_connection_helper_test.cc @@ -362,7 +362,7 @@ TEST_F(QuicConnectionHelperTest, WritePacketToWireAsync) { int error = 0; EXPECT_EQ(-1, helper_->WritePacketToWire(*GetWrite(0), &error)); EXPECT_EQ(ERR_IO_PENDING, error); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(AtEof()); } diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc index 275faf2..02ad4d5 100644 --- a/net/quic/quic_network_transaction_unittest.cc +++ b/net/quic/quic_network_transaction_unittest.cc @@ -76,16 +76,16 @@ class QuicNetworkTransactionTest : public PlatformTest { virtual void SetUp() { NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } virtual void TearDown() { NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); PlatformTest::TearDown(); NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); HttpStreamFactory::set_use_alternate_protocols(false); HttpStreamFactory::SetNextProtos(std::vector<std::string>()); } diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index ee4fa62..c1660c8 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc @@ -374,7 +374,7 @@ QuicClientSession* QuicStreamFactory::CreateSession( socket->Connect(addr); QuicConnectionHelper* helper = new QuicConnectionHelper( - MessageLoop::current()->message_loop_proxy(), + base::MessageLoop::current()->message_loop_proxy(), clock_.get(), random_generator_, socket); QuicConnection* connection = new QuicConnection(guid, addr, helper, false); diff --git a/net/socket/buffered_write_stream_socket.cc b/net/socket/buffered_write_stream_socket.cc index 9137b06..734696b 100644 --- a/net/socket/buffered_write_stream_socket.cc +++ b/net/socket/buffered_write_stream_socket.cc @@ -50,7 +50,7 @@ int BufferedWriteStreamSocket::Write(IOBuffer* buf, int buf_len, wrapped_write_in_progress_ ? backup_buffer_.get() : io_buffer_.get(); AppendBuffer(idle_buffer, buf, buf_len); if (!callback_pending_) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&BufferedWriteStreamSocket::DoDelayedWrite, weak_factory_.GetWeakPtr())); diff --git a/net/socket/buffered_write_stream_socket_unittest.cc b/net/socket/buffered_write_stream_socket_unittest.cc index 9b6969d..add91ff 100644 --- a/net/socket/buffered_write_stream_socket_unittest.cc +++ b/net/socket/buffered_write_stream_socket_unittest.cc @@ -19,7 +19,7 @@ namespace { class BufferedWriteStreamSocketTest : public testing::Test { public: void Finish() { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(data_->at_read_eof()); EXPECT_TRUE(data_->at_write_eof()); } @@ -86,7 +86,7 @@ TEST_F(BufferedWriteStreamSocketTest, WriteWhileBlocked) { }; Initialize(writes, arraysize(writes)); TestWrite("abc"); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); TestWrite("def"); data_->RunFor(1); TestWrite("ghi"); diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 8343c0c..c6d9e3d 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -249,7 +249,7 @@ int ClientSocketPoolBaseHelper::RequestSocket( // re-entrancy issues if the socket pool is doing something else at the // time. if (group->IsStalledOnPoolMaxSockets(max_sockets_per_group_)) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind( &ClientSocketPoolBaseHelper::TryToCloseSocketsInLayeredPools, @@ -1093,7 +1093,7 @@ void ClientSocketPoolBaseHelper::InvokeUserCallbackLater( ClientSocketHandle* handle, const CompletionCallback& callback, int rv) { CHECK(!ContainsKey(pending_callback_map_, handle)); pending_callback_map_[handle] = CallbackResultPair(callback, rv); - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&ClientSocketPoolBaseHelper::InvokeUserCallback, weak_factory_.GetWeakPtr(), handle)); @@ -1140,7 +1140,7 @@ void ClientSocketPoolBaseHelper::Group::StartBackupSocketTimer( if (weak_factory_.HasWeakPtrs()) return; - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&Group::OnBackupSocketTimerFired, weak_factory_.GetWeakPtr(), group_name, pool), diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 59b24e5..9018a4a 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -308,7 +308,7 @@ class TestConnectJob : public ConnectJob { // abstract time for the purpose of unittests. Unfortunately, we have // a lot of third-party components that directly call the various // time functions, so this change would be rather invasive. - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(base::IgnoreResult(&TestConnectJob::DoConnect), weak_factory_.GetWeakPtr(), @@ -319,7 +319,7 @@ class TestConnectJob : public ConnectJob { return ERR_IO_PENDING; case kMockPendingFailingJob: set_load_state(LOAD_STATE_CONNECTING); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(base::IgnoreResult(&TestConnectJob::DoConnect), weak_factory_.GetWeakPtr(), @@ -333,7 +333,7 @@ class TestConnectJob : public ConnectJob { waiting_success_ = true; return ERR_IO_PENDING; case kMockAdvancingLoadStateJob: - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&TestConnectJob::AdvanceLoadState, weak_factory_.GetWeakPtr(), load_state_)); return ERR_IO_PENDING; @@ -342,7 +342,7 @@ class TestConnectJob : public ConnectJob { true /* recoverable */); case kMockPendingRecoverableJob: set_load_state(LOAD_STATE_CONNECTING); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(base::IgnoreResult(&TestConnectJob::DoConnect), weak_factory_.GetWeakPtr(), @@ -358,7 +358,7 @@ class TestConnectJob : public ConnectJob { case kMockPendingAdditionalErrorStateJob: set_load_state(LOAD_STATE_CONNECTING); store_additional_error_state_ = true; - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(base::IgnoreResult(&TestConnectJob::DoConnect), weak_factory_.GetWeakPtr(), @@ -402,7 +402,7 @@ class TestConnectJob : public ConnectJob { if (tmp < LOAD_STATE_SENDING_REQUEST) { state = static_cast<LoadState>(tmp); set_load_state(state); - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&TestConnectJob::AdvanceLoadState, weak_factory_.GetWeakPtr(), state)); } @@ -638,14 +638,14 @@ class TestConnectJobDelegate : public ConnectJob::Delegate { delete job; have_result_ = true; if (waiting_for_result_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } int WaitForResult() { DCHECK(!waiting_for_result_); while (!have_result_) { waiting_for_result_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_result_ = false; } have_result_ = false; // auto-reset for next callback @@ -1034,7 +1034,7 @@ TEST_F(ClientSocketPoolBaseTest, TotalLimitCountsConnectingSockets) { // to flush all tasks, we need to wait so that we know there are no // soon-to-be-pending tasks waiting. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The next synchronous request should wait for its turn. connect_job_factory_->set_job_type(TestConnectJob::kMockJob); @@ -1269,7 +1269,7 @@ TEST_F(ClientSocketPoolBaseTest, CloseIdleSocketAtSocketLimitDeleteGroup) { } // Flush all the DoReleaseSocket tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Stall a group. Set a pending job so it'll trigger a backup job if we don't // reuse a socket. @@ -1465,8 +1465,9 @@ class RequestSocketCallback : public TestCompletionCallbackBase { // TODO: Resolve conflicting intentions of stopping recursion with the // |!within_callback_| test (above) and the call to |RunUntilIdle()| // below. http://crbug.com/114130. - MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::ScopedNestableTaskAllower allow( + base::MessageLoop::current()); + base::MessageLoop::current()->RunUntilIdle(); } within_callback_ = true; TestCompletionCallback next_job_callback; @@ -1491,8 +1492,8 @@ class RequestSocketCallback : public TestCompletionCallbackBase { // operations that happen on timers (e.g. cleanup of idle // connections) can execute. { - MessageLoop::ScopedNestableTaskAllower allow( - MessageLoop::current()); + base::MessageLoop::ScopedNestableTaskAllower allow( + base::MessageLoop::current()); base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); EXPECT_EQ(OK, next_job_callback.WaitForResult()); } @@ -1664,7 +1665,8 @@ TEST_F(ClientSocketPoolBaseTest, GroupWithPendingRequestsIsNotEmpty) { EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); pool_->CloseIdleSockets(); - MessageLoop::current()->RunUntilIdle(); // Run the released socket wakeups + // Run the released socket wakeups. + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(ClientSocketPoolBaseTest, BasicAsynchronous) { @@ -1849,7 +1851,8 @@ TEST_F(ClientSocketPoolBaseTest, ReleaseSockets) { // Both Requests 2 and 3 are pending. We release socket 1 which should // service request 2. Request 3 should still be waiting. req1.handle()->Reset(); - MessageLoop::current()->RunUntilIdle(); // Run the released socket wakeups + // Run the released socket wakeups. + base::MessageLoop::current()->RunUntilIdle(); ASSERT_TRUE(req2.handle()->socket()); EXPECT_EQ(OK, req2.WaitForResult()); EXPECT_FALSE(req3.handle()->socket()); @@ -1931,7 +1934,7 @@ TEST_F(ClientSocketPoolBaseTest, LoadState) { EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(LOAD_STATE_IDLE, handle.GetLoadState()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ClientSocketHandle handle2; TestCompletionCallback callback2; @@ -2124,7 +2127,7 @@ TEST_F(ClientSocketPoolBaseTest, DisableCleanupTimerNoReuse) { // to flush all tasks, we need to wait so that we know there are no // soon-to-be-pending tasks waiting. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Both sockets should now be idle. ASSERT_EQ(2, pool_->IdleSocketCount()); @@ -2202,7 +2205,7 @@ TEST_F(ClientSocketPoolBaseTest, CleanupTimedOutIdleSockets) { // to flush all tasks, we need to wait so that we know there are no // soon-to-be-pending tasks waiting. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_EQ(2, pool_->IdleSocketCount()); @@ -2354,7 +2357,7 @@ TEST_F(ClientSocketPoolBaseTest, SocketLimitReleasingSockets) { handle_a[0].Reset(); // Used to get stuck here. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); handle_b[1].socket()->Disconnect(); handle_b[1].Reset(); @@ -2510,7 +2513,7 @@ TEST_F(ClientSocketPoolBaseTest, DoNotReuseSocketAfterFlush) { pool_->FlushWithError(ERR_NETWORK_CHANGED); handle.Reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, @@ -2620,7 +2623,7 @@ TEST_F(ClientSocketPoolBaseTest, BackupSocketCancelAtMaxSockets) { BoundNetLog())); } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Cancel the pending request. handle.Reset(); @@ -2629,7 +2632,7 @@ TEST_F(ClientSocketPoolBaseTest, BackupSocketCancelAtMaxSockets) { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kDefaultMaxSockets, client_socket_factory_.allocation_count()); } @@ -2658,7 +2661,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelBackupSocketAfterCancelingAllRequests) { // Wait for the backup timer to fire (add some slop to ensure it fires) base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_TRUE(pool_->HasGroup("bar")); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("bar")); } @@ -2697,7 +2700,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelBackupSocketAfterFinishingAllRequests) { // Wait for the backup timer to fire (add some slop to ensure it fires) base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test delayed socket binding for the case where we have two connects, @@ -2741,7 +2744,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingWaitingForConnect) { // binding. handle1.Reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Still no idle sockets, still one pending connect job. EXPECT_EQ(0, pool_->IdleSocketCount()); @@ -2757,7 +2760,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingWaitingForConnect) { client_socket_factory_.SignalJobs(); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test delayed socket binding when a group is at capacity and one @@ -2799,7 +2802,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtGroupCapacity) { // binding. handle1.Reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Still no idle sockets, still one pending connect job. EXPECT_EQ(0, pool_->IdleSocketCount()); @@ -2815,7 +2818,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtGroupCapacity) { client_socket_factory_.SignalJobs(); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Test out the case where we have one socket connected, one @@ -2859,7 +2862,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtStall) { // binding. handle1.Reset(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Still no idle sockets, still one pending connect job. EXPECT_EQ(0, pool_->IdleSocketCount()); @@ -2875,7 +2878,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtStall) { client_socket_factory_.SignalJobs(); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Cover the case where on an available socket slot, we have one pending @@ -3516,9 +3519,11 @@ TEST_F(ClientSocketPoolBaseTest, PreconnectWithoutBackupJob) { // the backup job a pending job instead of a waiting job, so it // *would* complete if it were created. connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); - MessageLoop::current()->PostDelayedTask( - FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::MessageLoop::QuitClosure(), + base::TimeDelta::FromSeconds(1)); + base::MessageLoop::current()->Run(); EXPECT_FALSE(pool_->HasGroup("a")); } @@ -3532,7 +3537,7 @@ TEST_F(ClientSocketPoolBaseTest, PreconnectWithBackupJob) { EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Make the backup job be a pending job, so it completes normally. connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); diff --git a/net/socket/deterministic_socket_data_unittest.cc b/net/socket/deterministic_socket_data_unittest.cc index aea8160..d0f568a 100644 --- a/net/socket/deterministic_socket_data_unittest.cc +++ b/net/socket/deterministic_socket_data_unittest.cc @@ -82,7 +82,7 @@ DeterministicSocketDataTest::DeterministicSocketDataTest() void DeterministicSocketDataTest::TearDown() { // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); PlatformTest::TearDown(); } diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index aa92856..a1e4d7c 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -325,7 +325,7 @@ MockWriteResult DelayedSocketData::OnWrite(const std::string& data) { MockWriteResult rv = StaticSocketDataProvider::OnWrite(data); // Now that our write has completed, we can allow reads to continue. if (!--write_delay_ && read_in_progress_) - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&DelayedSocketData::CompleteRead, weak_factory_.GetWeakPtr()), @@ -416,7 +416,7 @@ MockWriteResult OrderedSocketData::OnWrite(const std::string& data) { // DoSendRequest() will return ERR_IO_PENDING, and there's a race. If the // SYN_REPLY causes OnResponseReceived() to get called before // SpdyStream::ReadResponseHeaders() is called, we hit a NOTREACHED(). - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&OrderedSocketData::CompleteRead, weak_factory_.GetWeakPtr()), @@ -776,9 +776,12 @@ MockClientSocket::~MockClientSocket() {} void MockClientSocket::RunCallbackAsync(const CompletionCallback& callback, int result) { - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&MockClientSocket::RunCallback, weak_factory_.GetWeakPtr(), - callback, result)); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&MockClientSocket::RunCallback, + weak_factory_.GetWeakPtr(), + callback, + result)); } void MockClientSocket::RunCallback(const net::CompletionCallback& callback, @@ -1561,10 +1564,12 @@ int MockUDPClientSocket::CompleteRead() { void MockUDPClientSocket::RunCallbackAsync(const CompletionCallback& callback, int result) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(&MockUDPClientSocket::RunCallback, weak_factory_.GetWeakPtr(), - callback, result)); + base::Bind(&MockUDPClientSocket::RunCallback, + weak_factory_.GetWeakPtr(), + callback, + result)); } void MockUDPClientSocket::RunCallback(const CompletionCallback& callback, diff --git a/net/socket/socks_client_socket_pool_unittest.cc b/net/socket/socks_client_socket_pool_unittest.cc index e5ee172..93a2c24 100644 --- a/net/socket/socks_client_socket_pool_unittest.cc +++ b/net/socket/socks_client_socket_pool_unittest.cc @@ -242,7 +242,7 @@ TEST_F(SOCKSClientSocketPoolTest, CancelDuringTransportConnect) { EXPECT_EQ(0, transport_socket_pool_.cancel_count()); // Now wait for the TCP sockets to connect. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ClientSocketPoolTest::kRequestNotFound, GetOrderOfRequest(1)); EXPECT_EQ(ClientSocketPoolTest::kRequestNotFound, GetOrderOfRequest(2)); @@ -278,7 +278,7 @@ TEST_F(SOCKSClientSocketPoolTest, CancelDuringSOCKSConnect) { EXPECT_EQ(0, transport_socket_pool_.release_count()); // Now wait for the async data to reach the SOCKS connect jobs. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ClientSocketPoolTest::kRequestNotFound, GetOrderOfRequest(1)); EXPECT_EQ(ClientSocketPoolTest::kRequestNotFound, GetOrderOfRequest(2)); diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index 6ad447d..653530c 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc @@ -78,13 +78,13 @@ class FakeDataChannel { return net::ERR_CONNECTION_RESET; write_called_after_close_ = true; write_callback_ = callback; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&FakeDataChannel::DoWriteCallback, weak_factory_.GetWeakPtr())); return net::ERR_IO_PENDING; } data_.push(new net::DrainableIOBuffer(buf, buf_len)); - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&FakeDataChannel::DoReadCallback, weak_factory_.GetWeakPtr())); return buf_len; @@ -523,10 +523,10 @@ TEST_F(SSLServerSocketTest, ClientWriteAfterServerClose) { client_ret = write_callback.GetResult(client_ret); EXPECT_GT(client_ret, 0); - MessageLoop::current()->PostDelayedTask( - FROM_HERE, MessageLoop::QuitClosure(), + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, base::MessageLoop::QuitClosure(), base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } // This test executes ExportKeyingMaterial() on the client and server sockets, diff --git a/net/socket/stream_listen_socket.cc b/net/socket/stream_listen_socket.cc index ade07db..add72d6 100644 --- a/net/socket/stream_listen_socket.cc +++ b/net/socket/stream_listen_socket.cc @@ -212,8 +212,8 @@ void StreamListenSocket::WatchSocket(WaitState state) { watcher_.StartWatching(socket_event_, this); #elif defined(OS_POSIX) // Implicitly calls StartWatchingFileDescriptor(). - MessageLoopForIO::current()->WatchFileDescriptor( - socket_, true, MessageLoopForIO::WATCH_READ, &watcher_, this); + base::MessageLoopForIO::current()->WatchFileDescriptor( + socket_, true, base::MessageLoopForIO::WATCH_READ, &watcher_, this); wait_state_ = state; #endif } diff --git a/net/socket/stream_listen_socket.h b/net/socket/stream_listen_socket.h index 726d2ff..e795599 100644 --- a/net/socket/stream_listen_socket.h +++ b/net/socket/stream_listen_socket.h @@ -48,7 +48,7 @@ class NET_EXPORT StreamListenSocket #if defined(OS_WIN) public base::win::ObjectWatcher::Delegate { #elif defined(OS_POSIX) - public MessageLoopForIO::Watcher { + public base::MessageLoopForIO::Watcher { #endif public: @@ -123,7 +123,7 @@ class NET_EXPORT StreamListenSocket virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; WaitState wait_state_; // The socket's libevent wrapper. - MessageLoopForIO::FileDescriptorWatcher watcher_; + base::MessageLoopForIO::FileDescriptorWatcher watcher_; #endif // NOTE: This is for unit test use only! diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index fabe8aa..d2a74d3 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -321,9 +321,9 @@ int TCPClientSocketLibevent::DoConnect() { // Otherwise the connect() is going to complete asynchronously, so watch // for its completion. - if (!MessageLoopForIO::current()->WatchFileDescriptor( - socket_, true, MessageLoopForIO::WATCH_WRITE, &write_socket_watcher_, - &write_watcher_)) { + if (!base::MessageLoopForIO::current()->WatchFileDescriptor( + socket_, true, base::MessageLoopForIO::WATCH_WRITE, + &write_socket_watcher_, &write_watcher_)) { connect_os_error_ = errno; DVLOG(1) << "WatchFileDescriptor failed: " << connect_os_error_; return MapSystemError(connect_os_error_); @@ -461,8 +461,8 @@ int TCPClientSocketLibevent::Read(IOBuffer* buf, return net_error; } - if (!MessageLoopForIO::current()->WatchFileDescriptor( - socket_, true, MessageLoopForIO::WATCH_READ, + if (!base::MessageLoopForIO::current()->WatchFileDescriptor( + socket_, true, base::MessageLoopForIO::WATCH_READ, &read_socket_watcher_, &read_watcher_)) { DVLOG(1) << "WatchFileDescriptor failed on read, errno " << errno; return MapSystemError(errno); @@ -502,8 +502,8 @@ int TCPClientSocketLibevent::Write(IOBuffer* buf, return net_error; } - if (!MessageLoopForIO::current()->WatchFileDescriptor( - socket_, true, MessageLoopForIO::WATCH_WRITE, + if (!base::MessageLoopForIO::current()->WatchFileDescriptor( + socket_, true, base::MessageLoopForIO::WATCH_WRITE, &write_socket_watcher_, &write_watcher_)) { DVLOG(1) << "WatchFileDescriptor failed on write, errno " << errno; return MapSystemError(errno); diff --git a/net/socket/tcp_client_socket_libevent.h b/net/socket/tcp_client_socket_libevent.h index 820a1f8..6c35f4d 100644 --- a/net/socket/tcp_client_socket_libevent.h +++ b/net/socket/tcp_client_socket_libevent.h @@ -129,7 +129,7 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, FAST_OPEN_MAX_VALUE }; - class ReadWatcher : public MessageLoopForIO::Watcher { + class ReadWatcher : public base::MessageLoopForIO::Watcher { public: explicit ReadWatcher(TCPClientSocketLibevent* socket) : socket_(socket) {} @@ -145,7 +145,7 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, DISALLOW_COPY_AND_ASSIGN(ReadWatcher); }; - class WriteWatcher : public MessageLoopForIO::Watcher { + class WriteWatcher : public base::MessageLoopForIO::Watcher { public: explicit WriteWatcher(TCPClientSocketLibevent* socket) : socket_(socket) {} @@ -204,8 +204,8 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, int current_address_index_; // The socket's libevent wrappers - MessageLoopForIO::FileDescriptorWatcher read_socket_watcher_; - MessageLoopForIO::FileDescriptorWatcher write_socket_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher read_socket_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher write_socket_watcher_; // The corresponding watchers for reads and writes. ReadWatcher read_watcher_; diff --git a/net/socket/tcp_listen_socket_unittest.cc b/net/socket/tcp_listen_socket_unittest.cc index c862d33..a4edd21 100644 --- a/net/socket/tcp_listen_socket_unittest.cc +++ b/net/socket/tcp_listen_socket_unittest.cc @@ -33,10 +33,10 @@ TCPListenSocketTester::TCPListenSocketTester() void TCPListenSocketTester::SetUp() { base::Thread::Options options; - options.message_loop_type = MessageLoop::TYPE_IO; + options.message_loop_type = base::MessageLoop::TYPE_IO; thread_.reset(new base::Thread("socketio_test")); thread_->StartWithOptions(options); - loop_ = reinterpret_cast<MessageLoopForIO*>(thread_->message_loop()); + loop_ = reinterpret_cast<base::MessageLoopForIO*>(thread_->message_loop()); loop_->PostTask(FROM_HERE, base::Bind( &TCPListenSocketTester::Listen, this)); diff --git a/net/socket/tcp_listen_socket_unittest.h b/net/socket/tcp_listen_socket_unittest.h index 59c299a..cef8bde 100644 --- a/net/socket/tcp_listen_socket_unittest.h +++ b/net/socket/tcp_listen_socket_unittest.h @@ -97,7 +97,7 @@ class TCPListenSocketTester : virtual void DidClose(StreamListenSocket* sock) OVERRIDE; scoped_ptr<base::Thread> thread_; - MessageLoopForIO* loop_; + base::MessageLoopForIO* loop_; scoped_refptr<TCPListenSocket> server_; StreamListenSocket* connection_; TCPListenSocketTestAction last_action_; diff --git a/net/socket/tcp_server_socket_libevent.cc b/net/socket/tcp_server_socket_libevent.cc index 589fd11..c46463c 100644 --- a/net/socket/tcp_server_socket_libevent.cc +++ b/net/socket/tcp_server_socket_libevent.cc @@ -123,8 +123,8 @@ int TCPServerSocketLibevent::Accept( int result = AcceptInternal(socket); if (result == ERR_IO_PENDING) { - if (!MessageLoopForIO::current()->WatchFileDescriptor( - socket_, true, MessageLoopForIO::WATCH_READ, + if (!base::MessageLoopForIO::current()->WatchFileDescriptor( + socket_, true, base::MessageLoopForIO::WATCH_READ, &accept_socket_watcher_, this)) { PLOG(ERROR) << "WatchFileDescriptor failed on read"; return MapSystemError(errno); diff --git a/net/socket/tcp_server_socket_libevent.h b/net/socket/tcp_server_socket_libevent.h index 3b8d71e..7fb2447 100644 --- a/net/socket/tcp_server_socket_libevent.h +++ b/net/socket/tcp_server_socket_libevent.h @@ -16,10 +16,10 @@ namespace net { class IPEndPoint; -class NET_EXPORT_PRIVATE TCPServerSocketLibevent - : public ServerSocket, - public base::NonThreadSafe, - public MessageLoopForIO::Watcher { +class NET_EXPORT_PRIVATE TCPServerSocketLibevent : + public ServerSocket, + public base::NonThreadSafe, + public base::MessageLoopForIO::Watcher { public: TCPServerSocketLibevent(net::NetLog* net_log, const net::NetLog::Source& source); @@ -43,7 +43,7 @@ class NET_EXPORT_PRIVATE TCPServerSocketLibevent int socket_; - MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_; scoped_ptr<StreamSocket>* accept_socket_; CompletionCallback accept_callback_; diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index ee9d54c..93ad63e 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc @@ -238,7 +238,7 @@ class MockPendingClientSocket : public StreamSocket { // StreamSocket implementation. virtual int Connect(const CompletionCallback& callback) OVERRIDE { - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&MockPendingClientSocket::DoCallback, weak_factory_.GetWeakPtr(), callback), @@ -848,8 +848,9 @@ class RequestSocketCallback : public TestCompletionCallbackBase { handle_->socket()->Disconnect(); handle_->Reset(); { - MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::ScopedNestableTaskAllower allow( + base::MessageLoop::current()); + base::MessageLoop::current()->RunUntilIdle(); } within_callback_ = true; scoped_refptr<TransportSocketParams> dest(new TransportSocketParams( @@ -951,7 +952,7 @@ TEST_F(TransportClientSocketPoolTest, IdleSocketLoadTiming) { handle.Reset(); // Need to run all pending to release the socket back to the pool. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now we should have 1 idle socket. EXPECT_EQ(1, pool_.IdleSocketCount()); @@ -979,14 +980,14 @@ TEST_F(TransportClientSocketPoolTest, ResetIdleSocketsOnIPAddressChange) { handle.Reset(); // Need to run all pending to release the socket back to the pool. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now we should have 1 idle socket. EXPECT_EQ(1, pool_.IdleSocketCount()); // After an IP address change, we should have 0 idle sockets. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); // Notification happens async. + base::MessageLoop::current()->RunUntilIdle(); // Notification happens async. EXPECT_EQ(0, pool_.IdleSocketCount()); } @@ -1029,14 +1030,14 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketConnect) { EXPECT_FALSE(handle.socket()); // Create the first socket, set the timer. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Wait for the backup socket timer to fire. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( ClientSocketPool::kMaxConnectRetryIntervalMs + 50)); // Let the appropriate socket connect. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(OK, callback.WaitForResult()); EXPECT_TRUE(handle.is_initialized()); @@ -1071,7 +1072,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) { EXPECT_FALSE(handle.socket()); // Create the first socket, set the timer. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); if (index == CANCEL_AFTER_WAIT) { // Wait for the backup socket timer to fire. @@ -1080,7 +1081,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) { } // Let the appropriate socket connect. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); handle.Reset(); @@ -1117,7 +1118,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterStall) { EXPECT_FALSE(handle.socket()); // Create the first socket, set the timer. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Wait for the backup socket timer to fire. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( @@ -1128,7 +1129,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterStall) { host_resolver_->set_synchronous_mode(true); // Let the appropriate socket connect. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult()); EXPECT_FALSE(handle.is_initialized()); @@ -1165,7 +1166,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterDelay) { EXPECT_FALSE(handle.socket()); // Create the first socket, set the timer. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Wait for the backup socket timer to fire. base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( @@ -1176,7 +1177,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterDelay) { host_resolver_->set_synchronous_mode(true); // Let the appropriate socket connect. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult()); EXPECT_FALSE(handle.is_initialized()); diff --git a/net/socket/unix_domain_socket_posix_unittest.cc b/net/socket/unix_domain_socket_posix_unittest.cc index 9cbaf9a..ed0b018 100644 --- a/net/socket/unix_domain_socket_posix_unittest.cc +++ b/net/socket/unix_domain_socket_posix_unittest.cc @@ -202,7 +202,7 @@ class UnixDomainSocketTestHelper : public testing::Test { scoped_ptr<base::Thread> CreateAndRunServerThread() { base::Thread::Options options; - options.message_loop_type = MessageLoop::TYPE_IO; + options.message_loop_type = base::MessageLoop::TYPE_IO; scoped_ptr<base::Thread> thread(new base::Thread("socketio_test")); thread->StartWithOptions(options); thread->message_loop()->PostTask( diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 98c4166..b430ea6 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -110,10 +110,10 @@ SocketStream::SocketStream(const GURL& url, Delegate* delegate) closing_(false), server_closed_(false), metrics_(new SocketStreamMetrics(url)) { - DCHECK(MessageLoop::current()) << - "The current MessageLoop must exist"; - DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << - "The current MessageLoop must be TYPE_IO"; + DCHECK(base::MessageLoop::current()) + << "The current base::MessageLoop must exist"; + DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + << "The current base::MessageLoop must be TYPE_IO"; DCHECK(delegate_); } @@ -175,10 +175,10 @@ void SocketStream::CheckPrivacyMode() { } void SocketStream::Connect() { - DCHECK(MessageLoop::current()) << - "The current MessageLoop must exist"; - DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << - "The current MessageLoop must be TYPE_IO"; + DCHECK(base::MessageLoop::current()) + << "The current base::MessageLoop must exist"; + DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + << "The current base::MessageLoop must be TYPE_IO"; if (context_) { ssl_config_service()->GetSSLConfig(&server_ssl_config_); proxy_ssl_config_ = server_ssl_config_; @@ -194,9 +194,8 @@ void SocketStream::Connect() { net_log_.BeginEvent( NetLog::TYPE_SOCKET_STREAM_CONNECT, NetLog::StringCallback("url", &url_.possibly_invalid_spec())); - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&SocketStream::DoLoop, this, OK)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&SocketStream::DoLoop, this, OK)); } size_t SocketStream::GetTotalSizeOfPendingWriteBufs() const { @@ -209,10 +208,10 @@ size_t SocketStream::GetTotalSizeOfPendingWriteBufs() const { } bool SocketStream::SendData(const char* data, int len) { - DCHECK(MessageLoop::current()) << - "The current MessageLoop must exist"; - DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << - "The current MessageLoop must be TYPE_IO"; + DCHECK(base::MessageLoop::current()) + << "The current base::MessageLoop must exist"; + DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + << "The current base::MessageLoop must be TYPE_IO"; DCHECK_GT(len, 0); if (!socket_.get() || !socket_->IsConnected() || next_state_ == STATE_NONE) @@ -246,35 +245,33 @@ bool SocketStream::SendData(const char* data, int len) { if (!current_write_buf_) { // Send pending data asynchronously, so that delegate won't be called // back before returning from SendData(). - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&SocketStream::DoLoop, this, OK)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&SocketStream::DoLoop, this, OK)); } return true; } void SocketStream::Close() { - DCHECK(MessageLoop::current()) << - "The current MessageLoop must exist"; - DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << - "The current MessageLoop must be TYPE_IO"; + DCHECK(base::MessageLoop::current()) + << "The current base::MessageLoop must exist"; + DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + << "The current base::MessageLoop must be TYPE_IO"; // If next_state_ is STATE_NONE, the socket was not opened, or already // closed. So, return immediately. // Otherwise, it might call Finish() more than once, so breaks balance // of AddRef() and Release() in Connect() and Finish(), respectively. if (next_state_ == STATE_NONE) return; - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&SocketStream::DoClose, this)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&SocketStream::DoClose, this)); } void SocketStream::RestartWithAuth(const AuthCredentials& credentials) { - DCHECK(MessageLoop::current()) << - "The current MessageLoop must exist"; - DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << - "The current MessageLoop must be TYPE_IO"; + DCHECK(base::MessageLoop::current()) + << "The current base::MessageLoop must exist"; + DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + << "The current base::MessageLoop must be TYPE_IO"; DCHECK(proxy_auth_controller_.get()); if (!socket_.get()) { LOG(ERROR) << "Socket is closed before restarting with auth."; @@ -283,9 +280,8 @@ void SocketStream::RestartWithAuth(const AuthCredentials& credentials) { proxy_auth_controller_->ResetAuth(credentials); - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&SocketStream::DoRestartWithAuth, this)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&SocketStream::DoRestartWithAuth, this)); } void SocketStream::DetachDelegate() { @@ -309,9 +305,8 @@ void SocketStream::SetClientSocketFactory( } void SocketStream::CancelWithError(int error) { - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&SocketStream::DoLoop, this, error)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&SocketStream::DoLoop, this, error)); } void SocketStream::CancelWithSSLError(const SSLInfo& ssl_info) { @@ -319,9 +314,8 @@ void SocketStream::CancelWithSSLError(const SSLInfo& ssl_info) { } void SocketStream::ContinueDespiteError() { - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&SocketStream::DoLoop, this, OK)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&SocketStream::DoLoop, this, OK)); } SocketStream::~SocketStream() { @@ -358,10 +352,10 @@ void SocketStream::DoClose() { } void SocketStream::Finish(int result) { - DCHECK(MessageLoop::current()) << - "The current MessageLoop must exist"; - DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << - "The current MessageLoop must be TYPE_IO"; + DCHECK(base::MessageLoop::current()) + << "The current base::MessageLoop must exist"; + DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + << "The current base::MessageLoop must be TYPE_IO"; DCHECK_LE(result, OK); if (result == OK) result = ERR_CONNECTION_CLOSED; @@ -935,16 +929,14 @@ int SocketStream::DoReadTunnelHeadersComplete(int result) { DCHECK(!proxy_info_.is_empty()); next_state_ = STATE_AUTH_REQUIRED; if (proxy_auth_controller_->HaveAuth()) { - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&SocketStream::DoRestartWithAuth, this)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&SocketStream::DoRestartWithAuth, this)); return ERR_IO_PENDING; } if (delegate_) { // Wait until RestartWithAuth or Close is called. - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&SocketStream::DoAuthRequired, this)); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&SocketStream::DoAuthRequired, this)); return ERR_IO_PENDING; } break; diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc index 0545773..aa4ea9a 100644 --- a/net/spdy/spdy_http_stream.cc +++ b/net/spdy/spdy_http_stream.cc @@ -477,7 +477,7 @@ void SpdyHttpStream::ScheduleBufferedReadCallback() { more_read_data_pending_ = false; buffered_read_callback_pending_ = true; const base::TimeDelta kBufferTime = base::TimeDelta::FromMilliseconds(1); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(base::IgnoreResult(&SpdyHttpStream::DoBufferedReadCallback), weak_factory_.GetWeakPtr()), diff --git a/net/spdy/spdy_http_stream_spdy2_unittest.cc b/net/spdy/spdy_http_stream_spdy2_unittest.cc index 07836f1..74aedae 100644 --- a/net/spdy/spdy_http_stream_spdy2_unittest.cc +++ b/net/spdy/spdy_http_stream_spdy2_unittest.cc @@ -74,7 +74,7 @@ class SpdyHttpStreamSpdy2Test : public testing::Test { protected: virtual void TearDown() OVERRIDE { crypto::ECSignatureCreator::SetFactoryForTesting(NULL); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Initializes the session using DeterministicSocketData. It's advisable @@ -357,7 +357,7 @@ TEST_F(SpdyHttpStreamSpdy2Test, SendChunkedPost) { // This triggers reading the body and the EOF, causing the session to shut // down. data()->CompleteRead(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Because we abandoned the stream, we don't expect to find a session in the // pool anymore. diff --git a/net/spdy/spdy_http_stream_spdy3_unittest.cc b/net/spdy/spdy_http_stream_spdy3_unittest.cc index c08e133..026c575 100644 --- a/net/spdy/spdy_http_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_http_stream_spdy3_unittest.cc @@ -80,7 +80,7 @@ class SpdyHttpStreamSpdy3Test : public testing::Test { protected: virtual void TearDown() OVERRIDE { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Initializes the session using DeterministicSocketData. It's advisable @@ -392,7 +392,7 @@ void SpdyHttpStreamSpdy3Test::RunSendChunkedPostTest( // This triggers reading the body and the EOF, causing the session to shut // down. data()->CompleteRead(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Because we abandoned the stream, we don't expect to find a session in the // pool anymore. diff --git a/net/spdy/spdy_network_transaction_spdy2_unittest.cc b/net/spdy/spdy_network_transaction_spdy2_unittest.cc index f11c207..54e7a39 100644 --- a/net/spdy/spdy_network_transaction_spdy2_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy2_unittest.cc @@ -73,7 +73,7 @@ class SpdyNetworkTransactionSpdy2Test virtual void TearDown() { // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } struct TransactionHelperResult { @@ -496,7 +496,7 @@ class SpdyNetworkTransactionSpdy2Test // reads until we complete our callback. while (!callback.have_result()) { data->CompleteRead(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } rv = callback.WaitForResult(); } else if (rv <= 0) { @@ -551,7 +551,7 @@ class SpdyNetworkTransactionSpdy2Test rv = trans2->Start( &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The data for the pushed path may be coming in more than 1 frame. Compile // the results into a single string. @@ -1832,10 +1832,10 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DelayedChunkedPost) { helper.AddData(&data); ASSERT_TRUE(helper.StartDefaultTest()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); helper.request().upload_data_stream->AppendChunk( kUploadData, kUploadDataSize, false); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); helper.request().upload_data_stream->AppendChunk( kUploadData, kUploadDataSize, true); @@ -2189,7 +2189,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CancelledTransaction) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); helper.VerifyDataNotConsumed(); } @@ -2343,7 +2343,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DeleteSessionOnReadCallback) { data.CompleteRead(); // Finish running rest of tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); helper.VerifyDataConsumed(); } @@ -2431,12 +2431,12 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectGetRequest) { d.set_quit_on_redirect(true); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.received_redirect_count()); r.FollowDeferredRedirect(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status()); @@ -2676,7 +2676,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectServerPush) { AddSocketDataProvider(&data); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, d.received_redirect_count()); std::string contents("hello!"); @@ -2689,11 +2689,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectServerPush) { d2.set_quit_on_redirect(true); r2.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d2.received_redirect_count()); r2.FollowDeferredRedirect(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d2.response_started_count()); EXPECT_FALSE(d2.received_data_before_response()); EXPECT_EQ(net::URLRequestStatus::SUCCESS, r2.status().status()); @@ -3876,7 +3876,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferFull) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -3973,7 +3973,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Buffering) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -4066,7 +4066,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedAll) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -4161,7 +4161,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedClosed) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -4232,7 +4232,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedCancelled) { // Flush the MessageLoop; this will cause the buffered IO task // to run for the final time. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -4855,7 +4855,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, VerifyRetryOnConnectionReset) { if (variant == VARIANT_RST_DURING_READ_COMPLETION) { // Writes to the socket complete asynchronously on SPDY by running // through the message loop. Complete the write here. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Now schedule the ERR_CONNECTION_RESET. @@ -5191,7 +5191,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushClaimBeforeHeaders) { &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); data.RunFor(3); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Read the server push body. std::string result2; @@ -5341,7 +5341,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushWithTwoHeaderFrames) { &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); data.RunFor(3); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Read the server push body. std::string result2; @@ -5478,7 +5478,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushWithNoStatusHeaderFrames) { &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); data.RunFor(2); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Read the server push body. std::string result2; @@ -5903,7 +5903,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, OutOfOrderSynStream) { // Run the message loop, but do not allow the write to complete. // This leaves the SpdySession with a write pending, which prevents // SpdySession from attempting subsequent writes until this write completes. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now, start both new transactions HttpRequestInfo info2 = CreateGetRequest(); @@ -5912,7 +5912,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, OutOfOrderSynStream) { new HttpNetworkTransaction(MEDIUM, helper.session())); rv = trans2->Start(&info2, callback2.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); HttpRequestInfo info3 = CreateGetRequest(); TestCompletionCallback callback3; @@ -5920,7 +5920,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, OutOfOrderSynStream) { new HttpNetworkTransaction(HIGHEST, helper.session())); rv = trans3->Start(&info3, callback3.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now have two SYN_STREAM frames queued up which will be // dequeued only once the first write completes, which we diff --git a/net/spdy/spdy_network_transaction_spdy3_unittest.cc b/net/spdy/spdy_network_transaction_spdy3_unittest.cc index 2be9b33..12fe22f 100644 --- a/net/spdy/spdy_network_transaction_spdy3_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy3_unittest.cc @@ -73,7 +73,7 @@ class SpdyNetworkTransactionSpdy3Test virtual void TearDown() { // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } struct TransactionHelperResult { @@ -498,7 +498,7 @@ class SpdyNetworkTransactionSpdy3Test // reads until we complete our callback. while (!callback.have_result()) { data->CompleteRead(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } rv = callback.WaitForResult(); } else if (rv <= 0) { @@ -553,7 +553,7 @@ class SpdyNetworkTransactionSpdy3Test rv = trans2->Start( &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The data for the pushed path may be coming in more than 1 packet. Compile // the results into a single string. @@ -1838,10 +1838,10 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DelayedChunkedPost) { helper.AddData(&data); ASSERT_TRUE(helper.StartDefaultTest()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); helper.request().upload_data_stream->AppendChunk( kUploadData, kUploadDataSize, false); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); helper.request().upload_data_stream->AppendChunk( kUploadData, kUploadDataSize, true); @@ -2270,7 +2270,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateSent) { // Force write of WINDOW_UPDATE which was scheduled during the above // read. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Read EOF. data.CompleteRead(); @@ -2436,7 +2436,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResume) { int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); // Write as much as we can. + base::MessageLoop::current()->RunUntilIdle(); // Write as much as we can. SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); ASSERT_TRUE(stream != NULL); @@ -2537,7 +2537,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResumeAfterSettings) { int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); // Write as much as we can. + base::MessageLoop::current()->RunUntilIdle(); // Write as much as we can. SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); ASSERT_TRUE(stream != NULL); @@ -2647,7 +2647,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlNegativeSendWindowSize) { int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); // Write as much as we can. + base::MessageLoop::current()->RunUntilIdle(); // Write as much as we can. SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); ASSERT_TRUE(stream != NULL); @@ -2775,7 +2775,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CancelledTransaction) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); helper.VerifyDataNotConsumed(); } @@ -2929,7 +2929,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DeleteSessionOnReadCallback) { data.CompleteRead(); // Finish running rest of tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); helper.VerifyDataConsumed(); } @@ -3017,11 +3017,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectGetRequest) { d.set_quit_on_redirect(true); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.received_redirect_count()); r.FollowDeferredRedirect(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status()); @@ -3264,7 +3264,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectServerPush) { AddSocketDataProvider(&data); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, d.received_redirect_count()); std::string contents("hello!"); @@ -3277,11 +3277,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectServerPush) { d2.set_quit_on_redirect(true); r2.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d2.received_redirect_count()); r2.FollowDeferredRedirect(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d2.response_started_count()); EXPECT_FALSE(d2.received_data_before_response()); EXPECT_EQ(net::URLRequestStatus::SUCCESS, r2.status().status()); @@ -4466,7 +4466,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferFull) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -4563,7 +4563,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Buffering) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -4656,7 +4656,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedAll) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -4751,7 +4751,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedClosed) { // Flush the MessageLoop while the SpdySessionDependencies (in particular, the // MockClientSocketFactory) are still alive. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -4822,7 +4822,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedCancelled) { // Flush the MessageLoop; this will cause the buffered IO task // to run for the final time. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Verify that we consumed all test data. helper.VerifyDataConsumed(); @@ -5447,7 +5447,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, VerifyRetryOnConnectionReset) { if (variant == VARIANT_RST_DURING_READ_COMPLETION) { // Writes to the socket complete asynchronously on SPDY by running // through the message loop. Complete the write here. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Now schedule the ERR_CONNECTION_RESET. @@ -5785,7 +5785,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushClaimBeforeHeaders) { &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); data.RunFor(3); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Read the server push body. std::string result2; @@ -5936,7 +5936,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushWithTwoHeaderFrames) { &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); data.RunFor(3); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Read the server push body. std::string result2; @@ -6077,7 +6077,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushWithNoStatusHeaderFrames) { &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); data.RunFor(2); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Read the server push body. std::string result2; @@ -6502,7 +6502,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, OutOfOrderSynStream) { // Run the message loop, but do not allow the write to complete. // This leaves the SpdySession with a write pending, which prevents // SpdySession from attempting subsequent writes until this write completes. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now, start both new transactions HttpRequestInfo info2 = CreateGetRequest(); @@ -6511,7 +6511,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, OutOfOrderSynStream) { new HttpNetworkTransaction(MEDIUM, helper.session())); rv = trans2->Start(&info2, callback2.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); HttpRequestInfo info3 = CreateGetRequest(); TestCompletionCallback callback3; @@ -6519,7 +6519,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, OutOfOrderSynStream) { new HttpNetworkTransaction(HIGHEST, helper.session())); rv = trans3->Start(&info3, callback3.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now have two SYN_STREAM frames queued up which will be // dequeued only once the first write completes, which we diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc index 70426c3..7ef3f25 100644 --- a/net/spdy/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_unittest.cc @@ -169,7 +169,7 @@ void SpdyProxyClientSocketTest::TearDown() { session_->spdy_session_pool()->CloseAllSessions(); // Empty the current queue. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); PlatformTest::TearDown(); } diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 537c2b7..e7e9eab 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -642,7 +642,7 @@ void SpdySession::ProcessPendingStreamRequests() { DCHECK(!ContainsKey(pending_stream_request_completions_, pending_request)); pending_stream_request_completions_.insert(pending_request); - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SpdySession::CompleteStreamRequest, weak_factory_.GetWeakPtr(), pending_request)); @@ -1032,7 +1032,7 @@ int SpdySession::DoLoop(int result) { int SpdySession::DoRead() { if (bytes_read_ > kMaxReadBytes) { state_ = STATE_DO_READ; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SpdySession::StartRead, weak_factory_.GetWeakPtr())); @@ -1150,7 +1150,7 @@ void SpdySession::WriteSocketLater() { return; delayed_write_pending_ = true; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SpdySession::WriteSocket, weak_factory_.GetWeakPtr())); } @@ -2147,7 +2147,7 @@ void SpdySession::PlanToCheckPingStatus() { return; check_ping_status_pending_ = true; - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&SpdySession::CheckPingStatus, weak_factory_.GetWeakPtr(), base::TimeTicks::Now()), hung_interval_); @@ -2175,7 +2175,7 @@ void SpdySession::CheckPingStatus(base::TimeTicks last_check_time) { } // Check the status of connection after a delay. - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&SpdySession::CheckPingStatus, weak_factory_.GetWeakPtr(), now), diff --git a/net/spdy/spdy_session_spdy2_unittest.cc b/net/spdy/spdy_session_spdy2_unittest.cc index c179ac3..4e2437a 100644 --- a/net/spdy/spdy_session_spdy2_unittest.cc +++ b/net/spdy/spdy_session_spdy2_unittest.cc @@ -305,7 +305,7 @@ TEST_F(SpdySessionSpdy2Test, ServerPing) { spdy_stream1->SetDelegate(&delegate); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(spdy_session_pool_->HasSession(key_)); @@ -727,7 +727,7 @@ TEST_F(SpdySessionSpdy2Test, CancelPendingCreateStream) { callback.reset(); // Should not crash when running the pending callback. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(SpdySessionSpdy2Test, SendInitialSettingsOnNewSession) { @@ -763,7 +763,7 @@ TEST_F(SpdySessionSpdy2Test, SendInitialSettingsOnNewSession) { scoped_refptr<SpdySession> session = CreateInitializedSession(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(data.at_write_eof()); } @@ -808,7 +808,7 @@ TEST_F(SpdySessionSpdy2Test, SendSettingsOnNewSession) { scoped_refptr<SpdySession> session = CreateInitializedSession(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(data.at_write_eof()); } @@ -925,7 +925,7 @@ void IPPoolingTest(SpdyPoolCloseSessionsType close_sessions_type) { pool_peer.AddAlias(test_hosts[0].addresses.front(), test_hosts[0].key); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The third host has no overlap with the first, so it can't pool IPs. EXPECT_FALSE(spdy_session_pool->HasSession(test_hosts[2].key)); @@ -1097,7 +1097,7 @@ TEST_F(SpdySessionSpdy2Test, CloseSessionOnError) { InitializeSession(http_session_.get(), session.get(), test_host_port_pair_); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(spdy_session_pool_->HasSession(key_)); @@ -1189,7 +1189,7 @@ TEST_F(SpdySessionSpdy2Test, OutOfOrderSynStreams) { spdy_stream1->SendRequest(false); spdy_stream2->SendRequest(false); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(NULL, spdy_stream1.get()); EXPECT_EQ(NULL, spdy_stream2.get()); @@ -1600,7 +1600,7 @@ TEST_F(SpdySessionSpdy2Test, CloseTwoStalledCreateStream) { EXPECT_EQ(0u, delegate1.stream_id()); data.RunFor(3); // Pump loop for SpdySession::ProcessPendingStreamRequests(). - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(NULL, spdy_stream1.get()); EXPECT_EQ(1u, delegate1.stream_id()); EXPECT_EQ(2u, session->num_active_streams() + session->num_created_streams()); @@ -1768,7 +1768,7 @@ TEST_F(SpdySessionSpdy2Test, NeedsCredentials) { EXPECT_FALSE(session->NeedsCredentials()); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); spdy_session_pool_->Remove(session); } @@ -2351,7 +2351,7 @@ TEST_F(SpdySessionSpdy2Test, CloseOneIdleConnectionFailsWhenSessionInUse) { EXPECT_TRUE(spdy_stream1->HasUrl()); spdy_stream1->SendRequest(false); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Release the session, so holding onto a pointer here does not affect // anything. diff --git a/net/spdy/spdy_session_spdy3_unittest.cc b/net/spdy/spdy_session_spdy3_unittest.cc index 17c525f..8cf7e93 100644 --- a/net/spdy/spdy_session_spdy3_unittest.cc +++ b/net/spdy/spdy_session_spdy3_unittest.cc @@ -388,7 +388,7 @@ TEST_F(SpdySessionSpdy3Test, ServerPing) { spdy_stream1->SetDelegate(&delegate); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(spdy_session_pool_->HasSession(key_)); @@ -814,7 +814,7 @@ TEST_F(SpdySessionSpdy3Test, CancelPendingCreateStream) { callback.reset(); // Should not crash when running the pending callback. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(SpdySessionSpdy3Test, SendInitialSettingsOnNewSession) { @@ -855,7 +855,7 @@ TEST_F(SpdySessionSpdy3Test, SendInitialSettingsOnNewSession) { scoped_refptr<SpdySession> session = CreateInitializedSession(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(data.at_write_eof()); } @@ -900,7 +900,7 @@ TEST_F(SpdySessionSpdy3Test, SendSettingsOnNewSession) { scoped_refptr<SpdySession> session = CreateInitializedSession(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(data.at_write_eof()); } @@ -1017,7 +1017,7 @@ void IPPoolingTest(SpdyPoolCloseSessionsType close_sessions_type) { pool_peer.AddAlias(test_hosts[0].addresses.front(), test_hosts[0].key); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The third host has no overlap with the first, so it can't pool IPs. EXPECT_FALSE(spdy_session_pool->HasSession(test_hosts[2].key)); @@ -1192,7 +1192,7 @@ TEST_F(SpdySessionSpdy3Test, Initialize) { http_session_.get(), session.get(), test_host_port_pair_)); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); net::CapturingNetLog::CapturedEntryList entries; log.GetEntries(&entries); @@ -1242,7 +1242,7 @@ TEST_F(SpdySessionSpdy3Test, CloseSessionOnError) { http_session_.get(), session.get(), test_host_port_pair_)); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(spdy_session_pool_->HasSession(key_)); @@ -1327,7 +1327,7 @@ TEST_F(SpdySessionSpdy3Test, OutOfOrderSynStreams) { spdy_stream1->SendRequest(false); spdy_stream2->SendRequest(false); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(NULL, spdy_stream1.get()); EXPECT_EQ(NULL, spdy_stream2.get()); @@ -1716,7 +1716,7 @@ TEST_F(SpdySessionSpdy3Test, CloseTwoStalledCreateStream) { EXPECT_EQ(0u, delegate1.stream_id()); data.RunFor(3); // Pump loop for SpdySession::ProcessPendingStreamRequests(). - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(NULL, spdy_stream1.get()); EXPECT_EQ(1u, delegate1.stream_id()); EXPECT_EQ(2u, session->num_active_streams() + session->num_created_streams()); @@ -1882,7 +1882,7 @@ TEST_F(SpdySessionSpdy3Test, NeedsCredentials) { EXPECT_TRUE(session->NeedsCredentials()); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); spdy_session_pool_->Remove(session); } @@ -1947,7 +1947,7 @@ TEST_F(SpdySessionSpdy3Test, SendCredentials) { EXPECT_TRUE(session->NeedsCredentials()); // Flush the SpdySession::OnReadComplete() task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); spdy_session_pool_->Remove(session); EXPECT_FALSE(spdy_session_pool_->HasSession(key)); @@ -1991,7 +1991,7 @@ TEST_F(SpdySessionSpdy3Test, UpdateStreamsSendWindowSize) { EXPECT_NE(spdy_stream1->send_window_size(), window_size); data->RunFor(1); // Process the SETTINGS frame, but not the EOF - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(session->stream_initial_send_window_size(), window_size); EXPECT_EQ(spdy_stream1->send_window_size(), window_size); @@ -3666,7 +3666,7 @@ TEST_F(SpdySessionSpdy3Test, CloseOneIdleConnectionFailsWhenSessionInUse) { EXPECT_TRUE(spdy_stream1->HasUrl()); spdy_stream1->SendRequest(false); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Release the session, so holding onto a pointer here does not affect // anything. diff --git a/net/spdy/spdy_session_test_util.cc b/net/spdy/spdy_session_test_util.cc index 6619cdb..ee0caa0 100644 --- a/net/spdy/spdy_session_test_util.cc +++ b/net/spdy/spdy_session_test_util.cc @@ -15,11 +15,11 @@ SpdySessionTestTaskObserver::SpdySessionTestTaskObserver( : executed_count_(0), file_name_(file_name), function_name_(function_name) { - MessageLoop::current()->AddTaskObserver(this); + base::MessageLoop::current()->AddTaskObserver(this); } SpdySessionTestTaskObserver::~SpdySessionTestTaskObserver() { - MessageLoop::current()->RemoveTaskObserver(this); + base::MessageLoop::current()->RemoveTaskObserver(this); } void SpdySessionTestTaskObserver::WillProcessTask( diff --git a/net/spdy/spdy_session_test_util.h b/net/spdy/spdy_session_test_util.h index 8f75e2a..0b10551 100644 --- a/net/spdy/spdy_session_test_util.h +++ b/net/spdy/spdy_session_test_util.h @@ -16,7 +16,7 @@ namespace net { // SpdySessionTestTaskObserver is a MessageLoop::TaskObserver that monitors the // completion of all tasks executed by the current MessageLoop, recording the // number of tasks that refer to a specific function and filename. -class SpdySessionTestTaskObserver : public MessageLoop::TaskObserver { +class SpdySessionTestTaskObserver : public base::MessageLoop::TaskObserver { public: // Creates a SpdySessionTaskObserver that will record all tasks that are // executed that were posted by the function named by |function_name|, located diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc index fd63726..e7ebd48 100644 --- a/net/spdy/spdy_stream.cc +++ b/net/spdy/spdy_stream.cc @@ -154,7 +154,7 @@ void SpdyStream::SetDelegate(Delegate* delegate) { if (pushed_) { CHECK(response_received()); - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SpdyStream::PushedStreamReplayData, GetWeakPtr())); } else { diff --git a/net/spdy/spdy_stream_spdy2_unittest.cc b/net/spdy/spdy_stream_spdy2_unittest.cc index 43dc11b..022efec 100644 --- a/net/spdy/spdy_stream_spdy2_unittest.cc +++ b/net/spdy/spdy_stream_spdy2_unittest.cc @@ -69,7 +69,7 @@ class SpdyStreamSpdy2Test : public testing::Test { } virtual void TearDown() { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } SpdyTestUtil spdy_util_; diff --git a/net/spdy/spdy_stream_spdy3_unittest.cc b/net/spdy/spdy_stream_spdy3_unittest.cc index db8f612..6bb67fb 100644 --- a/net/spdy/spdy_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_stream_spdy3_unittest.cc @@ -73,7 +73,7 @@ class SpdyStreamSpdy3Test : public testing::Test { } virtual void TearDown() { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } void RunResumeAfterUnstallRequestResponseTest( diff --git a/net/spdy/spdy_websocket_stream_spdy2_unittest.cc b/net/spdy/spdy_websocket_stream_spdy2_unittest.cc index b8e5e2c..cfdff57 100644 --- a/net/spdy/spdy_websocket_stream_spdy2_unittest.cc +++ b/net/spdy/spdy_websocket_stream_spdy2_unittest.cc @@ -210,7 +210,7 @@ class SpdyWebSocketStreamSpdy2Test : public testing::Test { } virtual void TearDown() { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } void Prepare(SpdyStreamId stream_id) { diff --git a/net/spdy/spdy_websocket_stream_spdy3_unittest.cc b/net/spdy/spdy_websocket_stream_spdy3_unittest.cc index 76eef3e..dee8cbf 100644 --- a/net/spdy/spdy_websocket_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_websocket_stream_spdy3_unittest.cc @@ -211,7 +211,7 @@ class SpdyWebSocketStreamSpdy3Test : public testing::Test { } virtual void TearDown() { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } void Prepare(SpdyStreamId stream_id) { diff --git a/net/ssl/default_server_bound_cert_store_unittest.cc b/net/ssl/default_server_bound_cert_store_unittest.cc index d52d286..1ab5e54 100644 --- a/net/ssl/default_server_bound_cert_store_unittest.cc +++ b/net/ssl/default_server_bound_cert_store_unittest.cc @@ -101,7 +101,7 @@ void MockPersistentStore::Load(const LoadedCallback& loaded_callback) { new DefaultServerBoundCertStore::ServerBoundCert(it->second)); } - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(loaded_callback, base::Passed(&certs))); } @@ -150,7 +150,7 @@ TEST(DefaultServerBoundCertStoreTest, TestLoading) { base::Time(), "e", "f"); // Wait for load & queued set task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(2, store.GetCertCount()); store.SetServerBoundCert( "twitter.com", @@ -219,7 +219,7 @@ TEST(DefaultServerBoundCertStoreTest, TestDuplicateCerts) { "c", "d"); // Wait for load & queued set tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1, store.GetCertCount()); EXPECT_TRUE(store.GetServerBoundCert("verisign.com", &type, @@ -254,7 +254,7 @@ TEST(DefaultServerBoundCertStoreTest, TestAsyncGet) { base::Bind(&AsyncGetCertHelper::Callback, base::Unretained(&helper)))); // Wait for load & queued get tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1, store.GetCertCount()); EXPECT_EQ("not set", cert); EXPECT_TRUE(helper.called_); @@ -288,7 +288,7 @@ TEST(DefaultServerBoundCertStoreTest, TestDeleteAll) { base::Time(), "e", "f"); // Wait for load & queued set tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(3, store.GetCertCount()); int delete_finished = 0; @@ -323,7 +323,7 @@ TEST(DefaultServerBoundCertStoreTest, TestAsyncGetAndDeleteAll) { // Tasks have not run yet. EXPECT_EQ(0u, pre_certs.size()); // Wait for load & queued tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, store.GetCertCount()); EXPECT_EQ(2u, pre_certs.size()); EXPECT_EQ(0u, post_certs.size()); @@ -344,7 +344,7 @@ TEST(DefaultServerBoundCertStoreTest, TestDelete) { base::Time(), "a", "b"); // Wait for load & queued set task. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); store.SetServerBoundCert( "google.com", @@ -424,7 +424,7 @@ TEST(DefaultServerBoundCertStoreTest, TestAsyncDelete) { EXPECT_FALSE(a_helper.called_); EXPECT_FALSE(b_helper.called_); // Wait for load & queued tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1, delete_finished); EXPECT_EQ(1, store.GetCertCount()); EXPECT_EQ("not set", cert); @@ -472,7 +472,7 @@ TEST(DefaultServerBoundCertStoreTest, TestGetAll) { base::Time(), "g", "h"); // Wait for load & queued set tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(4, store.GetCertCount()); ServerBoundCertStore::ServerBoundCertList certs; @@ -497,7 +497,7 @@ TEST(DefaultServerBoundCertStoreTest, TestInitializeFrom) { base::Time(), "c", "d"); // Wait for load & queued set tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(2, store.GetCertCount()); ServerBoundCertStore::ServerBoundCertList source_certs; @@ -567,7 +567,7 @@ TEST(DefaultServerBoundCertStoreTest, TestAsyncInitializeFrom) { store.InitializeFrom(source_certs); EXPECT_EQ(0, store.GetCertCount()); // Wait for load & queued tasks. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(3, store.GetCertCount()); ServerBoundCertStore::ServerBoundCertList certs; diff --git a/net/ssl/server_bound_cert_service_unittest.cc b/net/ssl/server_bound_cert_service_unittest.cc index d913381..51c74bf 100644 --- a/net/ssl/server_bound_cert_service_unittest.cc +++ b/net/ssl/server_bound_cert_service_unittest.cc @@ -352,7 +352,7 @@ TEST_F(ServerBoundCertServiceTest, CancelRequest) { sequenced_worker_pool_->FlushForTesting(); // Wait for reply from ServerBoundCertServiceWorker to be posted back to the // ServerBoundCertService. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Even though the original request was cancelled, the service will still // store the result, it just doesn't call the callback. @@ -385,7 +385,7 @@ TEST_F(ServerBoundCertServiceTest, CancelRequestByHandleDestruction) { sequenced_worker_pool_->FlushForTesting(); // Wait for reply from ServerBoundCertServiceWorker to be posted back to the // ServerBoundCertService. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Even though the original request was cancelled, the service will still // store the result, it just doesn't call the callback. @@ -420,7 +420,7 @@ TEST_F(ServerBoundCertServiceTest, DestructionWithPendingRequest) { // ServerBoundCertServiceWorker should not post anything back to the // non-existant ServerBoundCertService, but run the loop just to be sure it // doesn't. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // If we got here without crashing or a valgrind error, it worked. } @@ -434,7 +434,7 @@ TEST_F(ServerBoundCertServiceTest, RequestAfterPoolShutdown) { sequenced_worker_pool_ = NULL; // Ensure any shutdown code is processed. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Make a request that will force synchronous completion. std::string host("encrypted.google.com"); diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc index 1993ef0..33f1ff4 100644 --- a/net/test/embedded_test_server/embedded_test_server_unittest.cc +++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc @@ -51,7 +51,7 @@ class EmbeddedTestServerTest : public testing::Test, virtual void SetUp() OVERRIDE { base::Thread::Options thread_options; - thread_options.message_loop_type = MessageLoop::TYPE_IO; + thread_options.message_loop_type = base::MessageLoop::TYPE_IO; ASSERT_TRUE(io_thread_.StartWithOptions(thread_options)); request_context_getter_ = new TestURLRequestContextGetter( @@ -69,7 +69,7 @@ class EmbeddedTestServerTest : public testing::Test, virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE { ++num_responses_received_; if (num_responses_received_ == num_responses_expected_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } // Waits until the specified number of responses are received. @@ -77,7 +77,7 @@ class EmbeddedTestServerTest : public testing::Test, num_responses_received_ = 0; num_responses_expected_ = num_responses; // Will be terminated in OnURLFetchComplete(). - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } // Handles |request| sent to |path| and returns the response per |content|, diff --git a/net/test/net_test_suite.cc b/net/test/net_test_suite.cc index 1687e84..1b75742 100644 --- a/net/test/net_test_suite.cc +++ b/net/test/net_test_suite.cc @@ -63,5 +63,5 @@ void NetTestSuite::InitializeTestThreadNoNetworkChangeNotifier() { // the process of running these unit tests. host_resolver_proc_->AddRule("*", "127.0.0.1"); - message_loop_.reset(new MessageLoopForIO()); + message_loop_.reset(new base::MessageLoopForIO()); } diff --git a/net/test/spawned_test_server/spawner_communicator.cc b/net/test/spawned_test_server/spawner_communicator.cc index 1602fb3..5b6ae75 100644 --- a/net/test/spawned_test_server/spawner_communicator.cc +++ b/net/test/spawned_test_server/spawner_communicator.cc @@ -110,25 +110,25 @@ SpawnerCommunicator::~SpawnerCommunicator() { } void SpawnerCommunicator::WaitForResponse() { - DCHECK_NE(MessageLoop::current(), io_thread_.message_loop()); + DCHECK_NE(base::MessageLoop::current(), io_thread_.message_loop()); event_.Wait(); event_.Reset(); } void SpawnerCommunicator::StartIOThread() { - DCHECK_NE(MessageLoop::current(), io_thread_.message_loop()); + DCHECK_NE(base::MessageLoop::current(), io_thread_.message_loop()); if (is_running_) return; allowed_port_.reset(new ScopedPortException(port_)); base::Thread::Options options; - options.message_loop_type = MessageLoop::TYPE_IO; + options.message_loop_type = base::MessageLoop::TYPE_IO; is_running_ = io_thread_.StartWithOptions(options); DCHECK(is_running_); } void SpawnerCommunicator::Shutdown() { - DCHECK_NE(MessageLoop::current(), io_thread_.message_loop()); + DCHECK_NE(base::MessageLoop::current(), io_thread_.message_loop()); DCHECK(is_running_); // The request and its context should be created and destroyed only on the // IO thread. @@ -164,9 +164,9 @@ void SpawnerCommunicator::SendCommandAndWaitForResultOnIOThread( const std::string& post_data, int* result_code, std::string* data_received) { - MessageLoop* loop = io_thread_.message_loop(); + base::MessageLoop* loop = io_thread_.message_loop(); DCHECK(loop); - DCHECK_EQ(MessageLoop::current(), loop); + DCHECK_EQ(base::MessageLoop::current(), loop); // Prepare the URLRequest for sending the command. DCHECK(!cur_request_.get()); @@ -196,9 +196,10 @@ void SpawnerCommunicator::SendCommandAndWaitForResultOnIOThread( } // Post a task to timeout this request if it takes too long. - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, - base::Bind(&SpawnerCommunicator::OnTimeout, weak_factory_.GetWeakPtr(), + base::Bind(&SpawnerCommunicator::OnTimeout, + weak_factory_.GetWeakPtr(), current_request_id), TestTimeouts::action_max_timeout()); diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index be9057d..9406233 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc @@ -319,7 +319,7 @@ int LoadOperations(const base::FilePath& path, RankCrashes action, // Main function on the child process. int SlaveCode(const base::FilePath& path, RankCrashes action) { - MessageLoopForIO message_loop; + base::MessageLoopForIO message_loop; base::FilePath full_path; if (!CreateTargetFolder(path, action, &full_path)) { @@ -329,7 +329,7 @@ int SlaveCode(const base::FilePath& path, RankCrashes action) { base::Thread cache_thread("CacheThread"); if (!cache_thread.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))) + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))) return GENERIC; if (action <= disk_cache::INSERT_ONE_3) diff --git a/net/tools/dump_cache/dump_files.cc b/net/tools/dump_cache/dump_files.cc index b43ca04..bfe0d7d 100644 --- a/net/tools/dump_cache/dump_files.cc +++ b/net/tools/dump_cache/dump_files.cc @@ -56,7 +56,7 @@ int GetMajorVersionFromFile(const base::FilePath& name) { // Dumps the contents of the Stats record. void DumpStats(const base::FilePath& path, disk_cache::CacheAddr addr) { // We need a message loop, although we really don't run any task. - MessageLoop loop(MessageLoop::TYPE_IO); + base::MessageLoop loop(base::MessageLoop::TYPE_IO); disk_cache::BlockFiles block_files(path); if (!block_files.Init(false)) { @@ -354,7 +354,7 @@ int DumpContents(const base::FilePath& input_path) { DumpHeaders(input_path); // We need a message loop, although we really don't run any task. - MessageLoop loop(MessageLoop::TYPE_IO); + base::MessageLoop loop(base::MessageLoop::TYPE_IO); CacheDumper dumper(input_path); if (!dumper.Init()) return -1; diff --git a/net/tools/dump_cache/simple_cache_dumper.cc b/net/tools/dump_cache/simple_cache_dumper.cc index d72e707ac..e5240b1 100644 --- a/net/tools/dump_cache/simple_cache_dumper.cc +++ b/net/tools/dump_cache/simple_cache_dumper.cc @@ -40,13 +40,13 @@ SimpleCacheDumper::~SimpleCacheDumper() { } int SimpleCacheDumper::Run() { - MessageLoopForIO main_message_loop; + base::MessageLoopForIO main_message_loop; LOG(INFO) << "Reading cache from: " << input_path_.value(); LOG(INFO) << "Writing cache to: " << output_path_.value(); if (!cache_thread_->StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))) { + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))) { LOG(ERROR) << "Unable to start thread"; return ERR_UNEXPECTED; } @@ -263,7 +263,7 @@ void SimpleCacheDumper::OnIOComplete(int rv) { rv_ = rv; delete cache_; cache_ = NULL; - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } } diff --git a/net/tools/dump_cache/upgrade_win.cc b/net/tools/dump_cache/upgrade_win.cc index e371560..61c5339 100644 --- a/net/tools/dump_cache/upgrade_win.cc +++ b/net/tools/dump_cache/upgrade_win.cc @@ -117,7 +117,7 @@ enum { // ----------------------------------------------------------------------- -class BaseSM : public MessageLoopForIO::IOHandler { +class BaseSM : public base::MessageLoopForIO::IOHandler { public: explicit BaseSM(HANDLE channel); virtual ~BaseSM(); @@ -128,8 +128,8 @@ class BaseSM : public MessageLoopForIO::IOHandler { bool ConnectChannel(); bool IsPending(); - MessageLoopForIO::IOContext in_context_; - MessageLoopForIO::IOContext out_context_; + base::MessageLoopForIO::IOContext in_context_; + base::MessageLoopForIO::IOContext out_context_; disk_cache::EntryImpl* entry_; HANDLE channel_; int state_; @@ -155,9 +155,9 @@ BaseSM::BaseSM(HANDLE channel) memset(&out_context_, 0, sizeof(out_context_)); in_context_.handler = this; out_context_.handler = this; - MessageLoopForIO::current()->RegisterIOHandler(channel_, this); + base::MessageLoopForIO::current()->RegisterIOHandler(channel_, this); CHECK(cache_thread_.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0))); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); } BaseSM::~BaseSM() { @@ -224,8 +224,9 @@ class MasterSM : public BaseSM { } bool DoInit(); - virtual void OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD bytes_transfered, DWORD error); + virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, + DWORD bytes_transfered, + DWORD error); private: enum { @@ -268,8 +269,9 @@ class MasterSM : public BaseSM { const base::FilePath path_; }; -void MasterSM::OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD bytes_transfered, DWORD error) { +void MasterSM::OnIOCompleted(base::MessageLoopForIO::IOContext* context, + DWORD bytes_transfered, + DWORD error) { pending_count_--; if (context == &out_context_) { if (!error) @@ -542,7 +544,8 @@ void MasterSM::SendQuit() { void MasterSM::DoEnd() { DEBUGMSG("Master DoEnd\n"); - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } void MasterSM::Fail() { @@ -559,8 +562,9 @@ class SlaveSM : public BaseSM { virtual ~SlaveSM(); bool DoInit(); - virtual void OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD bytes_transfered, DWORD error); + virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, + DWORD bytes_transfered, + DWORD error); private: enum { @@ -610,8 +614,9 @@ SlaveSM::~SlaveSM() { cache_->EndEnumeration(&iterator_); } -void SlaveSM::OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD bytes_transfered, DWORD error) { +void SlaveSM::OnIOCompleted(base::MessageLoopForIO::IOContext* context, + DWORD bytes_transfered, + DWORD error) { pending_count_--; if (state_ == SLAVE_END) { if (IsPending()) @@ -854,7 +859,8 @@ void SlaveSM::DoReadDataComplete(int ret) { void SlaveSM::DoEnd() { DEBUGMSG("\t\t\tSlave DoEnd\n"); - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } void SlaveSM::Fail() { @@ -887,7 +893,7 @@ HANDLE CreateServer(base::string16* pipe_number) { // This is the controller process for an upgrade operation. int UpgradeCache(const base::FilePath& output_path, HANDLE pipe) { - MessageLoop loop(MessageLoop::TYPE_IO); + base::MessageLoop loop(base::MessageLoop::TYPE_IO); MasterSM master(output_path, pipe); if (!master.DoInit()) { @@ -902,7 +908,7 @@ int UpgradeCache(const base::FilePath& output_path, HANDLE pipe) { // This process will only execute commands from the controller. int RunSlave(const base::FilePath& input_path, const base::string16& pipe_number) { - MessageLoop loop(MessageLoop::TYPE_IO); + base::MessageLoop loop(base::MessageLoop::TYPE_IO); base::win::ScopedHandle pipe(OpenServer(pipe_number)); if (!pipe.IsValid()) { diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc index 4191128..db7941c 100644 --- a/net/tools/fetch/fetch_client.cc +++ b/net/tools/fetch/fetch_client.cc @@ -44,7 +44,7 @@ class Driver { void ClientStarted() { clients_++; } void ClientStopped() { if (!--clients_) { - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } } @@ -140,7 +140,7 @@ int main(int argc, char** argv) { bool use_cache = parsed_command_line.HasSwitch("use-cache"); // Do work here. - MessageLoop loop(MessageLoop::TYPE_IO); + base::MessageLoop loop(base::MessageLoop::TYPE_IO); scoped_ptr<net::HostResolver> host_resolver( net::HostResolver::CreateDefaultResolver(NULL)); @@ -180,7 +180,7 @@ int main(int argc, char** argv) { for (int i = 0; i < client_limit; i++) clients[i] = new Client(factory, url); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } // Print Statistics here. diff --git a/net/tools/fetch/fetch_server.cc b/net/tools/fetch/fetch_server.cc index 34c7c83..a9591c6 100644 --- a/net/tools/fetch/fetch_server.cc +++ b/net/tools/fetch/fetch_server.cc @@ -35,10 +35,10 @@ int main(int argc, char**argv) { const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); // Do work here. - MessageLoop loop; + base::MessageLoop loop; HttpServer server(std::string(), 80); // TODO(mbelshe): make port configurable - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); if (parsed_command_line.HasSwitch("stats")) { // Dump the stats table. diff --git a/net/tools/gdig/gdig.cc b/net/tools/gdig/gdig.cc index 2601942..1640408 100644 --- a/net/tools/gdig/gdig.cc +++ b/net/tools/gdig/gdig.cc @@ -253,12 +253,12 @@ GDig::Result GDig::Main(int argc, const char* argv[]) { #endif base::AtExitManager exit_manager; - MessageLoopForIO loop; + base::MessageLoopForIO loop; result_ = RESULT_PENDING; Start(); if (result_ == RESULT_PENDING) - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Destroy it while MessageLoopForIO is alive. dns_config_service_.reset(); @@ -374,18 +374,16 @@ void GDig::Start() { base::Unretained(this))); timeout_closure_.Reset(base::Bind(&GDig::OnTimeout, base::Unretained(this))); - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - timeout_closure_.callback(), - config_timeout_); + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, timeout_closure_.callback(), config_timeout_); } } void GDig::Finish(Result result) { DCHECK_NE(RESULT_PENDING, result); result_ = result; - if (MessageLoop::current()) - MessageLoop::current()->Quit(); + if (base::MessageLoop::current()) + base::MessageLoop::current()->Quit(); } void GDig::OnDnsConfig(const DnsConfig& dns_config_const) { @@ -433,10 +431,10 @@ void GDig::ReplayNextEntry() { const ReplayLogEntry& entry = replay_log_[replay_log_index_]; if (time_since_start < entry.start_time) { // Delay call to next time and return. - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&GDig::ReplayNextEntry, base::Unretained(this)), - entry.start_time - time_since_start); + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&GDig::ReplayNextEntry, base::Unretained(this)), + entry.start_time - time_since_start); return; } diff --git a/net/tools/get_server_time/get_server_time.cc b/net/tools/get_server_time/get_server_time.cc index 3bbe271..bbac011 100644 --- a/net/tools/get_server_time/get_server_time.cc +++ b/net/tools/get_server_time/get_server_time.cc @@ -74,7 +74,7 @@ class QuitDelegate : public net::URLFetcherDelegate { // net::URLFetcherDelegate implementation. virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } virtual void OnURLFetchDownloadProgress( @@ -273,7 +273,7 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } - MessageLoopForIO main_loop; + base::MessageLoopForIO main_loop; // NOTE: A NetworkChangeNotifier could be instantiated here, but // that interferes with the request that will be sent; some diff --git a/net/tools/net_watcher/net_watcher.cc b/net/tools/net_watcher/net_watcher.cc index 6950b5d..426fea17 100644 --- a/net/tools/net_watcher/net_watcher.cc +++ b/net/tools/net_watcher/net_watcher.cc @@ -146,7 +146,7 @@ int main(int argc, char* argv[]) { logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); // Just make the main message loop the network loop. - MessageLoopForIO network_loop; + base::MessageLoopForIO network_loop; NetWatcher net_watcher; diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index f0f9e6b..3622e7d 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc @@ -22,7 +22,7 @@ static void PrintUsage() { int main(int argc, const char* argv[]) { base::AtExitManager at_exit_manager; - MessageLoopForIO message_loop; + base::MessageLoopForIO message_loop; // Process command line CommandLine::Init(argc, argv); diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc index 4520c47..2e89f0f 100644 --- a/net/udp/udp_socket_libevent.cc +++ b/net/udp/udp_socket_libevent.cc @@ -151,8 +151,8 @@ int UDPSocketLibevent::RecvFrom(IOBuffer* buf, if (nread != ERR_IO_PENDING) return nread; - if (!MessageLoopForIO::current()->WatchFileDescriptor( - socket_, true, MessageLoopForIO::WATCH_READ, + if (!base::MessageLoopForIO::current()->WatchFileDescriptor( + socket_, true, base::MessageLoopForIO::WATCH_READ, &read_socket_watcher_, &read_watcher_)) { PLOG(ERROR) << "WatchFileDescriptor failed on read"; int result = MapSystemError(errno); @@ -194,8 +194,8 @@ int UDPSocketLibevent::SendToOrWrite(IOBuffer* buf, if (result != ERR_IO_PENDING) return result; - if (!MessageLoopForIO::current()->WatchFileDescriptor( - socket_, true, MessageLoopForIO::WATCH_WRITE, + if (!base::MessageLoopForIO::current()->WatchFileDescriptor( + socket_, true, base::MessageLoopForIO::WATCH_WRITE, &write_socket_watcher_, &write_watcher_)) { DVLOG(1) << "WatchFileDescriptor failed on write, errno " << errno; int result = MapSystemError(errno); diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h index ceec17e..496f446 100644 --- a/net/udp/udp_socket_libevent.h +++ b/net/udp/udp_socket_libevent.h @@ -160,7 +160,7 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { SOCKET_OPTION_MULTICAST_LOOP = 1 << 2 }; - class ReadWatcher : public MessageLoopForIO::Watcher { + class ReadWatcher : public base::MessageLoopForIO::Watcher { public: explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {} @@ -176,7 +176,7 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { DISALLOW_COPY_AND_ASSIGN(ReadWatcher); }; - class WriteWatcher : public MessageLoopForIO::Watcher { + class WriteWatcher : public base::MessageLoopForIO::Watcher { public: explicit WriteWatcher(UDPSocketLibevent* socket) : socket_(socket) {} @@ -250,8 +250,8 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { mutable scoped_ptr<IPEndPoint> remote_address_; // The socket's libevent wrappers - MessageLoopForIO::FileDescriptorWatcher read_socket_watcher_; - MessageLoopForIO::FileDescriptorWatcher write_socket_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher read_socket_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher write_socket_watcher_; // The corresponding watchers for reads and writes. ReadWatcher read_watcher_; diff --git a/net/url_request/test_url_fetcher_factory.cc b/net/url_request/test_url_fetcher_factory.cc index 51ca21c..2db9fe8 100644 --- a/net/url_request/test_url_fetcher_factory.cc +++ b/net/url_request/test_url_fetcher_factory.cc @@ -296,7 +296,7 @@ FakeURLFetcher::FakeURLFetcher(const GURL& url, FakeURLFetcher::~FakeURLFetcher() {} void FakeURLFetcher::Start() { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&FakeURLFetcher::RunDelegate, weak_factory_.GetWeakPtr())); } diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc index f45c6e7..de4221f 100644 --- a/net/url_request/url_fetcher_impl_unittest.cc +++ b/net/url_request/url_fetcher_impl_unittest.cc @@ -184,7 +184,8 @@ void URLFetcherTest::CleanupAfterFetchComplete() { // because the destructor won't necessarily run on the // same thread that CreateFetcher() did. - io_message_loop_proxy()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + io_message_loop_proxy()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); // If the current message loop is not the IO loop, it will be shut down when // the main loop returns and this thread subsequently goes out of scope. } @@ -220,7 +221,8 @@ void URLFetcherMockDnsTest::CreateFetcher(const GURL& url) { } void URLFetcherMockDnsTest::OnURLFetchComplete(const URLFetcher* source) { - io_message_loop_proxy()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + io_message_loop_proxy()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); ASSERT_EQ(fetcher_, source); EXPECT_EQ(test_url_, source->GetOriginalURL()); completed_fetcher_.reset(fetcher_); @@ -422,7 +424,8 @@ class CancelTestURLRequestContext : public ThrottlingTestURLRequestContext { virtual ~CancelTestURLRequestContext() { // The d'tor should execute in the IO thread. Post the quit task to the // current thread. - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } }; @@ -899,7 +902,7 @@ TEST_F(URLFetcherTest, SameThreadsTest) { // thread. CreateFetcher(test_server.GetURL("defaultresponse")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherTest, DifferentThreadsTest) { @@ -921,7 +924,7 @@ TEST_F(URLFetcherTest, DifferentThreadsTest) { base::Unretained(this), test_server.GetURL("defaultresponse"))); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } void CancelAllOnIO() { @@ -940,10 +943,8 @@ TEST_F(URLFetcherTest, CancelAll) { CreateFetcher(test_server.GetURL("defaultresponse")); io_message_loop_proxy()->PostTaskAndReply( - FROM_HERE, - base::Bind(&CancelAllOnIO), - MessageLoop::QuitClosure()); - MessageLoop::current()->Run(); + FROM_HERE, base::Bind(&CancelAllOnIO), base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, GetNumFetcherCores()); delete fetcher_; } @@ -956,7 +957,7 @@ TEST_F(URLFetcherMockDnsTest, DontRetryOnNetworkChangedByDefault) { CreateFetcher(test_url_); fetcher_->Start(); EXPECT_EQ(0, GetNumFetcherCores()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The fetcher is now running, but is pending the host resolve. EXPECT_EQ(1, GetNumFetcherCores()); @@ -965,7 +966,7 @@ TEST_F(URLFetcherMockDnsTest, DontRetryOnNetworkChangedByDefault) { // A network change notification aborts the connect job. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, GetNumFetcherCores()); EXPECT_FALSE(resolver_.has_pending_requests()); ASSERT_TRUE(completed_fetcher_); @@ -983,7 +984,7 @@ TEST_F(URLFetcherMockDnsTest, RetryOnNetworkChangedAndFail) { fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); fetcher_->Start(); EXPECT_EQ(0, GetNumFetcherCores()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The fetcher is now running, but is pending the host resolve. EXPECT_EQ(1, GetNumFetcherCores()); @@ -994,7 +995,7 @@ TEST_F(URLFetcherMockDnsTest, RetryOnNetworkChangedAndFail) { for (int i = 0; i < 3; ++i) { // A network change notification aborts the connect job. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // But the fetcher retries automatically. EXPECT_EQ(1, GetNumFetcherCores()); @@ -1005,7 +1006,7 @@ TEST_F(URLFetcherMockDnsTest, RetryOnNetworkChangedAndFail) { // A 4th failure doesn't trigger another retry, and propagates the error // to the owner of the fetcher. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, GetNumFetcherCores()); EXPECT_FALSE(resolver_.has_pending_requests()); ASSERT_TRUE(completed_fetcher_); @@ -1023,7 +1024,7 @@ TEST_F(URLFetcherMockDnsTest, RetryOnNetworkChangedAndSucceed) { fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); fetcher_->Start(); EXPECT_EQ(0, GetNumFetcherCores()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // The fetcher is now running, but is pending the host resolve. EXPECT_EQ(1, GetNumFetcherCores()); @@ -1034,7 +1035,7 @@ TEST_F(URLFetcherMockDnsTest, RetryOnNetworkChangedAndSucceed) { for (int i = 0; i < 3; ++i) { // A network change notification aborts the connect job. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // But the fetcher retries automatically. EXPECT_EQ(1, GetNumFetcherCores()); @@ -1044,7 +1045,7 @@ TEST_F(URLFetcherMockDnsTest, RetryOnNetworkChangedAndSucceed) { // Now let it succeed by resolving the pending request. resolver_.ResolveAllPending(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // URLFetcherMockDnsTest::OnURLFetchComplete() will quit the loop. EXPECT_EQ(0, GetNumFetcherCores()); @@ -1063,7 +1064,7 @@ TEST_F(URLFetcherPostTest, Basic) { ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("echo")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherPostFileTest, Basic) { @@ -1073,7 +1074,7 @@ TEST_F(URLFetcherPostFileTest, Basic) { ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("echo")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherPostFileTest, Range) { @@ -1085,7 +1086,7 @@ TEST_F(URLFetcherPostFileTest, Range) { SetUploadRange(30, 100); CreateFetcher(test_server.GetURL("echo")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherEmptyPostTest, Basic) { @@ -1095,7 +1096,7 @@ TEST_F(URLFetcherEmptyPostTest, Basic) { ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("echo")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherUploadProgressTest, Basic) { @@ -1105,7 +1106,7 @@ TEST_F(URLFetcherUploadProgressTest, Basic) { ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("echo")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherDownloadProgressTest, Basic) { @@ -1126,7 +1127,7 @@ TEST_F(URLFetcherDownloadProgressTest, Basic) { CreateFetcher(test_server.GetURL( std::string(kTestServerFilePrefix) + kFileToFetch)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherDownloadProgressCancelTest, CancelWhileProgressReport) { @@ -1141,7 +1142,7 @@ TEST_F(URLFetcherDownloadProgressCancelTest, CancelWhileProgressReport) { CreateFetcher(test_server.GetURL( std::string(kTestServerFilePrefix) + kFileToFetch)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherHeadersTest, Headers) { @@ -1152,7 +1153,7 @@ TEST_F(URLFetcherHeadersTest, Headers) { ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("files/with-headers.html")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // The actual tests are in the URLFetcherHeadersTest fixture. } @@ -1166,7 +1167,7 @@ TEST_F(URLFetcherSocketAddressTest, SocketAddress) { // Reusing "with-headers.html" but doesn't really matter. CreateFetcher(test_server.GetURL("files/with-headers.html")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // The actual tests are in the URLFetcherSocketAddressTest fixture. } @@ -1178,7 +1179,7 @@ TEST_F(URLFetcherStopOnRedirectTest, StopOnRedirect) { CreateFetcher( test_server.GetURL(std::string("server-redirect?") + kRedirectTarget)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(callback_called_); } @@ -1205,7 +1206,7 @@ TEST_F(URLFetcherProtectTest, Overload) { CreateFetcher(url); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherProtectTest, ServerUnavailable) { @@ -1233,7 +1234,7 @@ TEST_F(URLFetcherProtectTest, ServerUnavailable) { CreateFetcher(url); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherProtectTestPassedThrough, ServerUnavailablePropagateResponse) { @@ -1263,7 +1264,7 @@ TEST_F(URLFetcherProtectTestPassedThrough, ServerUnavailablePropagateResponse) { CreateFetcher(url); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherBadHTTPSTest, BadHTTPSTest) { @@ -1275,7 +1276,7 @@ TEST_F(URLFetcherBadHTTPSTest, BadHTTPSTest) { ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("defaultresponse")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherCancelTest, ReleasesContext) { @@ -1298,7 +1299,7 @@ TEST_F(URLFetcherCancelTest, ReleasesContext) { base::Bind(&URLFetcherCancelTest::CreateFetcher, base::Unretained(this), url)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherCancelTest, CancelWhileDelayedStartTaskPending) { @@ -1335,7 +1336,7 @@ TEST_F(URLFetcherCancelTest, CancelWhileDelayedStartTaskPending) { FROM_HERE, base::Bind(&URLFetcherTest::CreateFetcher, base::Unretained(this), url)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherMultipleAttemptTest, SameData) { @@ -1349,7 +1350,7 @@ TEST_F(URLFetcherMultipleAttemptTest, SameData) { // thread. CreateFetcher(test_server.GetURL("defaultresponse")); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } TEST_F(URLFetcherFileTest, SmallGet) { @@ -1368,7 +1369,7 @@ TEST_F(URLFetcherFileTest, SmallGet) { test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch), temp_dir.path().AppendASCII(kFileToFetch)); - MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). + base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). ASSERT_FALSE(file_util::PathExists(file_path_)) << file_path_.value() << " not removed."; @@ -1391,7 +1392,7 @@ TEST_F(URLFetcherFileTest, LargeGet) { test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch), temp_dir.path().AppendASCII(kFileToFetch)); - MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). + base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). } TEST_F(URLFetcherFileTest, CanTakeOwnershipOfFile) { @@ -1410,11 +1411,11 @@ TEST_F(URLFetcherFileTest, CanTakeOwnershipOfFile) { test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch), temp_dir.path().AppendASCII(kFileToFetch)); - MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). + base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). - MessageLoop::current()->RunUntilIdle(); - ASSERT_FALSE(file_util::PathExists(file_path_)) - << file_path_.value() << " not removed."; + base::MessageLoop::current()->RunUntilIdle(); + ASSERT_FALSE(file_util::PathExists(file_path_)) << file_path_.value() + << " not removed."; } @@ -1442,7 +1443,7 @@ TEST_F(URLFetcherFileTest, OverwriteExistingFile) { test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch), file_path_); - MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). + base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). } TEST_F(URLFetcherFileTest, TryToOverwriteDirectory) { @@ -1467,9 +1468,9 @@ TEST_F(URLFetcherFileTest, TryToOverwriteDirectory) { test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch), file_path_); - MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). + base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(URLFetcherFileTest, SmallGetToTempFile) { @@ -1484,7 +1485,7 @@ TEST_F(URLFetcherFileTest, SmallGetToTempFile) { CreateFetcherForTempFile( test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch)); - MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). + base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). ASSERT_FALSE(file_util::PathExists(file_path_)) << file_path_.value() << " not removed."; @@ -1503,7 +1504,7 @@ TEST_F(URLFetcherFileTest, LargeGetToTempFile) { CreateFetcherForTempFile(test_server.GetURL( std::string(kTestServerFilePrefix) + kFileToFetch)); - MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). + base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). } TEST_F(URLFetcherFileTest, CanTakeOwnershipOfTempFile) { @@ -1518,11 +1519,11 @@ TEST_F(URLFetcherFileTest, CanTakeOwnershipOfTempFile) { CreateFetcherForTempFile(test_server.GetURL( std::string(kTestServerFilePrefix) + kFileToFetch)); - MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). + base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). - MessageLoop::current()->RunUntilIdle(); - ASSERT_FALSE(file_util::PathExists(file_path_)) - << file_path_.value() << " not removed."; + base::MessageLoop::current()->RunUntilIdle(); + ASSERT_FALSE(file_util::PathExists(file_path_)) << file_path_.value() + << " not removed."; } } // namespace diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 3487c71..853f9ee 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -225,10 +225,12 @@ URLRequest::URLRequest(const GURL& url, SIMPLE_STATS_COUNTER("URLRequestCount"); // Sanity check out environment. - DCHECK(MessageLoop::current()) << "The current MessageLoop must exist"; + DCHECK(base::MessageLoop::current()) + << "The current base::MessageLoop must exist"; - DCHECK(MessageLoop::current()->IsType(MessageLoop::TYPE_IO)) << "" - "The current MessageLoop must be TYPE_IO"; + DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)) + << "" + "The current base::MessageLoop must be TYPE_IO"; CHECK(context); context->url_requests()->insert(this); @@ -263,10 +265,12 @@ URLRequest::URLRequest(const GURL& url, SIMPLE_STATS_COUNTER("URLRequestCount"); // Sanity check out environment. - DCHECK(MessageLoop::current()) << "The current MessageLoop must exist"; + DCHECK(base::MessageLoop::current()) + << "The current base::MessageLoop must exist"; - DCHECK(MessageLoop::current()->IsType(MessageLoop::TYPE_IO)) << "" - "The current MessageLoop must be TYPE_IO"; + DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)) + << "" + "The current base::MessageLoop must be TYPE_IO"; CHECK(context); context->url_requests()->insert(this); diff --git a/net/url_request/url_request_about_job.cc b/net/url_request/url_request_about_job.cc index 7c7251d..517c702 100644 --- a/net/url_request/url_request_about_job.cc +++ b/net/url_request/url_request_about_job.cc @@ -23,7 +23,7 @@ URLRequestAboutJob::URLRequestAboutJob(URLRequest* request, void URLRequestAboutJob::Start() { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestAboutJob::StartAsync, weak_factory_.GetWeakPtr())); } diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index 4dda0e9..841d180 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc @@ -138,7 +138,7 @@ class BasicURLRequestContext : public URLRequestContext { void StartCacheThread() { cache_thread_.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_IO, 0)); + base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); } scoped_refptr<base::MessageLoopProxy> cache_message_loop_proxy() { @@ -148,10 +148,10 @@ class BasicURLRequestContext : public URLRequestContext { void StartFileThread() { file_thread_.StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_DEFAULT, 0)); + base::Thread::Options(base::MessageLoop::TYPE_DEFAULT, 0)); } - MessageLoop* file_message_loop() { + base::MessageLoop* file_message_loop() { DCHECK(file_thread_.IsRunning()); return file_thread_.message_loop(); } diff --git a/net/url_request/url_request_context_builder_unittest.cc b/net/url_request/url_request_context_builder_unittest.cc index b7cbcbe..f747b4d 100644 --- a/net/url_request/url_request_context_builder_unittest.cc +++ b/net/url_request/url_request_context_builder_unittest.cc @@ -60,7 +60,7 @@ TEST_F(URLRequestContextBuilderTest, DefaultSettings) { request.set_method("GET"); request.SetExtraRequestHeaderByName("Foo", "Bar", false); request.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("Bar", delegate.data_received()); } @@ -74,7 +74,7 @@ TEST_F(URLRequestContextBuilderTest, UserAgent) { test_server_.GetURL("echoheader?User-Agent"), &delegate, context.get()); request.set_method("GET"); request.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("Bar", delegate.data_received()); } diff --git a/net/url_request/url_request_error_job.cc b/net/url_request/url_request_error_job.cc index f8c2661..f6bf3f2 100644 --- a/net/url_request/url_request_error_job.cc +++ b/net/url_request/url_request_error_job.cc @@ -21,7 +21,7 @@ URLRequestErrorJob::URLRequestErrorJob( URLRequestErrorJob::~URLRequestErrorJob() {} void URLRequestErrorJob::Start() { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestErrorJob::StartAsync, weak_factory_.GetWeakPtr())); } diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc index 421c62a..ff1e780 100644 --- a/net/url_request/url_request_file_dir_job.cc +++ b/net/url_request/url_request_file_dir_job.cc @@ -45,7 +45,7 @@ void URLRequestFileDirJob::StartAsync() { void URLRequestFileDirJob::Start() { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestFileDirJob::StartAsync, weak_factory_.GetWeakPtr())); diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc index ac35f7e..4f677ef 100644 --- a/net/url_request/url_request_ftp_job.cc +++ b/net/url_request/url_request_ftp_job.cc @@ -237,7 +237,7 @@ void URLRequestFtpJob::OnStartCompleted(int result) { } void URLRequestFtpJob::OnStartCompletedAsync(int result) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestFtpJob::OnStartCompleted, weak_factory_.GetWeakPtr(), result)); diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc index 0fab7d5..3b4a790 100644 --- a/net/url_request/url_request_ftp_job_unittest.cc +++ b/net/url_request/url_request_ftp_job_unittest.cc @@ -577,7 +577,7 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestDoNotFollowRedirects) { url_request.Start(); EXPECT_TRUE(url_request.is_pending()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(url_request.is_pending()); EXPECT_EQ(0, request_delegate.response_started_count()); diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 7b38fa1..710bd0d 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -505,7 +505,7 @@ void URLRequestHttpJob::StartTransactionInternal() { // The transaction started synchronously, but we need to notify the // URLRequest delegate via the message loop. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, weak_factory_.GetWeakPtr(), rv)); @@ -1156,7 +1156,7 @@ void URLRequestHttpJob::CancelAuth() { // // We have to do this via InvokeLater to avoid "recursing" the consumer. // - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, weak_factory_.GetWeakPtr(), OK)); @@ -1181,7 +1181,7 @@ void URLRequestHttpJob::ContinueWithCertificate( // The transaction started synchronously, but we need to notify the // URLRequest delegate via the message loop. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, weak_factory_.GetWeakPtr(), rv)); @@ -1207,7 +1207,7 @@ void URLRequestHttpJob::ContinueDespiteLastError() { // The transaction started synchronously, but we need to notify the // URLRequest delegate via the message loop. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, weak_factory_.GetWeakPtr(), rv)); diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 18133af..04ba8ae 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -444,7 +444,7 @@ void URLRequestJob::NotifyDone(const URLRequestStatus &status) { // Complete this notification later. This prevents us from re-entering the // delegate if we're done because of a synchronous call. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestJob::CompleteNotifyDone, weak_factory_.GetWeakPtr())); diff --git a/net/url_request/url_request_job_factory_impl_unittest.cc b/net/url_request/url_request_job_factory_impl_unittest.cc index e17fdcd..078e16a 100644 --- a/net/url_request/url_request_job_factory_impl_unittest.cc +++ b/net/url_request/url_request_job_factory_impl_unittest.cc @@ -27,10 +27,9 @@ class MockURLRequestJob : public URLRequestJob { virtual void Start() OVERRIDE { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(&MockURLRequestJob::StartAsync, - weak_factory_.GetWeakPtr())); + base::Bind(&MockURLRequestJob::StartAsync, weak_factory_.GetWeakPtr())); } protected: @@ -63,7 +62,7 @@ TEST(URLRequestJobFactoryTest, NoProtocolHandler) { TestURLRequest request(GURL("foo://bar"), &delegate, &request_context, NULL); request.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::FAILED, request.status().status()); EXPECT_EQ(ERR_UNKNOWN_URL_SCHEME, request.status().error()); } @@ -77,7 +76,7 @@ TEST(URLRequestJobFactoryTest, BasicProtocolHandler) { TestURLRequest request(GURL("foo://bar"), &delegate, &request_context, NULL); request.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, request.status().status()); EXPECT_EQ(OK, request.status().error()); } diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc index a925ee1..354915f 100644 --- a/net/url_request/url_request_job_unittest.cc +++ b/net/url_request/url_request_job_unittest.cc @@ -51,7 +51,7 @@ TEST(URLRequestJob, TransactionNotifiedWhenDone) { req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(network_layer.done_reading_called()); @@ -72,7 +72,7 @@ TEST(URLRequestJob, SyncTransactionNotifiedWhenDone) { req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(network_layer.done_reading_called()); diff --git a/net/url_request/url_request_redirect_job.cc b/net/url_request/url_request_redirect_job.cc index 4b4c8fe..a4b0dfb 100644 --- a/net/url_request/url_request_redirect_job.cc +++ b/net/url_request/url_request_redirect_job.cc @@ -20,7 +20,7 @@ URLRequestRedirectJob::URLRequestRedirectJob(URLRequest* request, weak_factory_(this) {} void URLRequestRedirectJob::Start() { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestRedirectJob::StartAsync, weak_factory_.GetWeakPtr())); diff --git a/net/url_request/url_request_simple_job.cc b/net/url_request/url_request_simple_job.cc index 6ac1c21..6b0f99c 100644 --- a/net/url_request/url_request_simple_job.cc +++ b/net/url_request/url_request_simple_job.cc @@ -22,10 +22,9 @@ URLRequestSimpleJob::URLRequestSimpleJob( void URLRequestSimpleJob::Start() { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(&URLRequestSimpleJob::StartAsync, - weak_factory_.GetWeakPtr())); + base::Bind(&URLRequestSimpleJob::StartAsync, weak_factory_.GetWeakPtr())); } bool URLRequestSimpleJob::GetMimeType(std::string* mime_type) const { diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc index 2f2882a..c456ae5 100644 --- a/net/url_request/url_request_test_job.cc +++ b/net/url_request/url_request_test_job.cc @@ -147,7 +147,7 @@ void URLRequestTestJob::SetPriority(RequestPriority priority) { void URLRequestTestJob::Start() { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestTestJob::StartAsync, weak_factory_.GetWeakPtr())); } @@ -296,7 +296,7 @@ bool URLRequestTestJob::NextReadAsync() { void URLRequestTestJob::AdvanceJob() { if (auto_advance_) { - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&URLRequestTestJob::ProcessNextOperation, weak_factory_.GetWeakPtr())); return; diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc index b1dab4b..8fd603d 100644 --- a/net/url_request/url_request_test_util.cc +++ b/net/url_request/url_request_test_util.cc @@ -186,7 +186,8 @@ void TestDelegate::OnReceivedRedirect(URLRequest* request, received_redirect_count_++; if (quit_on_redirect_) { *defer_redirect = true; - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } else if (cancel_in_rr_) { request->Cancel(); } @@ -278,7 +279,8 @@ void TestDelegate::OnReadCompleted(URLRequest* request, int bytes_read) { void TestDelegate::OnResponseCompleted(URLRequest* request) { if (quit_on_complete_) - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } TestNetworkDelegate::TestNetworkDelegate() diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index ca08f25..4ad170a 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -502,7 +502,7 @@ NetworkDelegate::AuthRequiredResponse BlockingNetworkDelegate::OnAuthRequired( return auth_retval_; case AUTO_CALLBACK: - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&BlockingNetworkDelegate::RunAuthCallback, weak_factory_.GetWeakPtr(), auth_retval_, callback)); @@ -511,7 +511,8 @@ NetworkDelegate::AuthRequiredResponse BlockingNetworkDelegate::OnAuthRequired( case USER_CALLBACK: auth_callback_ = callback; stage_blocked_for_callback_ = ON_AUTH_REQUIRED; - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); return AUTH_REQUIRED_RESPONSE_IO_PENDING; } NOTREACHED(); @@ -541,7 +542,7 @@ int BlockingNetworkDelegate::MaybeBlockStage( return retval_; case AUTO_CALLBACK: - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&BlockingNetworkDelegate::RunCallback, weak_factory_.GetWeakPtr(), retval_, callback)); @@ -550,7 +551,8 @@ int BlockingNetworkDelegate::MaybeBlockStage( case USER_CALLBACK: callback_ = callback; stage_blocked_for_callback_ = stage; - MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); return ERR_IO_PENDING; } NOTREACHED(); @@ -608,7 +610,7 @@ TEST_F(URLRequestTest, AboutBlankTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(!r.is_pending()); EXPECT_FALSE(d.received_data_before_response()); @@ -648,7 +650,7 @@ TEST_F(URLRequestTest, DataURLImageTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(!r.is_pending()); EXPECT_FALSE(d.received_data_before_response()); @@ -670,7 +672,7 @@ TEST_F(URLRequestTest, FileTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = -1; EXPECT_TRUE(file_util::GetFileSize(app_path, &file_size)); @@ -699,7 +701,7 @@ TEST_F(URLRequestTest, FileTestCancel) { } // Async cancelation should be safe even when URLRequest has been already // destroyed. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { @@ -734,7 +736,7 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(!r.is_pending()); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -777,7 +779,7 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(!r.is_pending()); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -813,7 +815,7 @@ TEST_F(URLRequestTest, FileTestMultipleRanges) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.request_failed()); } @@ -828,7 +830,7 @@ TEST_F(URLRequestTest, InvalidUrlTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.request_failed()); } } @@ -866,7 +868,7 @@ TEST_F(URLRequestTest, ResolveShortcutTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); WIN32_FILE_ATTRIBUTE_DATA data; GetFileAttributesEx(app_path.value().c_str(), @@ -910,7 +912,7 @@ TEST_F(URLRequestTest, FileDirCancelTest) { d.set_cancel_in_received_data_pending(true); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } // Take out mock resource provider. @@ -931,7 +933,7 @@ TEST_F(URLRequestTest, FileDirRedirectNoCrash) { TestDelegate d; URLRequest req(FilePathToFileURL(path), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); ASSERT_EQ(1, d.received_redirect_count()); ASSERT_LT(0, d.bytes_received()); @@ -945,7 +947,7 @@ TEST_F(URLRequestTest, FileDirRedirectSingleSlash) { TestDelegate d; URLRequest req(GURL("file:///"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); ASSERT_EQ(1, d.received_redirect_count()); ASSERT_FALSE(req.status().is_success()); @@ -1173,7 +1175,7 @@ TEST_F(URLRequestTest, Intercept) { req.SetUserData(&user_data2, user_data2); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Make sure we can retrieve our specific user data EXPECT_EQ(user_data0, req.GetUserData(NULL)); @@ -1208,7 +1210,7 @@ TEST_F(URLRequestTest, InterceptRedirect) { URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check the interceptor got called as expected EXPECT_TRUE(interceptor.did_intercept_main_); @@ -1241,7 +1243,7 @@ TEST_F(URLRequestTest, InterceptServerError) { URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check the interceptor got called as expected EXPECT_TRUE(interceptor.did_intercept_main_); @@ -1270,7 +1272,7 @@ TEST_F(URLRequestTest, InterceptNetworkError) { URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check the interceptor got called as expected EXPECT_TRUE(interceptor.did_simulate_error_main_); @@ -1299,7 +1301,7 @@ TEST_F(URLRequestTest, InterceptRestartRequired) { URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check the interceptor got called as expected EXPECT_TRUE(interceptor.did_restart_main_); @@ -1330,7 +1332,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelMain) { URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check the interceptor got called as expected EXPECT_TRUE(interceptor.did_cancel_main_); @@ -1361,7 +1363,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelRedirect) { URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check the interceptor got called as expected EXPECT_TRUE(interceptor.did_intercept_main_); @@ -1386,7 +1388,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelFinal) { URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check the interceptor got called as expected EXPECT_TRUE(interceptor.did_simulate_error_main_); @@ -1412,7 +1414,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelInRestart) { URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check the interceptor got called as expected EXPECT_TRUE(interceptor.did_cancel_then_restart_main_); @@ -1431,7 +1433,7 @@ LoadTimingInfo RunLoadTimingTest(const LoadTimingInfo& job_load_timing, TestDelegate d; URLRequest req(GURL("http://test_intercept/foo"), &d, context); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); LoadTimingInfo resulting_load_timing; req.GetLoadTimingInfo(&resulting_load_timing); @@ -1708,7 +1710,7 @@ TEST_F(URLRequestTest, NetworkDelegateProxyError) { req.set_method("GET"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // Check we see a failed request. EXPECT_FALSE(req.status().is_success()); @@ -1726,7 +1728,7 @@ TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) { TestDelegate d; URLRequest req(GURL("data:,"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("", d.data_received()); EXPECT_EQ(1, default_network_delegate_.completed_requests()); } @@ -1820,7 +1822,7 @@ TEST_F(URLRequestTest, DelayedCookieCallback) { URLRequest req( test_server.GetURL("set-cookie?CookieToNotSend=1"), &d, &context); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); EXPECT_EQ(1, network_delegate.set_cookie_count()); @@ -1833,7 +1835,7 @@ TEST_F(URLRequestTest, DelayedCookieCallback) { TestDelegate d; URLRequest req(test_server.GetURL("echoheader?Cookie"), &d, &context); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") != std::string::npos); @@ -1855,7 +1857,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); } @@ -1868,7 +1870,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") != std::string::npos); @@ -1885,7 +1887,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.set_load_flags(LOAD_DO_NOT_SEND_COOKIES); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") == std::string::npos); @@ -1909,7 +1911,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); @@ -1928,7 +1930,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { req.set_load_flags(LOAD_DO_NOT_SAVE_COOKIES); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // LOAD_DO_NOT_SAVE_COOKIES does not trigger OnSetCookie. EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); @@ -1944,7 +1946,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") == std::string::npos); @@ -1970,7 +1972,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); @@ -1984,7 +1986,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") != std::string::npos); @@ -2002,7 +2004,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") == std::string::npos); @@ -2025,7 +2027,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); @@ -2043,7 +2045,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(2, network_delegate.blocked_set_cookie_count()); @@ -2057,7 +2059,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") == std::string::npos); @@ -2080,7 +2082,7 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) { TestDelegate d; URLRequest req(test_server.GetURL("set-cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); @@ -2101,7 +2103,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); @@ -2115,7 +2117,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") != std::string::npos); @@ -2133,7 +2135,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") == std::string::npos); @@ -2156,7 +2158,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); @@ -2174,7 +2176,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); EXPECT_EQ(2, network_delegate.blocked_set_cookie_count()); @@ -2188,7 +2190,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") == std::string::npos); @@ -2257,7 +2259,7 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } // Verify that the cookie is not set. { @@ -2267,7 +2269,7 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("StillGood=1") == std::string::npos); } @@ -2281,7 +2283,7 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); } // Verify that the cookie is set. { @@ -2291,7 +2293,7 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { URLRequest req( test_server.GetURL("echoheader?Cookie"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("StillGood=1") != std::string::npos); } @@ -2317,7 +2319,7 @@ TEST_F(URLRequestTest, DoNotOverrideReferrer) { req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("http://foo.com/", d.data_received()); } @@ -2335,7 +2337,7 @@ TEST_F(URLRequestTest, DoNotOverrideReferrer) { req.set_load_flags(LOAD_VALIDATE_CACHE); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("None", d.data_received()); } @@ -2372,7 +2374,7 @@ class URLRequestTestHTTP : public URLRequestTest { req.SetExtraRequestHeaders(headers); } req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(redirect_method, req.method()); EXPECT_EQ(URLRequestStatus::SUCCESS, req.status().status()); EXPECT_EQ(OK, req.status().error()); @@ -2415,7 +2417,7 @@ class URLRequestTestHTTP : public URLRequestTest { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); ASSERT_EQ(1, d.response_started_count()) << "request failed: " << r.status().status() @@ -2461,7 +2463,7 @@ class URLRequestTestHTTP : public URLRequestTest { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); bool is_success = r.status().is_success(); @@ -2500,7 +2502,7 @@ TEST_F(URLRequestTestHTTP, ProxyTunnelRedirectTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().error()); @@ -2526,7 +2528,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().error()); @@ -2567,12 +2569,12 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateBlockAsynchronously) { r.Start(); for (size_t i = 0; i < blocking_stages_length; ++i) { - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(blocking_stages[i], network_delegate.stage_blocked_for_callback()); network_delegate.DoCallback(OK); } - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(200, r.GetResponseCode()); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(1, network_delegate.created_requests()); @@ -2599,7 +2601,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequest) { URLRequest r(test_server_.GetURL(std::string()), &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); EXPECT_EQ(ERR_EMPTY_RESPONSE, r.status().error()); @@ -2629,7 +2631,7 @@ void NetworkDelegateCancelRequest(BlockingNetworkDelegate::BlockMode block_mode, URLRequest r(url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); EXPECT_EQ(ERR_BLOCKED_BY_CLIENT, r.status().error()); @@ -2706,7 +2708,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequest) { URLRequest r(original_url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(0, r.status().error()); @@ -2739,7 +2741,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestSynchronously) { URLRequest r(original_url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(0, r.status().error()); @@ -2779,7 +2781,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestPost) { base::UintToString(arraysize(kData) - 1)); r.SetExtraRequestHeaders(headers); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(0, r.status().error()); @@ -2815,7 +2817,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncNoAction) { GURL url(test_server_.GetURL("auth-basic")); URLRequest r(url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(0, r.status().error()); @@ -2849,7 +2851,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncSetAuth) { GURL url(test_server_.GetURL("auth-basic")); URLRequest r(url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(0, r.status().error()); @@ -2881,7 +2883,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncCancel) { GURL url(test_server_.GetURL("auth-basic")); URLRequest r(url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(OK, r.status().error()); @@ -2915,7 +2917,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncNoAction) { GURL url(test_server_.GetURL("auth-basic")); URLRequest r(url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(0, r.status().error()); @@ -2950,7 +2952,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncSetAuth) { GURL url(test_server_.GetURL("auth-basic")); URLRequest r(url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(0, r.status().error()); @@ -2983,7 +2985,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncCancel) { GURL url(test_server_.GetURL("auth-basic")); URLRequest r(url, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); EXPECT_EQ(OK, r.status().error()); @@ -3014,7 +3016,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting1) { URLRequest r(test_server_.GetURL(std::string()), &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST, network_delegate.stage_blocked_for_callback()); EXPECT_EQ(0, network_delegate.completed_requests()); @@ -3050,7 +3052,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting2) { URLRequest r(test_server_.GetURL(std::string()), &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS, network_delegate.stage_blocked_for_callback()); EXPECT_EQ(0, network_delegate.completed_requests()); @@ -3085,7 +3087,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting3) { URLRequest r(test_server_.GetURL(std::string()), &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(BlockingNetworkDelegate::ON_HEADERS_RECEIVED, network_delegate.stage_blocked_for_callback()); EXPECT_EQ(0, network_delegate.completed_requests()); @@ -3120,7 +3122,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting4) { URLRequest r(test_server_.GetURL("auth-basic"), &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(BlockingNetworkDelegate::ON_AUTH_REQUIRED, network_delegate.stage_blocked_for_callback()); EXPECT_EQ(0, network_delegate.completed_requests()); @@ -3154,7 +3156,7 @@ TEST_F(URLRequestTestHTTP, UnexpectedServerAuthTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().error()); @@ -3171,7 +3173,7 @@ TEST_F(URLRequestTestHTTP, GetTest_NoCache) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -3237,7 +3239,7 @@ TEST_F(URLRequestTestHTTP, GetTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -3259,7 +3261,7 @@ TEST_F(URLRequestTestHTTP, GetTestLoadTiming) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); LoadTimingInfo load_timing_info; r.GetLoadTimingInfo(&load_timing_info); @@ -3308,7 +3310,7 @@ TEST_F(URLRequestTestHTTP, GetZippedTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -3344,7 +3346,7 @@ TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) { "server-redirect?" + http_destination.spec()), &d, &default_context_); req.SetReferrer("https://www.referrer.com/"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_EQ(1, d.received_redirect_count()); @@ -3361,7 +3363,7 @@ TEST_F(URLRequestTestHTTP, RedirectLoadTiming) { TestDelegate d; URLRequest req(original_url, &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_EQ(1, d.received_redirect_count()); @@ -3401,7 +3403,7 @@ TEST_F(URLRequestTestHTTP, MultipleRedirectTest) { TestDelegate d; URLRequest req(original_url, &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_EQ(2, d.received_redirect_count()); @@ -3439,7 +3441,7 @@ TEST_F(URLRequestTestHTTP, RedirectWithAdditionalHeadersTest) { RedirectWithAdditionalHeadersDelegate d; URLRequest req(original_url, &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); std::string value; const HttpRequestHeaders& headers = req.extra_request_headers(); @@ -3476,7 +3478,7 @@ TEST_F(URLRequestTestHTTP, RedirectWithHeaderRemovalTest) { URLRequest req(original_url, &d, &default_context_); req.SetExtraRequestHeaderByName(kExtraHeaderToRemove, "dummy", false); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); std::string value; const HttpRequestHeaders& headers = req.extra_request_headers(); @@ -3496,7 +3498,7 @@ TEST_F(URLRequestTestHTTP, CancelTest) { r.Cancel(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // We expect to receive OnResponseStarted even though the request has been // cancelled. @@ -3518,7 +3520,7 @@ TEST_F(URLRequestTestHTTP, CancelTest2) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_EQ(0, d.bytes_received()); @@ -3539,7 +3541,7 @@ TEST_F(URLRequestTestHTTP, CancelTest3) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); // There is no guarantee about how much data was received @@ -3584,7 +3586,7 @@ TEST_F(URLRequestTestHTTP, CancelTest5) { TestDelegate d; URLRequest r(test_server_.GetURL("cachetime"), &d, &default_context_); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); } @@ -3594,7 +3596,7 @@ TEST_F(URLRequestTestHTTP, CancelTest5) { URLRequest r(test_server_.GetURL("cachetime"), &d, &default_context_); r.Start(); r.Cancel(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::CANCELED, r.status().status()); EXPECT_EQ(1, d.response_started_count()); @@ -3624,7 +3626,7 @@ TEST_F(URLRequestTestHTTP, PostEmptyTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); ASSERT_EQ(1, d.response_started_count()) << "request failed: " << r.status().status() @@ -3669,7 +3671,7 @@ TEST_F(URLRequestTestHTTP, PostFileTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 size = 0; ASSERT_EQ(true, file_util::GetFileSize(path, &size)); @@ -3700,7 +3702,7 @@ TEST_F(URLRequestTestHTTP, TestPostChunkedDataBeforeStart) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); VerifyReceivedDataMatchesChunks(&r, &d); } @@ -3717,7 +3719,7 @@ TEST_F(URLRequestTestHTTP, TestPostChunkedDataJustAfterStart) { r.Start(); EXPECT_TRUE(r.is_pending()); AddChunksToUpload(&r); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); VerifyReceivedDataMatchesChunks(&r, &d); } @@ -3734,9 +3736,9 @@ TEST_F(URLRequestTestHTTP, TestPostChunkedDataAfterStart) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); AddChunksToUpload(&r); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); VerifyReceivedDataMatchesChunks(&r, &d); } @@ -3749,7 +3751,7 @@ TEST_F(URLRequestTestHTTP, ResponseHeadersTest) { URLRequest req( test_server_.GetURL("files/with-headers.html"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); const HttpResponseHeaders* headers = req.response_headers(); @@ -3785,7 +3787,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTS) { &d, &default_context_); request.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); TransportSecurityState* security_state = default_context_.transport_security_state(); @@ -3812,7 +3814,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTSOnce) { &d, &default_context_); request.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // We should have set parameters from the first header, not the second. TransportSecurityState* security_state = @@ -3840,7 +3842,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTSAndPKP) { &d, &default_context_); request.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // We should have set parameters from the first header, not the second. TransportSecurityState* security_state = @@ -3872,7 +3874,7 @@ TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { URLRequest req(test_server_.GetURL( "files/content-type-normalization.html"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); std::string mime_type; req.GetMimeType(&mime_type); @@ -3905,7 +3907,7 @@ TEST_F(URLRequestTestHTTP, RestrictRedirects) { URLRequest req(test_server_.GetURL( "files/redirect-to-file.html"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::FAILED, req.status().status()); EXPECT_EQ(ERR_UNSAFE_REDIRECT, req.status().error()); @@ -3918,7 +3920,7 @@ TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) { URLRequest req(test_server_.GetURL( "files/redirect-to-invalid-url.html"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(URLRequestStatus::FAILED, req.status().status()); EXPECT_EQ(ERR_INVALID_URL, req.status().error()); @@ -3932,7 +3934,7 @@ TEST_F(URLRequestTestHTTP, NoUserPassInReferrer) { test_server_.GetURL("echoheader?Referer"), &d, &default_context_); req.SetReferrer("http://user:pass@foo.com/"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(std::string("http://foo.com/"), d.data_received()); } @@ -3945,7 +3947,7 @@ TEST_F(URLRequestTestHTTP, NoFragmentInReferrer) { test_server_.GetURL("echoheader?Referer"), &d, &default_context_); req.SetReferrer("http://foo.com/test#fragment"); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(std::string("http://foo.com/test"), d.data_received()); } @@ -3959,7 +3961,7 @@ TEST_F(URLRequestTestHTTP, EmptyReferrerAfterValidReferrer) { req.SetReferrer("http://foo.com/test#fragment"); req.SetReferrer(""); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(std::string("None"), d.data_received()); } @@ -3973,7 +3975,7 @@ TEST_F(URLRequestTestHTTP, CancelRedirect) { URLRequest req( test_server_.GetURL("files/redirect-test.html"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_EQ(0, d.bytes_received()); @@ -3991,12 +3993,12 @@ TEST_F(URLRequestTestHTTP, DeferredRedirect) { URLRequest req( test_server_.GetURL("files/redirect-test.html"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.received_redirect_count()); req.FollowDeferredRedirect(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -4024,12 +4026,12 @@ TEST_F(URLRequestTestHTTP, CancelDeferredRedirect) { URLRequest req( test_server_.GetURL("files/redirect-test.html"), &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.received_redirect_count()); req.Cancel(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_EQ(0, d.bytes_received()); @@ -4050,7 +4052,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { headers.SetHeader("foo", "1"); req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); LoadTimingInfo load_timing_info; req.GetLoadTimingInfo(&load_timing_info); @@ -4066,7 +4068,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { headers.SetHeader("foo", "1"); req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(req.was_cached()); @@ -4084,7 +4086,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { headers.SetHeader("foo", "2"); req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_FALSE(req.was_cached()); @@ -4105,7 +4107,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) { URLRequest r(test_server_.GetURL("auth-basic"), &d, &default_context_); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); } @@ -4121,7 +4123,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) { r.set_load_flags(LOAD_VALIDATE_CACHE); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); @@ -4152,7 +4154,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { URLRequest r(url_requiring_auth, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); @@ -4181,7 +4183,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { URLRequest r(url_with_identity, &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("user2/secret") != std::string::npos); @@ -4203,7 +4205,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthLoadTiming) { URLRequest r(test_server_.GetURL("auth-basic"), &d, &default_context_); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); @@ -4235,7 +4237,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthLoadTiming) { r.set_load_flags(LOAD_VALIDATE_CACHE); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); @@ -4278,7 +4280,7 @@ TEST_F(URLRequestTestHTTP, Post302RedirectGet) { "Origin: http://localhost:1337/"); req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); std::string mime_type; req.GetMimeType(&mime_type); @@ -4361,7 +4363,7 @@ TEST_F(URLRequestTestHTTP, InterceptPost302RedirectGet) { AddTestInterceptor()->set_main_intercept_job(job); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("GET", req.method()); } @@ -4385,7 +4387,7 @@ TEST_F(URLRequestTestHTTP, InterceptPost307RedirectPost) { AddTestInterceptor()->set_main_intercept_job(job); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("POST", req.method()); EXPECT_EQ(kData, d.data_received()); } @@ -4405,7 +4407,7 @@ TEST_F(URLRequestTestHTTP, DefaultAcceptLanguage) { URLRequest req( test_server_.GetURL("echoheader?Accept-Language"), &d, &context); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("en", d.data_received()); } @@ -4426,7 +4428,7 @@ TEST_F(URLRequestTestHTTP, EmptyAcceptLanguage) { URLRequest req( test_server_.GetURL("echoheader?Accept-Language"), &d, &context); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("None", d.data_received()); } @@ -4443,7 +4445,7 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptLanguage) { headers.SetHeader(HttpRequestHeaders::kAcceptLanguage, "ru"); req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(std::string("ru"), d.data_received()); } @@ -4458,7 +4460,7 @@ TEST_F(URLRequestTestHTTP, DefaultAcceptEncoding) { HttpRequestHeaders headers; req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(ContainsString(d.data_received(), "gzip")); } @@ -4475,7 +4477,7 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptEncoding) { headers.SetHeader(HttpRequestHeaders::kAcceptEncoding, "identity"); req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_FALSE(ContainsString(d.data_received(), "gzip")); EXPECT_TRUE(ContainsString(d.data_received(), "identity")); } @@ -4492,7 +4494,7 @@ TEST_F(URLRequestTestHTTP, SetAcceptCharset) { headers.SetHeader(HttpRequestHeaders::kAcceptCharset, "koi-8r"); req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(std::string("koi-8r"), d.data_received()); } @@ -4505,7 +4507,7 @@ TEST_F(URLRequestTestHTTP, DefaultUserAgent) { &d, &default_context_); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(req.context()->GetUserAgent(req.url()), d.data_received()); } @@ -4522,7 +4524,7 @@ TEST_F(URLRequestTestHTTP, OverrideUserAgent) { headers.SetHeader(HttpRequestHeaders::kUserAgent, "Lynx (textmode)"); req.SetExtraRequestHeaders(headers); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // If the net tests are being run with ChromeFrame then we need to allow for // the 'chromeframe' suffix which is added to the user agent before the // closing parentheses. @@ -4554,7 +4556,7 @@ TEST_F(URLRequestTestHTTP, EmptyHttpUserAgentSettings) { TestDelegate d; URLRequest req(test_server_.GetURL(tests[i].request), &d, &context); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(tests[i].expected_response, d.data_received()) << " Request = \"" << tests[i].request << "\""; } @@ -4584,7 +4586,7 @@ TEST_F(URLRequestTestHTTP, SetSubsequentJobPriority) { AddTestInterceptor()->set_main_intercept_job(job); // Should trigger |job| to be started. - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(LOW, job->priority()); } @@ -4614,7 +4616,7 @@ TEST_F(HTTPSRequestTest, HTTPSGetTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -4646,7 +4648,7 @@ TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -4682,7 +4684,7 @@ TEST_F(HTTPSRequestTest, HTTPSExpiredTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -4725,7 +4727,7 @@ TEST_F(HTTPSRequestTest, TLSv1Fallback) { URLRequest r(test_server.GetURL(std::string()), &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_NE(0, d.bytes_received()); @@ -4769,7 +4771,7 @@ TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -4817,7 +4819,7 @@ TEST_F(HTTPSRequestTest, HTTPSErrorsNoClobberTSSTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -4886,7 +4888,7 @@ TEST_F(HTTPSRequestTest, HSTSPreservesPosts) { req.set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); req.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ("https", req.url().scheme()); EXPECT_EQ("POST", req.method()); @@ -4911,7 +4913,7 @@ TEST_F(HTTPSRequestTest, SSLv3Fallback) { URLRequest r(test_server.GetURL(std::string()), &d, &context); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_NE(0, d.bytes_received()); @@ -4930,7 +4932,7 @@ class SSLClientAuthTestDelegate : public TestDelegate { URLRequest* request, SSLCertRequestInfo* cert_request_info) OVERRIDE { on_certificate_requested_count_++; - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } int on_certificate_requested_count() { return on_certificate_requested_count_; @@ -4962,7 +4964,7 @@ TEST_F(HTTPSRequestTest, ClientAuthTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.on_certificate_requested_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -4973,7 +4975,7 @@ TEST_F(HTTPSRequestTest, ClientAuthTest) { // all platforms so we can test sending a cert as well. r.ContinueWithCertificate(NULL); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); @@ -5002,7 +5004,7 @@ TEST_F(HTTPSRequestTest, ResumeTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); } @@ -5018,7 +5020,7 @@ TEST_F(HTTPSRequestTest, ResumeTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // The response will look like; // insert abc @@ -5071,7 +5073,7 @@ TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); } @@ -5102,7 +5104,7 @@ TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); // The response will look like; // insert abc @@ -5203,7 +5205,7 @@ class HTTPSOCSPTest : public HTTPSRequestTest { URLRequest r(test_server.GetURL(std::string()), &d, &context_); r.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(1, d.response_started_count()); *out_cert_status = r.ssl_info().cert_status; @@ -5516,7 +5518,7 @@ TEST_F(URLRequestTestFTP, UnsafePort) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_FALSE(r.is_pending()); EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); @@ -5534,7 +5536,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPDirectoryListing) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_FALSE(r.is_pending()); EXPECT_EQ(1, d.response_started_count()); @@ -5560,7 +5562,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPGetTestAnonymous) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5592,7 +5594,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPGetTest) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5630,7 +5632,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongPassword) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5663,7 +5665,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongPasswordRestart) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5693,7 +5695,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUser) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5726,7 +5728,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUserRestart) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5758,7 +5760,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheURLCredentials) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5776,7 +5778,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheURLCredentials) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5810,7 +5812,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheLoginBoxCredentials) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); @@ -5831,7 +5833,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheLoginBoxCredentials) { r.Start(); EXPECT_TRUE(r.is_pending()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); int64 file_size = 0; file_util::GetFileSize(app_path, &file_size); diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc index 225793e..ed0b458 100644 --- a/net/websockets/websocket_job.cc +++ b/net/websockets/websocket_job.cc @@ -220,7 +220,7 @@ void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) { DCHECK_GT(amount_sent, 0); current_send_buffer_ = NULL; if (!weak_ptr_factory_for_send_pending_.HasWeakPtrs()) { - MessageLoopForIO::current()->PostTask( + base::MessageLoopForIO::current()->PostTask( FROM_HERE, base::Bind(&WebSocketJob::SendPending, weak_ptr_factory_for_send_pending_.GetWeakPtr())); @@ -642,7 +642,7 @@ void WebSocketJob::Wakeup() { return; waiting_ = false; DCHECK(!callback_.is_null()); - MessageLoopForIO::current()->PostTask( + base::MessageLoopForIO::current()->PostTask( FROM_HERE, base::Bind(&WebSocketJob::RetryPendingIO, weak_ptr_factory_.GetWeakPtr())); diff --git a/net/websockets/websocket_job_spdy2_unittest.cc b/net/websockets/websocket_job_spdy2_unittest.cc index bde8c51..474a338 100644 --- a/net/websockets/websocket_job_spdy2_unittest.cc +++ b/net/websockets/websocket_job_spdy2_unittest.cc @@ -577,7 +577,7 @@ void WebSocketJobSpdy2Test::TestSimpleHandshake() { SkipToConnecting(); DoSendRequest(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), @@ -587,7 +587,7 @@ void WebSocketJobSpdy2Test::TestSimpleHandshake() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithoutCookie, kHandshakeResponseWithoutCookieLength); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); CloseWebSocketJob(); @@ -602,7 +602,7 @@ void WebSocketJobSpdy2Test::TestSlowHandshake() { DoSendRequest(); // We assume request is sent in one data chunk (from WebKit) // We don't support streaming request. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), @@ -617,12 +617,12 @@ void WebSocketJobSpdy2Test::TestSlowHandshake() { websocket_->OnReceivedData(socket_, line.c_str(), line.size()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(delegate.received_data().empty()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); } websocket_->OnReceivedData(socket_.get(), "\r\n", 2); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(delegate.received_data().empty()); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -651,7 +651,7 @@ TEST_F(WebSocketJobSpdy2Test, DelayedCookies) { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithFilteredCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, @@ -662,7 +662,7 @@ TEST_F(WebSocketJobSpdy2Test, DelayedCookies) { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -686,7 +686,7 @@ void WebSocketJobSpdy2Test::TestHandshakeWithCookie() { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithFilteredCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, @@ -697,7 +697,7 @@ void WebSocketJobSpdy2Test::TestHandshakeWithCookie() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -730,7 +730,7 @@ void WebSocketJobSpdy2Test::TestHandshakeWithCookieButNotAllowed() { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, kHandshakeRequestWithoutCookieLength); @@ -740,7 +740,7 @@ void WebSocketJobSpdy2Test::TestHandshakeWithCookieButNotAllowed() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -780,7 +780,7 @@ void WebSocketJobSpdy2Test::TestInvalidSendData() { DoSendRequest(); // We assume request is sent in one data chunk (from WebKit) // We don't support streaming request. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), diff --git a/net/websockets/websocket_job_spdy3_unittest.cc b/net/websockets/websocket_job_spdy3_unittest.cc index 24b69ef..2b22281 100644 --- a/net/websockets/websocket_job_spdy3_unittest.cc +++ b/net/websockets/websocket_job_spdy3_unittest.cc @@ -577,7 +577,7 @@ void WebSocketJobSpdy3Test::TestSimpleHandshake() { SkipToConnecting(); DoSendRequest(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), @@ -587,7 +587,7 @@ void WebSocketJobSpdy3Test::TestSimpleHandshake() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithoutCookie, kHandshakeResponseWithoutCookieLength); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); CloseWebSocketJob(); @@ -602,7 +602,7 @@ void WebSocketJobSpdy3Test::TestSlowHandshake() { DoSendRequest(); // We assume request is sent in one data chunk (from WebKit) // We don't support streaming request. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), @@ -617,12 +617,12 @@ void WebSocketJobSpdy3Test::TestSlowHandshake() { websocket_->OnReceivedData(socket_, line.c_str(), line.size()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(delegate.received_data().empty()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); } websocket_->OnReceivedData(socket_.get(), "\r\n", 2); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(delegate.received_data().empty()); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -651,7 +651,7 @@ TEST_F(WebSocketJobSpdy3Test, DelayedCookies) { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithFilteredCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, @@ -662,7 +662,7 @@ TEST_F(WebSocketJobSpdy3Test, DelayedCookies) { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -686,7 +686,7 @@ void WebSocketJobSpdy3Test::TestHandshakeWithCookie() { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithFilteredCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, @@ -697,7 +697,7 @@ void WebSocketJobSpdy3Test::TestHandshakeWithCookie() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -730,7 +730,7 @@ void WebSocketJobSpdy3Test::TestHandshakeWithCookieButNotAllowed() { bool sent = websocket_->SendData(kHandshakeRequestWithCookie, kHandshakeRequestWithCookieLength); EXPECT_TRUE(sent); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_, kHandshakeRequestWithoutCookieLength); @@ -740,7 +740,7 @@ void WebSocketJobSpdy3Test::TestHandshakeWithCookieButNotAllowed() { websocket_->OnReceivedData(socket_.get(), kHandshakeResponseWithCookie, kHandshakeResponseWithCookieLength); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeResponseWithoutCookie, delegate.received_data()); EXPECT_EQ(WebSocketJob::OPEN, GetWebSocketJobState()); @@ -780,7 +780,7 @@ void WebSocketJobSpdy3Test::TestInvalidSendData() { DoSendRequest(); // We assume request is sent in one data chunk (from WebKit) // We don't support streaming request. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kHandshakeRequestWithoutCookie, sent_data()); EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); websocket_->OnSentData(socket_.get(), diff --git a/net/websockets/websocket_throttle_unittest.cc b/net/websockets/websocket_throttle_unittest.cc index 86b5861..a323734 100644 --- a/net/websockets/websocket_throttle_unittest.cc +++ b/net/websockets/websocket_throttle_unittest.cc @@ -211,7 +211,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { "\r\n" "8jKS'y:G*Co,Wxa-"; w1->OnReceivedData(s1.get(), kHeader2, sizeof(kHeader2) - 1); - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); // Now, w1 is open. EXPECT_EQ(WebSocketJob::OPEN, w1->state()); // So, w2 and w3 can start connecting. w4 needs to wait w2 (1.2.3.4) @@ -226,7 +226,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { // Closing s1 doesn't change waiting queue. DVLOG(1) << "socket1 close"; w1->OnClose(s1.get()); - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); EXPECT_FALSE(callback_s4.have_result()); s1->DetachDelegate(); // Address | head -> tail @@ -239,7 +239,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { // w5 close() closes SocketStream that change state to STATE_CLOSE, calls // DoLoop(), so OnClose() callback will be called. w5->OnClose(s5.get()); - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); EXPECT_FALSE(callback_s4.have_result()); // Address | head -> tail // 1.2.3.4 | w2 w4 @@ -250,7 +250,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { // w6 close abnormally (e.g. renderer finishes) while waiting in queue. DVLOG(1) << "socket6 close abnormally"; w6->DetachDelegate(); - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); EXPECT_FALSE(callback_s4.have_result()); // Address | head -> tail // 1.2.3.4 | w2 w4 @@ -260,7 +260,7 @@ TEST_F(WebSocketThrottleTest, Throttle) { // Closing s2 kicks w4 to start connecting. DVLOG(1) << "socket2 close"; w2->OnClose(s2.get()); - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); EXPECT_TRUE(callback_s4.have_result()); // Address | head -> tail // 1.2.3.4 | w4 @@ -270,12 +270,12 @@ TEST_F(WebSocketThrottleTest, Throttle) { DVLOG(1) << "socket3 close"; w3->OnClose(s3.get()); - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); s3->DetachDelegate(); w4->OnClose(s4.get()); s4->DetachDelegate(); DVLOG(1) << "Done"; - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); } TEST_F(WebSocketThrottleTest, NoThrottleForDuplicateAddress) { @@ -303,7 +303,7 @@ TEST_F(WebSocketThrottleTest, NoThrottleForDuplicateAddress) { w1->OnClose(s1.get()); s1->DetachDelegate(); DVLOG(1) << "Done"; - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); } // A connection should not be blocked by another connection to the same IP @@ -349,7 +349,7 @@ TEST_F(WebSocketThrottleTest, NoThrottleForDistinctPort) { w2->OnClose(s2.get()); s2->DetachDelegate(); DVLOG(1) << "Done"; - MessageLoopForIO::current()->RunUntilIdle(); + base::MessageLoopForIO::current()->RunUntilIdle(); } } |