OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromium/quic_http_stream.h" | 5 #include "net/quic/chromium/quic_http_stream.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // Subclass of QuicHttpStream that closes itself when the first piece of data | 101 // Subclass of QuicHttpStream that closes itself when the first piece of data |
102 // is received. | 102 // is received. |
103 class AutoClosingStream : public QuicHttpStream { | 103 class AutoClosingStream : public QuicHttpStream { |
104 public: | 104 public: |
105 explicit AutoClosingStream( | 105 explicit AutoClosingStream( |
106 std::unique_ptr<QuicChromiumClientSession::Handle> session, | 106 std::unique_ptr<QuicChromiumClientSession::Handle> session, |
107 HttpServerProperties* http_server_properties) | 107 HttpServerProperties* http_server_properties) |
108 : QuicHttpStream(std::move(session), http_server_properties) {} | 108 : QuicHttpStream(std::move(session), http_server_properties) {} |
109 | 109 |
110 void OnHeadersAvailable(const SpdyHeaderBlock& headers, | 110 void OnInitialHeadersAvailable(const SpdyHeaderBlock& headers, |
111 size_t frame_len) override { | 111 size_t frame_len) override { |
112 Close(false); | 112 Close(false); |
113 } | 113 } |
114 | 114 |
| 115 void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers, |
| 116 size_t frame_len) override { |
| 117 Close(false); |
| 118 } |
| 119 |
115 void OnDataAvailable() override { Close(false); } | 120 void OnDataAvailable() override { Close(false); } |
116 }; | 121 }; |
117 | 122 |
118 // UploadDataStream that always returns errors on data read. | 123 // UploadDataStream that always returns errors on data read. |
119 class ReadErrorUploadDataStream : public UploadDataStream { | 124 class ReadErrorUploadDataStream : public UploadDataStream { |
120 public: | 125 public: |
121 enum class FailureMode { SYNC, ASYNC }; | 126 enum class FailureMode { SYNC, ASYNC }; |
122 | 127 |
123 explicit ReadErrorUploadDataStream(FailureMode mode) | 128 explicit ReadErrorUploadDataStream(FailureMode mode) |
124 : UploadDataStream(true, 0), async_(mode), weak_factory_(this) {} | 129 : UploadDataStream(true, 0), async_(mode), weak_factory_(this) {} |
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 EXPECT_TRUE(AtEof()); | 2172 EXPECT_TRUE(AtEof()); |
2168 | 2173 |
2169 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. | 2174 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. |
2170 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), | 2175 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), |
2171 stream_->GetTotalSentBytes()); | 2176 stream_->GetTotalSentBytes()); |
2172 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 2177 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
2173 } | 2178 } |
2174 | 2179 |
2175 } // namespace test | 2180 } // namespace test |
2176 } // namespace net | 2181 } // namespace net |
OLD | NEW |