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

Unified Diff: net/socket/transport_client_socket_pool_unittest.cc

Issue 2053133002: Remove MessageLoop::current()->RunUntilIdle() in net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/socket/transport_client_socket_pool_unittest.cc
diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc
index e3852486c574bbd9a781c8cb5c18374f7ff1c578..ddfe941e6c8ba8945cff8e0f31ab3a7c69d5cab2 100644
--- a/net/socket/transport_client_socket_pool_unittest.cc
+++ b/net/socket/transport_client_socket_pool_unittest.cc
@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "base/threading/platform_thread.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
@@ -499,7 +500,7 @@ class RequestSocketCallback : public TestCompletionCallbackBase {
{
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
within_callback_ = true;
scoped_refptr<TransportSocketParams> dest(new TransportSocketParams(
@@ -604,7 +605,7 @@ TEST_F(TransportClientSocketPoolTest, IdleSocketLoadTiming) {
handle.Reset();
// Need to run all pending to release the socket back to the pool.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Now we should have 1 idle socket.
EXPECT_EQ(1, pool_.IdleSocketCount());
@@ -633,14 +634,14 @@ TEST_F(TransportClientSocketPoolTest, ResetIdleSocketsOnIPAddressChange) {
handle.Reset();
// Need to run all pending to release the socket back to the pool.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().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();
- base::MessageLoop::current()->RunUntilIdle(); // Notification happens async.
+ base::RunLoop().RunUntilIdle(); // Notification happens async.
EXPECT_EQ(0, pool_.IdleSocketCount());
}
@@ -684,14 +685,14 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketConnect) {
EXPECT_FALSE(handle.socket());
// Create the first socket, set the timer.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Wait for the backup socket timer to fire.
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
ClientSocketPool::kMaxConnectRetryIntervalMs + 50));
// Let the appropriate socket connect.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(OK, callback.WaitForResult());
EXPECT_TRUE(handle.is_initialized());
@@ -727,7 +728,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) {
EXPECT_FALSE(handle.socket());
// Create the first socket, set the timer.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
if (index == CANCEL_AFTER_WAIT) {
// Wait for the backup socket timer to fire.
@@ -736,7 +737,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) {
}
// Let the appropriate socket connect.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
handle.Reset();
@@ -774,7 +775,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterStall) {
EXPECT_FALSE(handle.socket());
// Create the first socket, set the timer.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Wait for the backup socket timer to fire.
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
@@ -785,7 +786,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterStall) {
host_resolver_->set_synchronous_mode(true);
// Let the appropriate socket connect.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult());
EXPECT_FALSE(handle.is_initialized());
@@ -825,7 +826,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterDelay) {
EXPECT_FALSE(handle.socket());
// Create the first socket, set the timer.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Wait for the backup socket timer to fire.
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
@@ -836,7 +837,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterDelay) {
host_resolver_->set_synchronous_mode(true);
// Let the appropriate socket connect.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult());
EXPECT_FALSE(handle.is_initialized());
« no previous file with comments | « net/socket/socks_client_socket_pool_unittest.cc ('k') | net/spdy/bidirectional_stream_spdy_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698