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

Unified Diff: net/spdy/spdy_session_unittest.cc

Issue 18796003: When an idle socket is added back to a socket pool, check for stalled jobs in lower pools (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Response to comments Created 7 years, 4 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
« net/spdy/spdy_session.cc ('K') | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session_unittest.cc
===================================================================
--- net/spdy/spdy_session_unittest.cc (revision 218769)
+++ net/spdy/spdy_session_unittest.cc (working copy)
@@ -2854,9 +2854,9 @@
EXPECT_TRUE(session2 == NULL);
}
-// Tests that a non-SPDY request can't close a SPDY session that's currently in
-// use.
-TEST_P(SpdySessionTest, CloseOneIdleConnectionFailsWhenSessionInUse) {
+// Tests that when a SPDY session becomes idle, it closes itself if there is
+// a lower layer pool stalled on the per-pool socket limit.
+TEST_P(SpdySessionTest, CloseSessionOnIdleWhenPoolStalled) {
ClientSocketPoolManager::set_max_sockets_per_group(
HttpNetworkSession::NORMAL_SOCKET_POOL, 1);
ClientSocketPoolManager::set_max_sockets_per_pool(
@@ -2875,10 +2875,19 @@
CreateMockWrite(*cancel1, 1),
};
StaticSocketDataProvider data(reads, arraysize(reads),
- writes, arraysize(writes));
+ writes, arraysize(writes));
data.set_connect_data(connect_data);
session_deps_.socket_factory->AddSocketDataProvider(&data);
+ MockRead http_reads[] = {
+ MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
+ };
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
+ NULL, 0);
+ http_data.set_connect_data(connect_data);
+ session_deps_.socket_factory->AddSocketDataProvider(&http_data);
+
+
CreateNetworkSession();
TransportClientSocketPool* pool =
@@ -2933,14 +2942,13 @@
EXPECT_TRUE(pool->IsStalled());
EXPECT_FALSE(callback2.have_result());
- // Cancelling the request should still not release the session's socket,
- // since the session is still kept alive by the SpdySessionPool.
+ // Cancelling the request should result in the session's socket being
+ // closed, since the pool is stalled.
ASSERT_TRUE(spdy_stream1.get());
spdy_stream1->Cancel();
base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(pool->IsStalled());
- EXPECT_FALSE(callback2.have_result());
- EXPECT_TRUE(session1 != NULL);
+ ASSERT_FALSE(pool->IsStalled());
+ EXPECT_EQ(OK, callback2.WaitForResult());
}
// Verify that SpdySessionKey and therefore SpdySession is different when
« net/spdy/spdy_session.cc ('K') | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698