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/quic_reliable_client_stream.h" | 5 #include "net/quic/quic_reliable_client_stream.h" |
6 | 6 |
7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
8 #include "net/base/test_completion_callback.h" | 8 #include "net/base/test_completion_callback.h" |
9 #include "net/quic/quic_chromium_client_session.h" | 9 #include "net/quic/quic_chromium_client_session.h" |
10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void ReadData(StringPiece expected_data) { | 91 void ReadData(StringPiece expected_data) { |
92 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1)); | 92 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1)); |
93 EXPECT_EQ(static_cast<int>(expected_data.length()), | 93 EXPECT_EQ(static_cast<int>(expected_data.length()), |
94 stream_->Read(buffer.get(), expected_data.length() + 1)); | 94 stream_->Read(buffer.get(), expected_data.length() + 1)); |
95 EXPECT_EQ(expected_data, | 95 EXPECT_EQ(expected_data, |
96 StringPiece(buffer->data(), expected_data.length())); | 96 StringPiece(buffer->data(), expected_data.length())); |
97 } | 97 } |
98 | 98 |
99 QuicCryptoClientConfig crypto_config_; | 99 QuicCryptoClientConfig crypto_config_; |
100 testing::StrictMock<MockDelegate> delegate_; | 100 testing::StrictMock<MockDelegate> delegate_; |
101 MockHelper helper_; | 101 MockConnectionHelper helper_; |
102 MockQuicSpdySession session_; | 102 MockQuicSpdySession session_; |
103 QuicReliableClientStream* stream_; | 103 QuicReliableClientStream* stream_; |
104 SpdyHeaderBlock headers_; | 104 SpdyHeaderBlock headers_; |
105 }; | 105 }; |
106 | 106 |
107 INSTANTIATE_TEST_CASE_P(Version, QuicReliableClientStreamTest, | 107 INSTANTIATE_TEST_CASE_P(Version, QuicReliableClientStreamTest, |
108 ::testing::ValuesIn(QuicSupportedVersions())); | 108 ::testing::ValuesIn(QuicSupportedVersions())); |
109 | 109 |
110 TEST_P(QuicReliableClientStreamTest, OnFinRead) { | 110 TEST_P(QuicReliableClientStreamTest, OnFinRead) { |
111 InitializeHeaders(); | 111 InitializeHeaders(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce( | 233 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce( |
234 Return(QuicConsumedData(kDataLen, true))); | 234 Return(QuicConsumedData(kDataLen, true))); |
235 stream_->OnCanWrite(); | 235 stream_->OnCanWrite(); |
236 ASSERT_TRUE(callback.have_result()); | 236 ASSERT_TRUE(callback.have_result()); |
237 EXPECT_EQ(OK, callback.WaitForResult()); | 237 EXPECT_EQ(OK, callback.WaitForResult()); |
238 } | 238 } |
239 | 239 |
240 } // namespace | 240 } // namespace |
241 } // namespace test | 241 } // namespace test |
242 } // namespace net | 242 } // namespace net |
OLD | NEW |