| 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::MockHelper; | 20 using net::test::MockHelper; |
| 19 using net::test::SupportedVersions; | 21 using net::test::SupportedVersions; |
| 20 using net::test::kClientDataStreamId1; | 22 using net::test::kClientDataStreamId1; |
| 21 using net::test::kInitialSessionFlowControlWindowForTest; | 23 using net::test::kInitialSessionFlowControlWindowForTest; |
| 22 using net::test::kInitialStreamFlowControlWindowForTest; | 24 using net::test::kInitialStreamFlowControlWindowForTest; |
| 23 | 25 |
| 24 using std::string; | 26 using std::string; |
| 25 using testing::StrictMock; | 27 using testing::StrictMock; |
| 26 using testing::TestWithParam; | 28 using testing::TestWithParam; |
| 27 | 29 |
| 28 namespace net { | 30 namespace net { |
| 29 namespace tools { | 31 namespace tools { |
| 30 namespace test { | 32 namespace test { |
| 31 namespace { | 33 namespace { |
| 32 | 34 |
| 33 class QuicSpdyClientStreamTest : public ::testing::Test { | 35 class QuicSpdyClientStreamTest : public ::testing::Test { |
| 34 public: | 36 public: |
| 35 QuicSpdyClientStreamTest() | 37 QuicSpdyClientStreamTest() |
| 36 : connection_( | 38 : connection_( |
| 37 new StrictMock<MockConnection>(&helper_, Perspective::IS_CLIENT)), | 39 new StrictMock<MockConnection>(&helper_, Perspective::IS_CLIENT)), |
| 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_ = | 51 headers_string_ = |
| 49 net::tools::SpdyBalsaUtils::SerializeResponseHeaders(headers_); | 52 net::tools::SpdyBalsaUtils::SerializeResponseHeaders(headers_); |
| 50 | 53 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 113 |
| 111 EXPECT_FALSE(stream_->write_side_closed()); | 114 EXPECT_FALSE(stream_->write_side_closed()); |
| 112 stream_->OnStreamFrame(frame); | 115 stream_->OnStreamFrame(frame); |
| 113 EXPECT_TRUE(stream_->write_side_closed()); | 116 EXPECT_TRUE(stream_->write_side_closed()); |
| 114 } | 117 } |
| 115 | 118 |
| 116 } // namespace | 119 } // namespace |
| 117 } // namespace test | 120 } // namespace test |
| 118 } // namespace tools | 121 } // namespace tools |
| 119 } // namespace net | 122 } // namespace net |
| OLD | NEW |