| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 string trailers = SpdyUtils::SerializeUncompressedHeaders(trailers_block); | 840 string trailers = SpdyUtils::SerializeUncompressedHeaders(trailers_block); |
| 841 stream_->OnStreamHeaders(trailers); | 841 stream_->OnStreamHeaders(trailers); |
| 842 stream_->OnStreamHeadersComplete(/*fin=*/true, trailers.size()); | 842 stream_->OnStreamHeadersComplete(/*fin=*/true, trailers.size()); |
| 843 | 843 |
| 844 // The trailers should be decompressed, and readable from the stream. | 844 // The trailers should be decompressed, and readable from the stream. |
| 845 EXPECT_TRUE(stream_->trailers_decompressed()); | 845 EXPECT_TRUE(stream_->trailers_decompressed()); |
| 846 const string decompressed_trailers = stream_->decompressed_trailers(); | 846 const string decompressed_trailers = stream_->decompressed_trailers(); |
| 847 EXPECT_EQ(trailers, decompressed_trailers); | 847 EXPECT_EQ(trailers, decompressed_trailers); |
| 848 // Consuming the trailers erases them from the stream. | 848 // Consuming the trailers erases them from the stream. |
| 849 stream_->MarkTrailersConsumed(decompressed_trailers.size()); | 849 stream_->MarkTrailersConsumed(decompressed_trailers.size()); |
| 850 stream_->MarkTrailersDelivered(); | |
| 851 EXPECT_EQ("", stream_->decompressed_trailers()); | 850 EXPECT_EQ("", stream_->decompressed_trailers()); |
| 852 | 851 |
| 853 EXPECT_FALSE(stream_->IsDoneReading()); | 852 EXPECT_FALSE(stream_->IsDoneReading()); |
| 854 // Receive and consume body. | 853 // Receive and consume body. |
| 855 QuicStreamFrame frame(kClientDataStreamId1, /*fin=*/false, 0, body); | 854 QuicStreamFrame frame(kClientDataStreamId1, /*fin=*/false, 0, body); |
| 856 stream_->OnStreamFrame(frame); | 855 stream_->OnStreamFrame(frame); |
| 857 EXPECT_EQ(body, stream_->data()); | 856 EXPECT_EQ(body, stream_->data()); |
| 858 EXPECT_TRUE(stream_->IsDoneReading()); | 857 EXPECT_TRUE(stream_->IsDoneReading()); |
| 859 } | 858 } |
| 860 | 859 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 | 991 |
| 993 // Writing Trailers should fail, as the FIN has already been sent. | 992 // Writing Trailers should fail, as the FIN has already been sent. |
| 994 // populated with the number of body bytes written. | 993 // populated with the number of body bytes written. |
| 995 EXPECT_DFATAL(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), | 994 EXPECT_DFATAL(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), |
| 996 "Trailers cannot be sent after a FIN"); | 995 "Trailers cannot be sent after a FIN"); |
| 997 } | 996 } |
| 998 | 997 |
| 999 } // namespace | 998 } // namespace |
| 1000 } // namespace test | 999 } // namespace test |
| 1001 } // namespace net | 1000 } // namespace net |
| OLD | NEW |