| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/quic_spdy_stream.h" | 5 #include "net/quic/quic_spdy_stream.h" |
| 6 | 6 |
| 7 #include "net/quic/quic_connection.h" | 7 #include "net/quic/quic_connection.h" |
| 8 #include "net/quic/quic_utils.h" | 8 #include "net/quic/quic_utils.h" |
| 9 #include "net/quic/quic_write_blocked_list.h" | 9 #include "net/quic/quic_write_blocked_list.h" |
| 10 #include "net/quic/spdy_utils.h" | 10 #include "net/quic/spdy_utils.h" |
| 11 #include "net/quic/test_tools/quic_flow_controller_peer.h" | 11 #include "net/quic/test_tools/quic_flow_controller_peer.h" |
| 12 #include "net/quic/test_tools/quic_session_peer.h" | 12 #include "net/quic/test_tools/quic_session_peer.h" |
| 13 #include "net/quic/test_tools/quic_test_utils.h" | 13 #include "net/quic/test_tools/quic_test_utils.h" |
| 14 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 14 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
| 15 #include "net/test/gtest_util.h" | 15 #include "net/test/gtest_util.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 | 17 |
| 18 using base::StringPiece; | 18 using base::StringPiece; |
| 19 using std::min; | 19 using std::min; |
| 20 using std::string; | 20 using std::string; |
| 21 using net::kHighestPriority; |
| 22 using net::SpdyHeaderBlock; |
| 21 using testing::Return; | 23 using testing::Return; |
| 22 using testing::StrictMock; | 24 using testing::StrictMock; |
| 23 using testing::_; | 25 using testing::_; |
| 24 | 26 |
| 25 namespace net { | 27 namespace net { |
| 26 namespace test { | 28 namespace test { |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 const bool kShouldProcessData = true; | 31 const bool kShouldProcessData = true; |
| 30 | 32 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 INSTANTIATE_TEST_CASE_P(Tests, | 117 INSTANTIATE_TEST_CASE_P(Tests, |
| 116 QuicSpdyStreamTest, | 118 QuicSpdyStreamTest, |
| 117 ::testing::ValuesIn(QuicSupportedVersions())); | 119 ::testing::ValuesIn(QuicSupportedVersions())); |
| 118 | 120 |
| 119 TEST_P(QuicSpdyStreamTest, ProcessHeaders) { | 121 TEST_P(QuicSpdyStreamTest, ProcessHeaders) { |
| 120 Initialize(kShouldProcessData); | 122 Initialize(kShouldProcessData); |
| 121 | 123 |
| 122 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); | 124 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); |
| 123 stream_->OnStreamHeadersPriority(QuicUtils::HighestPriority()); | 125 stream_->OnStreamHeadersPriority(net::kHighestPriority); |
| 124 stream_->OnStreamHeaders(headers); | 126 stream_->OnStreamHeaders(headers); |
| 125 EXPECT_EQ("", stream_->data()); | 127 EXPECT_EQ("", stream_->data()); |
| 126 EXPECT_EQ(headers, stream_->decompressed_headers()); | 128 EXPECT_EQ(headers, stream_->decompressed_headers()); |
| 127 stream_->OnStreamHeadersComplete(false, headers.size()); | 129 stream_->OnStreamHeadersComplete(false, headers.size()); |
| 128 EXPECT_EQ(QuicUtils::HighestPriority(), stream_->Priority()); | 130 EXPECT_EQ(net::kHighestPriority, stream_->Priority()); |
| 131 EXPECT_EQ(net::kHighestPriority, stream_->Priority()); |
| 129 EXPECT_EQ("", stream_->data()); | 132 EXPECT_EQ("", stream_->data()); |
| 130 EXPECT_EQ(headers, stream_->decompressed_headers()); | 133 EXPECT_EQ(headers, stream_->decompressed_headers()); |
| 131 EXPECT_FALSE(stream_->IsDoneReading()); | 134 EXPECT_FALSE(stream_->IsDoneReading()); |
| 132 } | 135 } |
| 133 | 136 |
| 134 TEST_P(QuicSpdyStreamTest, ProcessHeadersWithFin) { | 137 TEST_P(QuicSpdyStreamTest, ProcessHeadersWithFin) { |
| 135 Initialize(kShouldProcessData); | 138 Initialize(kShouldProcessData); |
| 136 | 139 |
| 137 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); | 140 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); |
| 138 stream_->OnStreamHeadersPriority(QuicUtils::HighestPriority()); | 141 stream_->OnStreamHeadersPriority(net::kHighestPriority); |
| 139 stream_->OnStreamHeaders(headers); | 142 stream_->OnStreamHeaders(headers); |
| 140 EXPECT_EQ("", stream_->data()); | 143 EXPECT_EQ("", stream_->data()); |
| 141 EXPECT_EQ(headers, stream_->decompressed_headers()); | 144 EXPECT_EQ(headers, stream_->decompressed_headers()); |
| 142 stream_->OnStreamHeadersComplete(true, headers.size()); | 145 stream_->OnStreamHeadersComplete(true, headers.size()); |
| 143 EXPECT_EQ(QuicUtils::HighestPriority(), stream_->Priority()); | 146 EXPECT_EQ(net::kHighestPriority, stream_->Priority()); |
| 147 EXPECT_EQ(net::kHighestPriority, stream_->Priority()); |
| 144 EXPECT_EQ("", stream_->data()); | 148 EXPECT_EQ("", stream_->data()); |
| 145 EXPECT_EQ(headers, stream_->decompressed_headers()); | 149 EXPECT_EQ(headers, stream_->decompressed_headers()); |
| 146 EXPECT_FALSE(stream_->IsDoneReading()); | 150 EXPECT_FALSE(stream_->IsDoneReading()); |
| 147 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); | 151 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); |
| 148 } | 152 } |
| 149 | 153 |
| 150 TEST_P(QuicSpdyStreamTest, MarkHeadersConsumed) { | 154 TEST_P(QuicSpdyStreamTest, MarkHeadersConsumed) { |
| 151 Initialize(kShouldProcessData); | 155 Initialize(kShouldProcessData); |
| 152 | 156 |
| 153 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); | 157 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); | 604 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); |
| 601 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) | 605 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) |
| 602 .WillOnce(Return(QuicConsumedData(0, fin))); | 606 .WillOnce(Return(QuicConsumedData(0, fin))); |
| 603 | 607 |
| 604 stream_->WriteOrBufferData(body, fin, nullptr); | 608 stream_->WriteOrBufferData(body, fin, nullptr); |
| 605 } | 609 } |
| 606 | 610 |
| 607 } // namespace | 611 } // namespace |
| 608 } // namespace test | 612 } // namespace test |
| 609 } // namespace net | 613 } // namespace net |
| OLD | NEW |