| 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/tools/quic/quic_reliable_server_stream.h" | 5 #include "net/tools/quic/quic_reliable_server_stream.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "net/quic/quic_spdy_compressor.h" | 8 #include "net/quic/quic_spdy_compressor.h" |
| 9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
| 10 #include "net/quic/test_tools/quic_test_utils.h" | 10 #include "net/quic/test_tools/quic_test_utils.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 BalsaHeaders response_headers_; | 116 BalsaHeaders response_headers_; |
| 117 EpollServer eps_; | 117 EpollServer eps_; |
| 118 StrictMock<MockSession> session_; | 118 StrictMock<MockSession> session_; |
| 119 scoped_ptr<QuicReliableServerStream> stream_; | 119 scoped_ptr<QuicReliableServerStream> stream_; |
| 120 string headers_string_; | 120 string headers_string_; |
| 121 string body_; | 121 string body_; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 QuicConsumedData ConsumeAllData(QuicStreamId id, const struct iovec* iov, | 124 QuicConsumedData ConsumeAllData(QuicStreamId id, |
| 125 int count, QuicStreamOffset offset, bool fin) { | 125 const struct iovec* iov, |
| 126 int iov_count, |
| 127 QuicStreamOffset offset, |
| 128 bool fin) { |
| 126 ssize_t consumed_length = 0; | 129 ssize_t consumed_length = 0; |
| 127 for (int i = 0; i < count; ++i) { | 130 for (int i = 0; i < iov_count; ++i) { |
| 128 consumed_length += iov[i].iov_len; | 131 consumed_length += iov[i].iov_len; |
| 129 } | 132 } |
| 130 return QuicConsumedData(consumed_length, fin); | 133 return QuicConsumedData(consumed_length, fin); |
| 131 } | 134 } |
| 132 | 135 |
| 133 TEST_F(QuicReliableServerStreamTest, TestFraming) { | 136 TEST_F(QuicReliableServerStreamTest, TestFraming) { |
| 134 EXPECT_CALL(session_, WritevData(_, _, _, _, _)).Times(AnyNumber()). | 137 EXPECT_CALL(session_, WritevData(_, _, _, _, _)).Times(AnyNumber()). |
| 135 WillRepeatedly(Invoke(ConsumeAllData)); | 138 WillRepeatedly(Invoke(ConsumeAllData)); |
| 136 | 139 |
| 137 EXPECT_EQ(headers_string_.size(), stream_->ProcessData( | 140 EXPECT_EQ(headers_string_.size(), stream_->ProcessData( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 219 |
| 217 stream_->SendErrorResponse(); | 220 stream_->SendErrorResponse(); |
| 218 EXPECT_TRUE(stream_->read_side_closed()); | 221 EXPECT_TRUE(stream_->read_side_closed()); |
| 219 EXPECT_TRUE(stream_->write_side_closed()); | 222 EXPECT_TRUE(stream_->write_side_closed()); |
| 220 } | 223 } |
| 221 | 224 |
| 222 } // namespace | 225 } // namespace |
| 223 } // namespace test | 226 } // namespace test |
| 224 } // namespace tools | 227 } // namespace tools |
| 225 } // namespace net | 228 } // namespace net |
| OLD | NEW |