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

Side by Side Diff: net/tools/quic/quic_spdy_client_stream_test.cc

Issue 2872133008: Deprecate FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming (Closed)
Patch Set: Created 3 years, 7 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/tools/quic/quic_spdy_client_stream.cc ('k') | net/tools/quic/test_tools/quic_test_client.h » ('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/tools/quic/quic_spdy_client_stream.h" 5 #include "net/tools/quic/quic_spdy_client_stream.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "net/quic/core/quic_utils.h" 10 #include "net/quic/core/quic_utils.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 EXPECT_EQ(200, stream_->response_code()); 147 EXPECT_EQ(200, stream_->response_code());
148 148
149 EXPECT_CALL(*connection_, 149 EXPECT_CALL(*connection_,
150 SendRstStream(stream_->id(), QUIC_BAD_APPLICATION_PAYLOAD, 0)); 150 SendRstStream(stream_->id(), QUIC_BAD_APPLICATION_PAYLOAD, 0));
151 stream_->OnStreamFrame( 151 stream_->OnStreamFrame(
152 QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, large_body)); 152 QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, large_body));
153 153
154 EXPECT_NE(QUIC_STREAM_NO_ERROR, stream_->stream_error()); 154 EXPECT_NE(QUIC_STREAM_NO_ERROR, stream_->stream_error());
155 } 155 }
156 156
157 TEST_F(QuicSpdyClientStreamTest, TestNoBidirectionalStreaming) {
158 if (FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
159 return;
160 }
161 QuicStreamFrame frame(
162 QuicSpdySessionPeer::GetNthClientInitiatedStreamId(session_, 0), false, 3,
163 QuicStringPiece("asd"));
164
165 EXPECT_FALSE(stream_->write_side_closed());
166 stream_->OnStreamFrame(frame);
167 EXPECT_TRUE(stream_->write_side_closed());
168 }
169
170 TEST_F(QuicSpdyClientStreamTest, ReceivingTrailers) { 157 TEST_F(QuicSpdyClientStreamTest, ReceivingTrailers) {
171 // Test that receiving trailing headers, containing a final offset, results in 158 // Test that receiving trailing headers, containing a final offset, results in
172 // the stream being closed at that byte offset. 159 // the stream being closed at that byte offset.
173 // Send headers as usual. 160 // Send headers as usual.
174 auto headers = AsHeaderList(headers_); 161 auto headers = AsHeaderList(headers_);
175 stream_->OnStreamHeaderList(false, headers.uncompressed_header_bytes(), 162 stream_->OnStreamHeaderList(false, headers.uncompressed_header_bytes(),
176 headers); 163 headers);
177 164
178 // Send trailers before sending the body. Even though a FIN has been received 165 // Send trailers before sending the body. Even though a FIN has been received
179 // the stream should not be closed, as it does not yet have all the data bytes 166 // the stream should not be closed, as it does not yet have all the data bytes
180 // promised by the final offset field. 167 // promised by the final offset field.
181 SpdyHeaderBlock trailer_block; 168 SpdyHeaderBlock trailer_block;
182 trailer_block["trailer key"] = "trailer value"; 169 trailer_block["trailer key"] = "trailer value";
183 trailer_block[kFinalOffsetHeaderKey] = 170 trailer_block[kFinalOffsetHeaderKey] =
184 QuicTextUtils::Uint64ToString(body_.size()); 171 QuicTextUtils::Uint64ToString(body_.size());
185 auto trailers = AsHeaderList(trailer_block); 172 auto trailers = AsHeaderList(trailer_block);
186 stream_->OnStreamHeaderList(true, trailers.uncompressed_header_bytes(), 173 stream_->OnStreamHeaderList(true, trailers.uncompressed_header_bytes(),
187 trailers); 174 trailers);
188 175
189 // Now send the body, which should close the stream as the FIN has been 176 // Now send the body, which should close the stream as the FIN has been
190 // received, as well as all data. 177 // received, as well as all data.
191 if (!FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
192 EXPECT_CALL(session_, CloseStream(stream_->id()));
193 }
194 stream_->OnStreamFrame( 178 stream_->OnStreamFrame(
195 QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, body_)); 179 QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, body_));
196 if (FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) { 180 EXPECT_TRUE(stream_->reading_stopped());
197 EXPECT_TRUE(stream_->reading_stopped());
198 }
199 } 181 }
200 182
201 } // namespace 183 } // namespace
202 } // namespace test 184 } // namespace test
203 } // namespace net 185 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_spdy_client_stream.cc ('k') | net/tools/quic/test_tools/quic_test_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698