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

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

Issue 1753453003: Deprecate --gfe2_reloadable_flag_quic_supports_trailers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@115228444
Patch Set: Created 4 years, 9 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_simple_client_bin.cc ('k') | no next file » | 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 "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "net/quic/quic_utils.h" 9 #include "net/quic/quic_utils.h"
10 #include "net/quic/spdy_utils.h" 10 #include "net/quic/spdy_utils.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 QuicStreamFrame frame(kClientDataStreamId1, false, 3, StringPiece("asd")); 137 QuicStreamFrame frame(kClientDataStreamId1, false, 3, StringPiece("asd"));
138 138
139 EXPECT_FALSE(stream_->write_side_closed()); 139 EXPECT_FALSE(stream_->write_side_closed());
140 stream_->OnStreamFrame(frame); 140 stream_->OnStreamFrame(frame);
141 EXPECT_TRUE(stream_->write_side_closed()); 141 EXPECT_TRUE(stream_->write_side_closed());
142 } 142 }
143 143
144 TEST_F(QuicSpdyClientStreamTest, ReceivingTrailers) { 144 TEST_F(QuicSpdyClientStreamTest, ReceivingTrailers) {
145 // Test that receiving trailing headers, containing a final offset, results in 145 // Test that receiving trailing headers, containing a final offset, results in
146 // the stream being closed at that byte offset. 146 // the stream being closed at that byte offset.
147 ValueRestore<bool> old_flag(&FLAGS_quic_supports_trailers, true);
148
149 // Send headers as usual. 147 // Send headers as usual.
150 stream_->OnStreamHeaders(headers_string_); 148 stream_->OnStreamHeaders(headers_string_);
151 stream_->OnStreamHeadersComplete(false, headers_string_.size()); 149 stream_->OnStreamHeadersComplete(false, headers_string_.size());
152 150
153 // Send trailers before sending the body. Even though a FIN has been received 151 // Send trailers before sending the body. Even though a FIN has been received
154 // the stream should not be closed, as it does not yet have all the data bytes 152 // the stream should not be closed, as it does not yet have all the data bytes
155 // promised by the final offset field. 153 // promised by the final offset field.
156 SpdyHeaderBlock trailers; 154 SpdyHeaderBlock trailers;
157 trailers["trailer key"] = "trailer value"; 155 trailers["trailer key"] = "trailer value";
158 trailers[kFinalOffsetHeaderKey] = base::IntToString(body_.size()); 156 trailers[kFinalOffsetHeaderKey] = base::IntToString(body_.size());
159 string trailers_string = SpdyUtils::SerializeUncompressedHeaders(trailers); 157 string trailers_string = SpdyUtils::SerializeUncompressedHeaders(trailers);
160 stream_->OnStreamHeaders(trailers_string); 158 stream_->OnStreamHeaders(trailers_string);
161 stream_->OnStreamHeadersComplete(true, trailers_string.size()); 159 stream_->OnStreamHeadersComplete(true, trailers_string.size());
162 160
163 // Now send the body, which should close the stream as the FIN has been 161 // Now send the body, which should close the stream as the FIN has been
164 // received, as well as all data. 162 // received, as well as all data.
165 EXPECT_CALL(session_, CloseStream(stream_->id())); 163 EXPECT_CALL(session_, CloseStream(stream_->id()));
166 stream_->OnStreamFrame( 164 stream_->OnStreamFrame(
167 QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, body_)); 165 QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, body_));
168 } 166 }
169 167
170 } // namespace 168 } // namespace
171 } // namespace test 169 } // namespace test
172 } // namespace net 170 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_client_bin.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698