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

Side by Side Diff: net/quic/core/quic_spdy_stream_test.cc

Issue 2430973004: Landing Recent QUIC changes until 10:38 AM, Oct 17, 2016 UTC-4 (Closed)
Patch Set: Improving flagsaver logging Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_spdy_stream.cc ('k') | net/quic/core/quic_stream_sequencer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 session_.reset(new testing::StrictMock<MockQuicSpdySession>(connection_)); 104 session_.reset(new testing::StrictMock<MockQuicSpdySession>(connection_));
105 stream_ = new TestStream(kClientDataStreamId1, session_.get(), 105 stream_ = new TestStream(kClientDataStreamId1, session_.get(),
106 stream_should_process_data); 106 stream_should_process_data);
107 session_->ActivateStream(base::WrapUnique(stream_)); 107 session_->ActivateStream(base::WrapUnique(stream_));
108 stream2_ = new TestStream(kClientDataStreamId2, session_.get(), 108 stream2_ = new TestStream(kClientDataStreamId2, session_.get(),
109 stream_should_process_data); 109 stream_should_process_data);
110 session_->ActivateStream(base::WrapUnique(stream2_)); 110 session_->ActivateStream(base::WrapUnique(stream2_));
111 } 111 }
112 112
113 protected: 113 protected:
114 QuicFlagSaver flags_; // Save/restore all QUIC flag values.
114 MockQuicConnectionHelper helper_; 115 MockQuicConnectionHelper helper_;
115 MockAlarmFactory alarm_factory_; 116 MockAlarmFactory alarm_factory_;
116 MockQuicConnection* connection_; 117 MockQuicConnection* connection_;
117 std::unique_ptr<MockQuicSpdySession> session_; 118 std::unique_ptr<MockQuicSpdySession> session_;
118 119
119 // Owned by the |session_|. 120 // Owned by the |session_|.
120 TestStream* stream_; 121 TestStream* stream_;
121 TestStream* stream2_; 122 TestStream* stream2_;
122 123
123 SpdyHeaderBlock headers_; 124 SpdyHeaderBlock headers_;
(...skipping 27 matching lines...) Expand all
151 headers.OnHeader(p.first, p.second); 152 headers.OnHeader(p.first, p.second);
152 total_bytes += p.first.size() + p.second.size(); 153 total_bytes += p.first.size() + p.second.size();
153 } 154 }
154 stream_->OnStreamHeadersPriority(kV3HighestPriority); 155 stream_->OnStreamHeadersPriority(kV3HighestPriority);
155 stream_->OnStreamHeaderList(false, total_bytes, headers); 156 stream_->OnStreamHeaderList(false, total_bytes, headers);
156 EXPECT_EQ("", stream_->data()); 157 EXPECT_EQ("", stream_->data());
157 EXPECT_FALSE(stream_->header_list().empty()); 158 EXPECT_FALSE(stream_->header_list().empty());
158 EXPECT_FALSE(stream_->IsDoneReading()); 159 EXPECT_FALSE(stream_->IsDoneReading());
159 } 160 }
160 161
162 TEST_P(QuicSpdyStreamTest, ProcessEmptyHeaderList) {
163 FLAGS_quic_limit_uncompressed_headers = true;
164 Initialize(kShouldProcessData);
165
166 QuicHeaderList headers;
167 stream_->OnStreamHeadersPriority(kV3HighestPriority);
168
169 EXPECT_CALL(*session_,
170 SendRstStream(stream_->id(), QUIC_HEADERS_TOO_LARGE, 0));
171 stream_->OnStreamHeaderList(false, 1 << 20, headers);
172 EXPECT_EQ(QUIC_HEADERS_TOO_LARGE, stream_->stream_error());
173 }
174
161 TEST_P(QuicSpdyStreamTest, ProcessHeadersWithFin) { 175 TEST_P(QuicSpdyStreamTest, ProcessHeadersWithFin) {
162 Initialize(kShouldProcessData); 176 Initialize(kShouldProcessData);
163 177
164 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); 178 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_);
165 stream_->OnStreamHeadersPriority(kV3HighestPriority); 179 stream_->OnStreamHeadersPriority(kV3HighestPriority);
166 stream_->OnStreamHeaders(headers); 180 stream_->OnStreamHeaders(headers);
167 EXPECT_EQ("", stream_->data()); 181 EXPECT_EQ("", stream_->data());
168 EXPECT_EQ(headers, stream_->decompressed_headers()); 182 EXPECT_EQ(headers, stream_->decompressed_headers());
169 stream_->OnStreamHeadersComplete(true, headers.size()); 183 stream_->OnStreamHeadersComplete(true, headers.size());
170 EXPECT_EQ(kV3HighestPriority, stream_->priority()); 184 EXPECT_EQ(kV3HighestPriority, stream_->priority());
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 1007
994 // Writing Trailers should fail, as the FIN has already been sent. 1008 // Writing Trailers should fail, as the FIN has already been sent.
995 // populated with the number of body bytes written. 1009 // populated with the number of body bytes written.
996 EXPECT_QUIC_BUG(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), 1010 EXPECT_QUIC_BUG(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr),
997 "Trailers cannot be sent after a FIN"); 1011 "Trailers cannot be sent after a FIN");
998 } 1012 }
999 1013
1000 } // namespace 1014 } // namespace
1001 } // namespace test 1015 } // namespace test
1002 } // namespace net 1016 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_spdy_stream.cc ('k') | net/quic/core/quic_stream_sequencer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698