| 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" |
| 11 #include "net/quic/spdy_utils.h" | 11 #include "net/quic/spdy_utils.h" |
| 12 #include "net/quic/test_tools/crypto_test_utils.h" |
| 12 #include "net/quic/test_tools/quic_test_utils.h" | 13 #include "net/quic/test_tools/quic_test_utils.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gmock_mutant.h" | 15 #include "testing/gmock_mutant.h" |
| 15 | 16 |
| 16 using testing::AnyNumber; | 17 using testing::AnyNumber; |
| 17 using testing::CreateFunctor; | 18 using testing::CreateFunctor; |
| 18 using testing::Invoke; | 19 using testing::Invoke; |
| 19 using testing::Return; | 20 using testing::Return; |
| 20 using testing::StrEq; | 21 using testing::StrEq; |
| 21 using testing::_; | 22 using testing::_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 DISALLOW_COPY_AND_ASSIGN(MockDelegate); | 44 DISALLOW_COPY_AND_ASSIGN(MockDelegate); |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 class QuicReliableClientStreamTest | 47 class QuicReliableClientStreamTest |
| 47 : public ::testing::TestWithParam<QuicVersion> { | 48 : public ::testing::TestWithParam<QuicVersion> { |
| 48 public: | 49 public: |
| 49 QuicReliableClientStreamTest() | 50 QuicReliableClientStreamTest() |
| 50 : session_(new MockConnection(Perspective::IS_CLIENT, | 51 : session_(new MockConnection(Perspective::IS_CLIENT, |
| 51 SupportedVersions(GetParam()))) { | 52 SupportedVersions(GetParam()))), |
| 53 crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) { |
| 52 stream_ = | 54 stream_ = |
| 53 new QuicReliableClientStream(kTestStreamId, &session_, BoundNetLog()); | 55 new QuicReliableClientStream(kTestStreamId, &session_, BoundNetLog()); |
| 54 session_.ActivateStream(stream_); | 56 session_.ActivateStream(stream_); |
| 55 stream_->SetDelegate(&delegate_); | 57 stream_->SetDelegate(&delegate_); |
| 56 } | 58 } |
| 57 | 59 |
| 58 void InitializeHeaders() { | 60 void InitializeHeaders() { |
| 59 headers_[":host"] = "www.google.com"; | 61 headers_[":host"] = "www.google.com"; |
| 60 headers_[":path"] = "/index.hml"; | 62 headers_[":path"] = "/index.hml"; |
| 61 headers_[":scheme"] = "https"; | 63 headers_[":scheme"] = "https"; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce( | 231 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce( |
| 230 Return(QuicConsumedData(kDataLen, true))); | 232 Return(QuicConsumedData(kDataLen, true))); |
| 231 stream_->OnCanWrite(); | 233 stream_->OnCanWrite(); |
| 232 ASSERT_TRUE(callback.have_result()); | 234 ASSERT_TRUE(callback.have_result()); |
| 233 EXPECT_EQ(OK, callback.WaitForResult()); | 235 EXPECT_EQ(OK, callback.WaitForResult()); |
| 234 } | 236 } |
| 235 | 237 |
| 236 } // namespace | 238 } // namespace |
| 237 } // namespace test | 239 } // namespace test |
| 238 } // namespace net | 240 } // namespace net |
| OLD | NEW |