diff options
-rw-r--r-- | net/data/valgrind/net_unittests.gtest.txt | 3 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base_unittest.cc | 24 |
2 files changed, 14 insertions, 13 deletions
diff --git a/net/data/valgrind/net_unittests.gtest.txt b/net/data/valgrind/net_unittests.gtest.txt index 70b04b7..681e60c 100644 --- a/net/data/valgrind/net_unittests.gtest.txt +++ b/net/data/valgrind/net_unittests.gtest.txt @@ -3,6 +3,3 @@ KeygenHandlerTest.*SmokeTest # Fails Valgrind with varying stack traces. http://crbug.com/43179 SpdyNetworkTransactionTest.PostWithEarlySynReply - -# See http://crbug.com/46638 -ClientSocketPoolBaseTest.LoadState diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 3cd90d14..286949a 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -214,17 +214,21 @@ class TestConnectJob : public ConnectJob { return result; } + // This function helps simulate the progress of load states on a ConnectJob. + // Each time it is called it advances the load state and posts a task to be + // called again. It stops at the last connecting load state (the one + // before LOAD_STATE_SENDING_REQUEST). void AdvanceLoadState(LoadState state) { int tmp = state; tmp++; - state = static_cast<LoadState>(tmp); - set_load_state(state); - // Post a delayed task so RunAllPending() won't run it. - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - method_factory_.NewRunnableMethod(&TestConnectJob::AdvanceLoadState, - state), - 1 /* 1ms delay */); + if (tmp < LOAD_STATE_SENDING_REQUEST) { + state = static_cast<LoadState>(tmp); + set_load_state(state); + MessageLoop::current()->PostTask( + FROM_HERE, + method_factory_.NewRunnableMethod(&TestConnectJob::AdvanceLoadState, + state)); + } } bool waiting_success_; @@ -1488,8 +1492,8 @@ TEST_F(ClientSocketPoolBaseTest, LoadState) { rv = InitHandle(req2.handle(), "a", kDefaultPriority, &req2, pool_, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, req1.handle()->GetLoadState()); - EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, req2.handle()->GetLoadState()); + EXPECT_NE(LOAD_STATE_IDLE, req1.handle()->GetLoadState()); + EXPECT_NE(LOAD_STATE_IDLE, req2.handle()->GetLoadState()); } TEST_F(ClientSocketPoolBaseTest, CleanupTimedOutIdleSockets) { |