| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 .WillByDefault(testing::Return(QuicConsumedData(0, false))); | 136 .WillByDefault(testing::Return(QuicConsumedData(0, false))); |
| 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_, &alarm_factory_, |
| 147 Perspective::IS_CLIENT, | 147 Perspective::IS_CLIENT, |
| 148 SupportedVersions(GetParam())), | 148 SupportedVersions(GetParam())), |
| 149 &push_promise_index_) { | 149 &push_promise_index_) { |
| 150 stream_ = | 150 stream_ = |
| 151 new QuicChromiumClientStream(kTestStreamId, &session_, BoundNetLog()); | 151 new QuicChromiumClientStream(kTestStreamId, &session_, BoundNetLog()); |
| 152 session_.ActivateStream(stream_); | 152 session_.ActivateStream(stream_); |
| 153 stream_->SetDelegate(&delegate_); | 153 stream_->SetDelegate(&delegate_); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void InitializeHeaders() { | 156 void InitializeHeaders() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 187 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1)); | 187 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1)); |
| 188 EXPECT_EQ(static_cast<int>(expected_data.length()), | 188 EXPECT_EQ(static_cast<int>(expected_data.length()), |
| 189 stream_->Read(buffer.get(), expected_data.length() + 1)); | 189 stream_->Read(buffer.get(), expected_data.length() + 1)); |
| 190 EXPECT_EQ(expected_data, | 190 EXPECT_EQ(expected_data, |
| 191 StringPiece(buffer->data(), expected_data.length())); | 191 StringPiece(buffer->data(), expected_data.length())); |
| 192 } | 192 } |
| 193 | 193 |
| 194 QuicCryptoClientConfig crypto_config_; | 194 QuicCryptoClientConfig crypto_config_; |
| 195 testing::StrictMock<MockDelegate> delegate_; | 195 testing::StrictMock<MockDelegate> delegate_; |
| 196 MockConnectionHelper helper_; | 196 MockConnectionHelper helper_; |
| 197 MockAlarmFactory alarm_factory_; |
| 197 MockQuicClientSessionBase session_; | 198 MockQuicClientSessionBase session_; |
| 198 QuicChromiumClientStream* stream_; | 199 QuicChromiumClientStream* stream_; |
| 199 SpdyHeaderBlock headers_; | 200 SpdyHeaderBlock headers_; |
| 200 QuicClientPushPromiseIndex push_promise_index_; | 201 QuicClientPushPromiseIndex push_promise_index_; |
| 201 }; | 202 }; |
| 202 | 203 |
| 203 INSTANTIATE_TEST_CASE_P(Version, | 204 INSTANTIATE_TEST_CASE_P(Version, |
| 204 QuicChromiumClientStreamTest, | 205 QuicChromiumClientStreamTest, |
| 205 ::testing::ValuesIn(QuicSupportedVersions())); | 206 ::testing::ValuesIn(QuicSupportedVersions())); |
| 206 | 207 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 stream->SetDelegate(&delegate_); | 482 stream->SetDelegate(&delegate_); |
| 482 base::MessageLoop::current()->RunUntilIdle(); | 483 base::MessageLoop::current()->RunUntilIdle(); |
| 483 | 484 |
| 484 // Times(2) because OnClose will be called for stream and stream_. | 485 // Times(2) because OnClose will be called for stream and stream_. |
| 485 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)).Times(2); | 486 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)).Times(2); |
| 486 } | 487 } |
| 487 | 488 |
| 488 } // namespace | 489 } // namespace |
| 489 } // namespace test | 490 } // namespace test |
| 490 } // namespace net | 491 } // namespace net |
| OLD | NEW |