Index: net/spdy/spdy_session_spdy3_unittest.cc |
diff --git a/net/spdy/spdy_session_spdy3_unittest.cc b/net/spdy/spdy_session_spdy3_unittest.cc |
index 545e36b7c4b1262b2cc56c3d89451e37a33481fe..3c2bce4bbe6de727a128bf3f6af6b1035e2f2419 100644 |
--- a/net/spdy/spdy_session_spdy3_unittest.cc |
+++ b/net/spdy/spdy_session_spdy3_unittest.cc |
@@ -663,6 +663,67 @@ TEST_F(SpdySessionSpdy3Test, CancelPendingCreateStream) { |
MessageLoop::current()->RunAllPending(); |
} |
+TEST_F(SpdySessionSpdy3Test, SendInitialWindowSizeSettingsOnNewSession) { |
+ SpdySessionDependencies session_deps; |
+ session_deps.host_resolver->set_synchronous_mode(true); |
+ |
+ MockRead reads[] = { |
+ MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. |
+ }; |
+ |
+ SettingsMap settings; |
+ const SpdySettingsIds kSpdySettingsIds1 = SETTINGS_INITIAL_WINDOW_SIZE; |
+ const uint32 kInitialRecvWindowSize = 10 * 1024 * 1024; |
+ settings[kSpdySettingsIds1] = |
+ SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kInitialRecvWindowSize); |
+ MockConnect connect_data(SYNCHRONOUS, OK); |
+ scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); |
+ MockWrite writes[] = { |
+ CreateMockWrite(*settings_frame), |
+ }; |
+ SpdySession::set_default_initial_recv_window_size(kInitialRecvWindowSize); |
+ |
+ StaticSocketDataProvider data( |
+ reads, arraysize(reads), writes, arraysize(writes)); |
+ data.set_connect_data(connect_data); |
+ session_deps.socket_factory->AddSocketDataProvider(&data); |
+ |
+ SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
+ session_deps.socket_factory->AddSSLSocketDataProvider(&ssl); |
+ |
+ scoped_refptr<HttpNetworkSession> http_session( |
+ SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
+ |
+ static const char kStreamUrl[] = "http://www.google.com/"; |
+ GURL url(kStreamUrl); |
+ |
+ const std::string kTestHost("www.google.com"); |
+ const int kTestPort = 80; |
+ HostPortPair test_host_port_pair(kTestHost, kTestPort); |
+ HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct()); |
+ |
+ SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
+ EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
+ scoped_refptr<SpdySession> session = |
+ spdy_session_pool->Get(pair, BoundNetLog()); |
+ EXPECT_TRUE(spdy_session_pool->HasSession(pair)); |
+ |
+ scoped_refptr<TransportSocketParams> transport_params( |
+ new TransportSocketParams(test_host_port_pair, |
+ MEDIUM, |
+ false, |
+ false)); |
+ scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
+ EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), |
+ transport_params, MEDIUM, CompletionCallback(), |
+ http_session->GetTransportSocketPool( |
+ HttpNetworkSession::NORMAL_SOCKET_POOL), |
+ BoundNetLog())); |
+ EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
+ MessageLoop::current()->RunAllPending(); |
+ EXPECT_TRUE(data.at_write_eof()); |
+} |
+ |
TEST_F(SpdySessionSpdy3Test, SendSettingsOnNewSession) { |
SpdySessionDependencies session_deps; |
session_deps.host_resolver->set_synchronous_mode(true); |