Skip to content

Commit

Permalink
fix loop
Browse files Browse the repository at this point in the history
fix

remove

rename

fix yielding

add another expected

add expected

rem another

remove dcheck

rewrite state machine

rem unused

rem startread loop

read loop

fix test

use read

fix test

fix test

fix another staet

fix test

rem bool

initial write loop

fix var

bail out if closed

rem dcheck

fix onreadcomplete

fix loop

check state

remove availability state

clean up states

remove unused states

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210694 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
akalin@chromium.org committed Jul 10, 2013
1 parent 507b7e2 commit 82c4d3b
Show file tree
Hide file tree
Showing 7 changed files with 308 additions and 255 deletions.
24 changes: 12 additions & 12 deletions net/spdy/spdy_http_stream_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,6 @@ TEST_P(SpdyHttpStreamTest, LoadTimingTwoRequests) {
scoped_ptr<SpdyHttpStream> http_stream1(
new SpdyHttpStream(session_.get(), true));

ASSERT_EQ(OK,
http_stream1->InitializeStream(&request1, DEFAULT_PRIORITY,
BoundNetLog(),
CompletionCallback()));
EXPECT_EQ(ERR_IO_PENDING, http_stream1->SendRequest(headers1, &response1,
callback1.callback()));
EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key));

HttpRequestInfo request2;
request2.method = "GET";
request2.url = GURL("http://www.google.com/");
Expand All @@ -271,15 +263,15 @@ TEST_P(SpdyHttpStreamTest, LoadTimingTwoRequests) {
scoped_ptr<SpdyHttpStream> http_stream2(
new SpdyHttpStream(session_.get(), true));

// First write.
ASSERT_EQ(OK,
http_stream2->InitializeStream(&request2, DEFAULT_PRIORITY,
http_stream1->InitializeStream(&request1, DEFAULT_PRIORITY,
BoundNetLog(),
CompletionCallback()));
EXPECT_EQ(ERR_IO_PENDING, http_stream2->SendRequest(headers2, &response2,
callback2.callback()));
EXPECT_EQ(ERR_IO_PENDING, http_stream1->SendRequest(headers1, &response1,
callback1.callback()));
EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key));

// First write.
deterministic_data()->RunFor(1);
EXPECT_LE(0, callback1.WaitForResult());

Expand All @@ -290,6 +282,14 @@ TEST_P(SpdyHttpStreamTest, LoadTimingTwoRequests) {
EXPECT_FALSE(http_stream2->GetLoadTimingInfo(&load_timing_info2));

// Second write.
ASSERT_EQ(OK,
http_stream2->InitializeStream(&request2, DEFAULT_PRIORITY,
BoundNetLog(),
CompletionCallback()));
EXPECT_EQ(ERR_IO_PENDING, http_stream2->SendRequest(headers2, &response2,
callback2.callback()));
EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key));

deterministic_data()->RunFor(1);
EXPECT_LE(0, callback2.WaitForResult());
TestLoadTimingReused(*http_stream2);
Expand Down
14 changes: 10 additions & 4 deletions net/spdy/spdy_network_transaction_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2014,19 +2014,21 @@ TEST_P(SpdyNetworkTransactionTest, PostWithEarlySynReply) {

scoped_ptr<SpdyFrame> stream_reply(
spdy_util_.ConstructSpdyPostSynReply(NULL, 0));
scoped_ptr<SpdyFrame> stream_body(spdy_util_.ConstructSpdyBodyFrame(1, true));
MockRead reads[] = {
CreateMockRead(*stream_reply, 1),
MockRead(ASYNC, 0, 3) // EOF
MockRead(ASYNC, 0, 4) // EOF
};

scoped_ptr<SpdyFrame> req(
spdy_util_.ConstructSpdyPost(
kRequestUrl, 1, kUploadDataSize, LOWEST, NULL, 0));
scoped_ptr<SpdyFrame> body(spdy_util_.ConstructSpdyBodyFrame(1, true));
scoped_ptr<SpdyFrame> rst(
spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR));
MockWrite writes[] = {
CreateMockWrite(*req, 0),
CreateMockWrite(*body, 2),
CreateMockWrite(*rst, 3)
};

DeterministicSocketData data(reads, arraysize(reads),
Expand All @@ -2043,7 +2045,7 @@ TEST_P(SpdyNetworkTransactionTest, PostWithEarlySynReply) {
&CreatePostRequest(), callback.callback(), BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);

data.RunFor(2);
data.RunFor(4);
rv = callback.WaitForResult();
EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, rv);
data.RunFor(1);
Expand Down Expand Up @@ -3529,7 +3531,11 @@ TEST_P(SpdyNetworkTransactionTest, CorruptFrameSessionError) {
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
scoped_ptr<SpdyFrame> req(
spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true));
MockWrite writes[] = { CreateMockWrite(*req), MockWrite(ASYNC, 0, 0) // EOF
scoped_ptr<SpdyFrame> rst(
spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR));
MockWrite writes[] = {
CreateMockWrite(*req),
CreateMockWrite(*rst),
};

scoped_ptr<SpdyFrame> body(spdy_util_.ConstructSpdyBodyFrame(1, true));
Expand Down
Loading

0 comments on commit 82c4d3b

Please sign in to comment.