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/core/quic_spdy_stream.h" | 5 #include "net/quic/core/quic_spdy_stream.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 headers.OnHeader(p.first, p.second); | 150 headers.OnHeader(p.first, p.second); |
151 total_bytes += p.first.size() + p.second.size(); | 151 total_bytes += p.first.size() + p.second.size(); |
152 } | 152 } |
153 stream_->OnStreamHeadersPriority(kV3HighestPriority); | 153 stream_->OnStreamHeadersPriority(kV3HighestPriority); |
154 stream_->OnStreamHeaderList(false, total_bytes, headers); | 154 stream_->OnStreamHeaderList(false, total_bytes, headers); |
155 EXPECT_EQ("", stream_->data()); | 155 EXPECT_EQ("", stream_->data()); |
156 EXPECT_FALSE(stream_->header_list().empty()); | 156 EXPECT_FALSE(stream_->header_list().empty()); |
157 EXPECT_FALSE(stream_->IsDoneReading()); | 157 EXPECT_FALSE(stream_->IsDoneReading()); |
158 } | 158 } |
159 | 159 |
| 160 TEST_P(QuicSpdyStreamTest, ProcessEmptyHeaderList) { |
| 161 FLAGS_quic_limit_uncompressed_headers = true; |
| 162 Initialize(kShouldProcessData); |
| 163 |
| 164 QuicHeaderList headers; |
| 165 stream_->OnStreamHeadersPriority(kV3HighestPriority); |
| 166 |
| 167 EXPECT_CALL(*session_, |
| 168 SendRstStream(stream_->id(), QUIC_HEADERS_TOO_LARGE, 0)); |
| 169 stream_->OnStreamHeaderList(false, 1 << 20, headers); |
| 170 EXPECT_EQ(QUIC_HEADERS_TOO_LARGE, stream_->stream_error()); |
| 171 } |
| 172 |
160 TEST_P(QuicSpdyStreamTest, ProcessHeadersWithFin) { | 173 TEST_P(QuicSpdyStreamTest, ProcessHeadersWithFin) { |
161 Initialize(kShouldProcessData); | 174 Initialize(kShouldProcessData); |
162 | 175 |
163 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); | 176 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); |
164 stream_->OnStreamHeadersPriority(kV3HighestPriority); | 177 stream_->OnStreamHeadersPriority(kV3HighestPriority); |
165 stream_->OnStreamHeaders(headers); | 178 stream_->OnStreamHeaders(headers); |
166 EXPECT_EQ("", stream_->data()); | 179 EXPECT_EQ("", stream_->data()); |
167 EXPECT_EQ(headers, stream_->decompressed_headers()); | 180 EXPECT_EQ(headers, stream_->decompressed_headers()); |
168 stream_->OnStreamHeadersComplete(true, headers.size()); | 181 stream_->OnStreamHeadersComplete(true, headers.size()); |
169 EXPECT_EQ(kV3HighestPriority, stream_->priority()); | 182 EXPECT_EQ(kV3HighestPriority, stream_->priority()); |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 | 1005 |
993 // Writing Trailers should fail, as the FIN has already been sent. | 1006 // Writing Trailers should fail, as the FIN has already been sent. |
994 // populated with the number of body bytes written. | 1007 // populated with the number of body bytes written. |
995 EXPECT_QUIC_BUG(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), | 1008 EXPECT_QUIC_BUG(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), |
996 "Trailers cannot be sent after a FIN"); | 1009 "Trailers cannot be sent after a FIN"); |
997 } | 1010 } |
998 | 1011 |
999 } // namespace | 1012 } // namespace |
1000 } // namespace test | 1013 } // namespace test |
1001 } // namespace net | 1014 } // namespace net |
OLD | NEW |