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

Unified Diff: net/spdy/spdy_session_pool_unittest.cc

Issue 328823003: Ensure SpdySession::StartGoingAway is always called with an error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extraneous StartGoingAway Created 6 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
« no previous file with comments | « net/spdy/spdy_session_pool.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_pool_unittest.cc
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc
index e78a3da93ce20a3ad38be13a498bd83408397ae3..16a624b1ad00bc0f03677892a052982656b4955a 100644
--- a/net/spdy/spdy_session_pool_unittest.cc
+++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -537,6 +537,7 @@ TEST_P(SpdySessionPoolTest, IPAddressChanged) {
test_host_port_pairA, ProxyServer::Direct(), PRIVACY_MODE_DISABLED);
base::WeakPtr<SpdySession> sessionA =
CreateInsecureSpdySession(http_session_, keyA, BoundNetLog());
+
GURL urlA(kTestHostA);
base::WeakPtr<SpdyStream> spdy_streamA = CreateStreamSynchronously(
SPDY_BIDIRECTIONAL_STREAM, sessionA, urlA, MEDIUM, BoundNetLog());
@@ -555,7 +556,7 @@ TEST_P(SpdySessionPoolTest, IPAddressChanged) {
EXPECT_TRUE(sessionA->IsGoingAway());
EXPECT_FALSE(delegateA.StreamIsClosed());
- // Set up session B: Available, but idle.
+ // Set up session B: Available, with a created stream.
const std::string kTestHostB("http://www.b.com");
HostPortPair test_host_port_pairB(kTestHostB, 80);
SpdySessionKey keyB(
@@ -564,6 +565,12 @@ TEST_P(SpdySessionPoolTest, IPAddressChanged) {
CreateInsecureSpdySession(http_session_, keyB, BoundNetLog());
EXPECT_TRUE(sessionB->IsAvailable());
+ GURL urlB(kTestHostB);
+ base::WeakPtr<SpdyStream> spdy_streamB = CreateStreamSynchronously(
+ SPDY_BIDIRECTIONAL_STREAM, sessionB, urlB, MEDIUM, BoundNetLog());
+ test::StreamDelegateDoNothing delegateB(spdy_streamB);
+ spdy_streamB->SetDelegate(&delegateB);
+
// Set up session C: Draining.
session_deps_.socket_factory->AddSocketDataProvider(&data);
const std::string kTestHostC("http://www.c.com");
@@ -583,9 +590,13 @@ TEST_P(SpdySessionPoolTest, IPAddressChanged) {
EXPECT_TRUE(sessionB->IsDraining());
EXPECT_TRUE(sessionC->IsDraining());
- EXPECT_EQ(1u, sessionA->num_active_streams()); // Stream is still active.
+ EXPECT_EQ(1u,
+ sessionA->num_active_streams()); // Active stream is still active.
EXPECT_FALSE(delegateA.StreamIsClosed());
+ EXPECT_TRUE(delegateB.StreamIsClosed()); // Created stream was closed.
+ EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose());
+
sessionA->CloseSessionOnError(ERR_ABORTED, "Closing");
sessionB->CloseSessionOnError(ERR_ABORTED, "Closing");
@@ -596,8 +607,11 @@ TEST_P(SpdySessionPoolTest, IPAddressChanged) {
EXPECT_TRUE(sessionB->IsDraining());
EXPECT_TRUE(sessionC->IsDraining());
+ // Both streams were closed with an error.
EXPECT_TRUE(delegateA.StreamIsClosed());
EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose());
+ EXPECT_TRUE(delegateB.StreamIsClosed());
+ EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose());
#endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
}
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698