| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_spdy_client_stream.h" | 5 #include "net/tools/quic/quic_spdy_client_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_utils.h" | 8 #include "net/quic/quic_utils.h" |
| 9 #include "net/quic/test_tools/crypto_test_utils.h" |
| 9 #include "net/quic/test_tools/quic_test_utils.h" | 10 #include "net/quic/test_tools/quic_test_utils.h" |
| 10 #include "net/tools/quic/quic_client_session.h" | 11 #include "net/tools/quic/quic_client_session.h" |
| 11 #include "net/tools/quic/quic_spdy_client_stream.h" | 12 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 12 #include "net/tools/quic/spdy_balsa_utils.h" | 13 #include "net/tools/quic/spdy_balsa_utils.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 17 using net::test::CryptoTestUtils; |
| 16 using net::test::DefaultQuicConfig; | 18 using net::test::DefaultQuicConfig; |
| 17 using net::test::MockConnection; | 19 using net::test::MockConnection; |
| 18 using net::test::SupportedVersions; | 20 using net::test::SupportedVersions; |
| 19 using net::test::kClientDataStreamId1; | 21 using net::test::kClientDataStreamId1; |
| 20 using net::test::kInitialSessionFlowControlWindowForTest; | 22 using net::test::kInitialSessionFlowControlWindowForTest; |
| 21 using net::test::kInitialStreamFlowControlWindowForTest; | 23 using net::test::kInitialStreamFlowControlWindowForTest; |
| 22 | 24 |
| 23 using std::string; | 25 using std::string; |
| 24 using testing::StrictMock; | 26 using testing::StrictMock; |
| 25 using testing::TestWithParam; | 27 using testing::TestWithParam; |
| 26 | 28 |
| 27 namespace net { | 29 namespace net { |
| 28 namespace tools { | 30 namespace tools { |
| 29 namespace test { | 31 namespace test { |
| 30 namespace { | 32 namespace { |
| 31 | 33 |
| 32 class QuicSpdyClientStreamTest : public TestWithParam<QuicVersion> { | 34 class QuicSpdyClientStreamTest : public TestWithParam<QuicVersion> { |
| 33 public: | 35 public: |
| 34 QuicSpdyClientStreamTest() | 36 QuicSpdyClientStreamTest() |
| 35 : connection_( | 37 : connection_( |
| 36 new StrictMock<MockConnection>(Perspective::IS_CLIENT, | 38 new StrictMock<MockConnection>(Perspective::IS_CLIENT, |
| 37 SupportedVersions(GetParam()))), | 39 SupportedVersions(GetParam()))), |
| 40 crypto_config_(CryptoTestUtils::ProofVerifierForTesting()), |
| 38 session_(DefaultQuicConfig(), | 41 session_(DefaultQuicConfig(), |
| 39 connection_, | 42 connection_, |
| 40 QuicServerId("example.com", 80, false, PRIVACY_MODE_DISABLED), | 43 QuicServerId("example.com", 80, PRIVACY_MODE_DISABLED), |
| 41 &crypto_config_), | 44 &crypto_config_), |
| 42 body_("hello world") { | 45 body_("hello world") { |
| 43 session_.Initialize(); | 46 session_.Initialize(); |
| 44 | 47 |
| 45 headers_.SetResponseFirstlineFromStringPieces("HTTP/1.1", "200", "Ok"); | 48 headers_.SetResponseFirstlineFromStringPieces("HTTP/1.1", "200", "Ok"); |
| 46 headers_.ReplaceOrAppendHeader("content-length", "11"); | 49 headers_.ReplaceOrAppendHeader("content-length", "11"); |
| 47 | 50 |
| 48 headers_string_ = net::tools::SpdyBalsaUtils::SerializeResponseHeaders( | 51 headers_string_ = net::tools::SpdyBalsaUtils::SerializeResponseHeaders( |
| 49 headers_, GetParam()); | 52 headers_, GetParam()); |
| 50 | 53 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 127 |
| 125 EXPECT_FALSE(stream_->write_side_closed()); | 128 EXPECT_FALSE(stream_->write_side_closed()); |
| 126 stream_->OnStreamFrame(frame); | 129 stream_->OnStreamFrame(frame); |
| 127 EXPECT_TRUE(stream_->write_side_closed()); | 130 EXPECT_TRUE(stream_->write_side_closed()); |
| 128 } | 131 } |
| 129 | 132 |
| 130 } // namespace | 133 } // namespace |
| 131 } // namespace test | 134 } // namespace test |
| 132 } // namespace tools | 135 } // namespace tools |
| 133 } // namespace net | 136 } // namespace net |
| OLD | NEW |