summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 01:07:56 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 01:07:56 +0000
commitcfa8228c292f94603173a15317118fabe8502143 (patch)
treeea76da232ee94c4a413dbaee1a22e04ef2f8160e /net
parentf70cae4cee5dfad1aa538c7e63e0761008b3fef6 (diff)
downloadchromium_src-cfa8228c292f94603173a15317118fabe8502143.zip
chromium_src-cfa8228c292f94603173a15317118fabe8502143.tar.gz
chromium_src-cfa8228c292f94603173a15317118fabe8502143.tar.bz2
Fix TestConnectJob::kMockAdvancingLoadStateJob to be less flaky.
TEST=none BUG=46638 Review URL: http://codereview.chromium.org/2864005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/data/valgrind/net_unittests.gtest.txt3
-rw-r--r--net/socket/client_socket_pool_base_unittest.cc24
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) {