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(); |
850 EXPECT_EQ("", stream_->decompressed_trailers()); | 851 EXPECT_EQ("", stream_->decompressed_trailers()); |
851 | 852 |
852 EXPECT_FALSE(stream_->IsDoneReading()); | 853 EXPECT_FALSE(stream_->IsDoneReading()); |
853 // Receive and consume body. | 854 // Receive and consume body. |
854 QuicStreamFrame frame(kClientDataStreamId1, /*fin=*/false, 0, body); | 855 QuicStreamFrame frame(kClientDataStreamId1, /*fin=*/false, 0, body); |
855 stream_->OnStreamFrame(frame); | 856 stream_->OnStreamFrame(frame); |
856 EXPECT_EQ(body, stream_->data()); | 857 EXPECT_EQ(body, stream_->data()); |
857 EXPECT_TRUE(stream_->IsDoneReading()); | 858 EXPECT_TRUE(stream_->IsDoneReading()); |
858 } | 859 } |
859 | 860 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 | 992 |
992 // Writing Trailers should fail, as the FIN has already been sent. | 993 // Writing Trailers should fail, as the FIN has already been sent. |
993 // populated with the number of body bytes written. | 994 // populated with the number of body bytes written. |
994 EXPECT_DFATAL(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), | 995 EXPECT_DFATAL(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), |
995 "Trailers cannot be sent after a FIN"); | 996 "Trailers cannot be sent after a FIN"); |
996 } | 997 } |
997 | 998 |
998 } // namespace | 999 } // namespace |
999 } // namespace test | 1000 } // namespace test |
1000 } // namespace net | 1001 } // namespace net |
OLD | NEW |