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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 public: | 103 public: |
104 explicit AutoClosingStream( | 104 explicit AutoClosingStream( |
105 std::unique_ptr<QuicChromiumClientSession::Handle> session) | 105 std::unique_ptr<QuicChromiumClientSession::Handle> session) |
106 : QuicHttpStream(std::move(session)) {} | 106 : QuicHttpStream(std::move(session)) {} |
107 | 107 |
108 void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers, | 108 void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers, |
109 size_t frame_len) override { | 109 size_t frame_len) override { |
110 Close(false); | 110 Close(false); |
111 } | 111 } |
112 | 112 |
113 void OnDataAvailable() override { Close(false); } | |
114 }; | 113 }; |
115 | 114 |
116 // UploadDataStream that always returns errors on data read. | 115 // UploadDataStream that always returns errors on data read. |
117 class ReadErrorUploadDataStream : public UploadDataStream { | 116 class ReadErrorUploadDataStream : public UploadDataStream { |
118 public: | 117 public: |
119 enum class FailureMode { SYNC, ASYNC }; | 118 enum class FailureMode { SYNC, ASYNC }; |
120 | 119 |
121 explicit ReadErrorUploadDataStream(FailureMode mode) | 120 explicit ReadErrorUploadDataStream(FailureMode mode) |
122 : UploadDataStream(true, 0), async_(mode), weak_factory_(this) {} | 121 : UploadDataStream(true, 0), async_(mode), weak_factory_(this) {} |
123 ~ReadErrorUploadDataStream() override {} | 122 ~ReadErrorUploadDataStream() override {} |
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 EXPECT_TRUE(AtEof()); | 2156 EXPECT_TRUE(AtEof()); |
2158 | 2157 |
2159 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. | 2158 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. |
2160 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), | 2159 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), |
2161 stream_->GetTotalSentBytes()); | 2160 stream_->GetTotalSentBytes()); |
2162 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 2161 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
2163 } | 2162 } |
2164 | 2163 |
2165 } // namespace test | 2164 } // namespace test |
2166 } // namespace net | 2165 } // namespace net |
OLD | NEW |