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

Unified Diff: net/spdy/spdy_session_spdy3_unittest.cc

Issue 10448083: Fix out of order SYN_STEAM frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add copy constructor to fix win build Created 8 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_spdy2_unittest.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_spdy3_unittest.cc
diff --git a/net/spdy/spdy_session_spdy3_unittest.cc b/net/spdy/spdy_session_spdy3_unittest.cc
index 3b8a10fb22baf835adab9221cdb1562a6f380a34..cb350323366a60c79d433a597a31026e3bfc4a28 100644
--- a/net/spdy/spdy_session_spdy3_unittest.cc
+++ b/net/spdy/spdy_session_spdy3_unittest.cc
@@ -330,7 +330,7 @@ TEST_F(SpdySessionSpdy3Test, FailedPing) {
// Assert session is not closed.
EXPECT_FALSE(session->IsClosed());
- EXPECT_LT(0u, session->num_active_streams());
+ EXPECT_LT(0u, session->num_active_streams() + session->num_created_streams());
EXPECT_TRUE(spdy_session_pool->HasSession(pair));
// We set last time we have received any data in 1 sec less than now.
@@ -450,8 +450,8 @@ TEST_F(SpdySessionSpdy3Test, CloseIdleSessions) {
// Make sessions 1 and 3 inactive, but keep them open.
// Session 2 still open and active
- session1->CloseStream(spdy_stream1->stream_id(), OK);
- session3->CloseStream(spdy_stream3->stream_id(), OK);
+ session1->CloseCreatedStream(spdy_stream1, OK);
+ session3->CloseCreatedStream(spdy_stream3, OK);
EXPECT_FALSE(session1->is_active());
EXPECT_FALSE(session1->IsClosed());
EXPECT_TRUE(session2->is_active());
@@ -474,7 +474,7 @@ TEST_F(SpdySessionSpdy3Test, CloseIdleSessions) {
EXPECT_FALSE(session2->IsClosed());
// Make 2 not active
- session2->CloseStream(spdy_stream2->stream_id(), OK);
+ session2->CloseCreatedStream(spdy_stream2, OK);
EXPECT_FALSE(session2->is_active());
EXPECT_FALSE(session2->IsClosed());
@@ -1193,22 +1193,24 @@ TEST_F(SpdySessionSpdy3Test, UpdateStreamsSendWindowSize) {
MockConnect connect_data(SYNCHRONOUS, OK);
scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(new_settings));
MockRead reads[] = {
- CreateMockRead(*settings_frame),
- MockRead(SYNCHRONOUS, 0, 0) // EOF
+ CreateMockRead(*settings_frame, 0),
+ MockRead(ASYNC, 0, 2) // EOF
};
SpdySessionDependencies session_deps;
+
session_deps.host_resolver->set_synchronous_mode(true);
- StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0);
- data.set_connect_data(connect_data);
- session_deps.socket_factory->AddSocketDataProvider(&data);
+ scoped_refptr<DeterministicSocketData> data =
+ new DeterministicSocketData(reads, arraysize(reads), NULL, 0);
+ data->set_connect_data(connect_data);
+ session_deps.deterministic_socket_factory->AddSocketDataProvider(data);
SSLSocketDataProvider ssl(SYNCHRONOUS, OK);
session_deps.socket_factory->AddSSLSocketDataProvider(&ssl);
scoped_refptr<HttpNetworkSession> http_session(
- SpdySessionDependencies::SpdyCreateSession(&session_deps));
+ SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps));
const std::string kTestHost("www.foo.com");
const int kTestPort = 80;
@@ -1248,6 +1250,7 @@ TEST_F(SpdySessionSpdy3Test, UpdateStreamsSendWindowSize) {
callback1.callback()));
EXPECT_NE(spdy_stream1->send_window_size(), window_size);
+ data->RunFor(1); // Process the SETTINGS frame, but not the EOF
MessageLoop::current()->RunAllPending();
EXPECT_EQ(session->initial_send_window_size(), window_size);
EXPECT_EQ(spdy_stream1->send_window_size(), window_size);
@@ -1272,8 +1275,8 @@ TEST_F(SpdySessionSpdy3Test, UpdateStreamsSendWindowSize) {
TEST_F(SpdySessionSpdy3Test, OutOfOrderSynStreams) {
// Construct the request.
MockConnect connect_data(SYNCHRONOUS, OK);
- scoped_ptr<SpdyFrame> req1(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
- scoped_ptr<SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, HIGHEST));
+ scoped_ptr<SpdyFrame> req1(ConstructSpdyGet(NULL, 0, false, 1, HIGHEST));
+ scoped_ptr<SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST));
MockWrite writes[] = {
CreateMockWrite(*req1, 2),
CreateMockWrite(*req2, 1),
@@ -1337,14 +1340,14 @@ TEST_F(SpdySessionSpdy3Test, OutOfOrderSynStreams) {
GURL url1("http://www.google.com");
EXPECT_EQ(OK, session->CreateStream(url1, LOWEST, &spdy_stream1,
BoundNetLog(), callback1.callback()));
- EXPECT_EQ(1u, spdy_stream1->stream_id());
+ EXPECT_EQ(0u, spdy_stream1->stream_id());
scoped_refptr<SpdyStream> spdy_stream2;
TestCompletionCallback callback2;
GURL url2("http://www.google.com");
EXPECT_EQ(OK, session->CreateStream(url2, HIGHEST, &spdy_stream2,
BoundNetLog(), callback2.callback()));
- EXPECT_EQ(3u, spdy_stream2->stream_id());
+ EXPECT_EQ(0u, spdy_stream2->stream_id());
linked_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock);
(*headers)[":method"] = "GET";
@@ -1362,8 +1365,8 @@ TEST_F(SpdySessionSpdy3Test, OutOfOrderSynStreams) {
spdy_stream2->SendRequest(false);
MessageLoop::current()->RunAllPending();
- EXPECT_EQ(1u, spdy_stream1->stream_id());
- EXPECT_EQ(3u, spdy_stream2->stream_id());
+ EXPECT_EQ(3u, spdy_stream1->stream_id());
+ EXPECT_EQ(1u, spdy_stream2->stream_id());
spdy_stream1->Cancel();
spdy_stream1 = NULL;
« no previous file with comments | « net/spdy/spdy_session_spdy2_unittest.cc ('k') | net/spdy/spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698