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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 string trailers = SpdyUtils::SerializeUncompressedHeaders(trailers_block); | 833 string trailers = SpdyUtils::SerializeUncompressedHeaders(trailers_block); |
834 stream_->OnStreamHeaders(trailers); | 834 stream_->OnStreamHeaders(trailers); |
835 stream_->OnStreamHeadersComplete(/*fin=*/true, trailers.size()); | 835 stream_->OnStreamHeadersComplete(/*fin=*/true, trailers.size()); |
836 | 836 |
837 // The trailers should be decompressed, and readable from the stream. | 837 // The trailers should be decompressed, and readable from the stream. |
838 EXPECT_TRUE(stream_->trailers_decompressed()); | 838 EXPECT_TRUE(stream_->trailers_decompressed()); |
839 const string decompressed_trailers = stream_->decompressed_trailers(); | 839 const string decompressed_trailers = stream_->decompressed_trailers(); |
840 EXPECT_EQ(trailers, decompressed_trailers); | 840 EXPECT_EQ(trailers, decompressed_trailers); |
841 // Consuming the trailers erases them from the stream. | 841 // Consuming the trailers erases them from the stream. |
842 stream_->MarkTrailersConsumed(decompressed_trailers.size()); | 842 stream_->MarkTrailersConsumed(decompressed_trailers.size()); |
843 stream_->MarkTrailersDelivered(); | 843 stream_->MarkTrailersConsumed(); |
844 EXPECT_EQ("", stream_->decompressed_trailers()); | 844 EXPECT_EQ("", stream_->decompressed_trailers()); |
845 | 845 |
846 EXPECT_FALSE(stream_->IsDoneReading()); | 846 EXPECT_FALSE(stream_->IsDoneReading()); |
847 // Receive and consume body. | 847 // Receive and consume body. |
848 QuicStreamFrame frame(kClientDataStreamId1, /*fin=*/false, 0, body); | 848 QuicStreamFrame frame(kClientDataStreamId1, /*fin=*/false, 0, body); |
849 stream_->OnStreamFrame(frame); | 849 stream_->OnStreamFrame(frame); |
850 EXPECT_EQ(body, stream_->data()); | 850 EXPECT_EQ(body, stream_->data()); |
851 EXPECT_TRUE(stream_->IsDoneReading()); | 851 EXPECT_TRUE(stream_->IsDoneReading()); |
852 } | 852 } |
853 | 853 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 | 992 |
993 // Writing Trailers should fail, as the FIN has already been sent. | 993 // Writing Trailers should fail, as the FIN has already been sent. |
994 // populated with the number of body bytes written. | 994 // populated with the number of body bytes written. |
995 EXPECT_QUIC_BUG(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), | 995 EXPECT_QUIC_BUG(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), |
996 "Trailers cannot be sent after a FIN"); | 996 "Trailers cannot be sent after a FIN"); |
997 } | 997 } |
998 | 998 |
999 } // namespace | 999 } // namespace |
1000 } // namespace test | 1000 } // namespace test |
1001 } // namespace net | 1001 } // namespace net |
OLD | NEW |