| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers, | 110 void OnTrailingHeadersAvailable(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 OnDataAvailable() override { Close(false); } | |
| 116 }; | 115 }; |
| 117 | 116 |
| 118 // UploadDataStream that always returns errors on data read. | 117 // UploadDataStream that always returns errors on data read. |
| 119 class ReadErrorUploadDataStream : public UploadDataStream { | 118 class ReadErrorUploadDataStream : public UploadDataStream { |
| 120 public: | 119 public: |
| 121 enum class FailureMode { SYNC, ASYNC }; | 120 enum class FailureMode { SYNC, ASYNC }; |
| 122 | 121 |
| 123 explicit ReadErrorUploadDataStream(FailureMode mode) | 122 explicit ReadErrorUploadDataStream(FailureMode mode) |
| 124 : UploadDataStream(true, 0), async_(mode), weak_factory_(this) {} | 123 : UploadDataStream(true, 0), async_(mode), weak_factory_(this) {} |
| 125 ~ReadErrorUploadDataStream() override {} | 124 ~ReadErrorUploadDataStream() override {} |
| (...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 EXPECT_TRUE(AtEof()); | 2163 EXPECT_TRUE(AtEof()); |
| 2165 | 2164 |
| 2166 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. | 2165 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. |
| 2167 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), | 2166 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), |
| 2168 stream_->GetTotalSentBytes()); | 2167 stream_->GetTotalSentBytes()); |
| 2169 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 2168 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
| 2170 } | 2169 } |
| 2171 | 2170 |
| 2172 } // namespace test | 2171 } // namespace test |
| 2173 } // namespace net | 2172 } // namespace net |
| OLD | NEW |