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

Unified Diff: net/spdy/spdy_session_unittest.cc

Issue 3020032: Implement server push protocol 2. (Closed)
Patch Set: nits. Created 10 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
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session_unittest.cc
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index e78f0d90d947f1d77263c7236a3545db729fb1df..b3659e7fa056789b10f5e8f468d5ef1c0adce80e 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -111,82 +111,4 @@ TEST_F(SpdySessionTest, GoAway) {
}
} // namespace
-
-TEST_F(SpdySessionTest, GetActivePushStream) {
- spdy::SpdyFramer framer;
- SpdySessionTest::TurnOffCompression();
-
- SpdySessionDependencies session_deps;
- session_deps.host_resolver->set_synchronous_mode(true);
-
- MockConnect connect_data(false, OK);
- spdy::SpdyHeaderBlock headers;
- headers["path"] = "/foo.js";
- headers["status"] = "200";
- headers["version"] = "HTTP/1.1";
- scoped_ptr<spdy::SpdyFrame> push_syn(framer.CreateSynStream(
- 2, 1, 0, spdy::CONTROL_FLAG_NONE, false, &headers));
- MockRead reads[] = {
- CreateMockRead(*push_syn),
- MockRead(true, ERR_IO_PENDING, 0) // EOF
- };
- StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0);
- data.set_connect_data(connect_data);
- session_deps.socket_factory.AddSocketDataProvider(&data);
-
- SSLSocketDataProvider ssl(false, OK);
- session_deps.socket_factory.AddSSLSocketDataProvider(&ssl);
-
- scoped_refptr<HttpNetworkSession> http_session(
- SpdySessionDependencies::SpdyCreateSession(&session_deps));
-
- const std::string kTestHost("www.foo.com");
- const int kTestPort = 80;
- HostPortPair test_host_port_pair(kTestHost, kTestPort);
- HostPortProxyPair pair(test_host_port_pair, "");
-
- scoped_refptr<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, http_session.get(), BoundNetLog());
- EXPECT_TRUE(spdy_session_pool->HasSession(pair));
-
- // No push streams should exist in the beginning.
- std::string test_push_path = "/foo.js";
- scoped_refptr<SpdyStream> first_stream = session->GetActivePushStream(
- test_push_path);
- EXPECT_EQ(static_cast<SpdyStream*>(NULL), first_stream.get());
-
- // Read in the data which contains a server-issued SYN_STREAM.
- scoped_refptr<TCPSocketParams> tcp_params =
- new TCPSocketParams(test_host_port_pair, MEDIUM, GURL(), false);
- int rv = session->Connect(kTestHost, tcp_params, MEDIUM);
- ASSERT_EQ(OK, rv);
- MessageLoop::current()->RunAllPending();
-
- // An unpushed path should not work.
- scoped_refptr<SpdyStream> unpushed_stream = session->GetActivePushStream(
- "/unpushed_path");
- EXPECT_EQ(static_cast<SpdyStream*>(NULL), unpushed_stream.get());
-
- // The pushed path should be found.
- scoped_refptr<SpdyStream> second_stream = session->GetActivePushStream(
- test_push_path);
- ASSERT_NE(static_cast<SpdyStream*>(NULL), second_stream.get());
- EXPECT_EQ(test_push_path, second_stream->path());
- EXPECT_EQ(2U, second_stream->stream_id());
- EXPECT_EQ(0, second_stream->priority());
-
- // Clean up
- second_stream = NULL;
- session = NULL;
- spdy_session_pool->CloseAllSessions();
-
- // RunAllPending needs to be called here because the
- // ClientSocketPoolBase posts a task to clean up and destroy the
- // underlying socket.
- MessageLoop::current()->RunAllPending();
-}
-
} // namespace net
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698