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_chromium_client_stream.h" | 5 #include "net/quic/quic_chromium_client_stream.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 MockQuicClientSessionBase::~MockQuicClientSessionBase() {} | 139 MockQuicClientSessionBase::~MockQuicClientSessionBase() {} |
140 | 140 |
141 class QuicChromiumClientStreamTest | 141 class QuicChromiumClientStreamTest |
142 : public ::testing::TestWithParam<QuicVersion> { | 142 : public ::testing::TestWithParam<QuicVersion> { |
143 public: | 143 public: |
144 QuicChromiumClientStreamTest() | 144 QuicChromiumClientStreamTest() |
145 : crypto_config_(CryptoTestUtils::ProofVerifierForTesting()), | 145 : crypto_config_(CryptoTestUtils::ProofVerifierForTesting()), |
146 session_(new MockConnection(&helper_, | 146 session_(new MockConnection(&helper_, |
| 147 &alarm_factory_, |
147 Perspective::IS_CLIENT, | 148 Perspective::IS_CLIENT, |
148 SupportedVersions(GetParam())), | 149 SupportedVersions(GetParam())), |
149 &push_promise_index_) { | 150 &push_promise_index_) { |
150 stream_ = | 151 stream_ = |
151 new QuicChromiumClientStream(kTestStreamId, &session_, BoundNetLog()); | 152 new QuicChromiumClientStream(kTestStreamId, &session_, BoundNetLog()); |
152 session_.ActivateStream(stream_); | 153 session_.ActivateStream(stream_); |
153 stream_->SetDelegate(&delegate_); | 154 stream_->SetDelegate(&delegate_); |
154 } | 155 } |
155 | 156 |
156 void InitializeHeaders() { | 157 void InitializeHeaders() { |
(...skipping 30 matching lines...) Expand all Loading... |
187 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1)); | 188 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1)); |
188 EXPECT_EQ(static_cast<int>(expected_data.length()), | 189 EXPECT_EQ(static_cast<int>(expected_data.length()), |
189 stream_->Read(buffer.get(), expected_data.length() + 1)); | 190 stream_->Read(buffer.get(), expected_data.length() + 1)); |
190 EXPECT_EQ(expected_data, | 191 EXPECT_EQ(expected_data, |
191 StringPiece(buffer->data(), expected_data.length())); | 192 StringPiece(buffer->data(), expected_data.length())); |
192 } | 193 } |
193 | 194 |
194 QuicCryptoClientConfig crypto_config_; | 195 QuicCryptoClientConfig crypto_config_; |
195 testing::StrictMock<MockDelegate> delegate_; | 196 testing::StrictMock<MockDelegate> delegate_; |
196 MockConnectionHelper helper_; | 197 MockConnectionHelper helper_; |
| 198 MockAlarmFactory alarm_factory_; |
197 MockQuicClientSessionBase session_; | 199 MockQuicClientSessionBase session_; |
198 QuicChromiumClientStream* stream_; | 200 QuicChromiumClientStream* stream_; |
199 SpdyHeaderBlock headers_; | 201 SpdyHeaderBlock headers_; |
200 QuicClientPushPromiseIndex push_promise_index_; | 202 QuicClientPushPromiseIndex push_promise_index_; |
201 }; | 203 }; |
202 | 204 |
203 INSTANTIATE_TEST_CASE_P(Version, | 205 INSTANTIATE_TEST_CASE_P(Version, |
204 QuicChromiumClientStreamTest, | 206 QuicChromiumClientStreamTest, |
205 ::testing::ValuesIn(QuicSupportedVersions())); | 207 ::testing::ValuesIn(QuicSupportedVersions())); |
206 | 208 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 stream->SetDelegate(&delegate_); | 483 stream->SetDelegate(&delegate_); |
482 base::MessageLoop::current()->RunUntilIdle(); | 484 base::MessageLoop::current()->RunUntilIdle(); |
483 | 485 |
484 // Times(2) because OnClose will be called for stream and stream_. | 486 // Times(2) because OnClose will be called for stream and stream_. |
485 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)).Times(2); | 487 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)).Times(2); |
486 } | 488 } |
487 | 489 |
488 } // namespace | 490 } // namespace |
489 } // namespace test | 491 } // namespace test |
490 } // namespace net | 492 } // namespace net |
OLD | NEW |