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

Unified Diff: net/spdy/spdy_test_util_common.cc

Issue 200723004: Fix SPDY error-handling if the connection gets closed just after use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_test_util_common.cc
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc
index 66a6f8c3fdaede3222b5f7df21daf3fb727a61dc..22ff5f6f092679836856c3b3c40ee7b4981dfe64 100644
--- a/net/spdy/spdy_test_util_common.cc
+++ b/net/spdy/spdy_test_util_common.cc
@@ -540,15 +540,12 @@ base::WeakPtr<SpdySession> CreateSpdySessionHelper(
EXPECT_EQ(OK, rv);
- base::WeakPtr<SpdySession> spdy_session;
- EXPECT_EQ(
- expected_status,
+ base::WeakPtr<SpdySession> spdy_session =
http_session->spdy_session_pool()->CreateAvailableSessionFromSocket(
- key, connection.Pass(), net_log, OK, &spdy_session,
- is_secure));
- EXPECT_EQ(expected_status == OK, spdy_session != NULL);
- EXPECT_EQ(expected_status == OK,
- HasSpdySession(http_session->spdy_session_pool(), key));
+ key, connection.Pass(), net_log, OK, is_secure);
+ // Failure is reported asynchronously.
+ EXPECT_TRUE(spdy_session != NULL);
+ EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key));
return spdy_session;
}
@@ -562,14 +559,14 @@ base::WeakPtr<SpdySession> CreateInsecureSpdySession(
OK, false /* is_secure */);
}
-void TryCreateInsecureSpdySessionExpectingFailure(
+base::WeakPtr<SpdySession> TryCreateInsecureSpdySessionExpectingFailure(
const scoped_refptr<HttpNetworkSession>& http_session,
const SpdySessionKey& key,
Error expected_error,
const BoundNetLog& net_log) {
DCHECK_LT(expected_error, ERR_IO_PENDING);
- CreateSpdySessionHelper(http_session, key, net_log,
- expected_error, false /* is_secure */);
+ return CreateSpdySessionHelper(http_session, key, net_log,
+ expected_error, false /* is_secure */);
}
base::WeakPtr<SpdySession> CreateSecureSpdySession(
@@ -643,17 +640,15 @@ base::WeakPtr<SpdySession> CreateFakeSpdySessionHelper(
Error expected_status) {
EXPECT_NE(expected_status, ERR_IO_PENDING);
EXPECT_FALSE(HasSpdySession(pool, key));
- base::WeakPtr<SpdySession> spdy_session;
scoped_ptr<ClientSocketHandle> handle(new ClientSocketHandle());
handle->SetSocket(scoped_ptr<StreamSocket>(new FakeSpdySessionClientSocket(
expected_status == OK ? ERR_IO_PENDING : expected_status)));
- EXPECT_EQ(
- expected_status,
+ base::WeakPtr<SpdySession> spdy_session =
pool->CreateAvailableSessionFromSocket(
- key, handle.Pass(), BoundNetLog(), OK, &spdy_session,
- true /* is_secure */));
- EXPECT_EQ(expected_status == OK, spdy_session != NULL);
- EXPECT_EQ(expected_status == OK, HasSpdySession(pool, key));
+ key, handle.Pass(), BoundNetLog(), OK, true /* is_secure */);
+ // Failure is reported asynchronously.
+ EXPECT_TRUE(spdy_session != NULL);
+ EXPECT_TRUE(HasSpdySession(pool, key));
return spdy_session;
}
@@ -664,11 +659,12 @@ base::WeakPtr<SpdySession> CreateFakeSpdySession(SpdySessionPool* pool,
return CreateFakeSpdySessionHelper(pool, key, OK);
}
-void TryCreateFakeSpdySessionExpectingFailure(SpdySessionPool* pool,
- const SpdySessionKey& key,
- Error expected_error) {
+base::WeakPtr<SpdySession> TryCreateFakeSpdySessionExpectingFailure(
+ SpdySessionPool* pool,
+ const SpdySessionKey& key,
+ Error expected_error) {
DCHECK_LT(expected_error, ERR_IO_PENDING);
- CreateFakeSpdySessionHelper(pool, key, expected_error);
+ return CreateFakeSpdySessionHelper(pool, key, expected_error);
}
SpdySessionPoolPeer::SpdySessionPoolPeer(SpdySessionPool* pool) : pool_(pool) {
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698