| 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/spdy/spdy_http_stream.h" | 5 #include "net/spdy/spdy_http_stream.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace | 77 } // namespace |
| 78 | 78 |
| 79 class SpdyHttpStreamTest : public testing::Test, | 79 class SpdyHttpStreamTest : public testing::Test, |
| 80 public testing::WithParamInterface<TestCase> { | 80 public testing::WithParamInterface<TestCase> { |
| 81 public: | 81 public: |
| 82 SpdyHttpStreamTest() | 82 SpdyHttpStreamTest() |
| 83 : spdy_util_(GetProtocol(), GetDependenciesFromPriority()), | 83 : spdy_util_(GetProtocol(), GetDependenciesFromPriority()), |
| 84 session_deps_(GetProtocol()) { | 84 session_deps_(GetProtocol()) { |
| 85 SpdySession::SetPriorityDependencyDefaultForTesting( | 85 old_dependency_default_ = |
| 86 GetDependenciesFromPriority()); | 86 Http2PriorityDependencies::SetEnabledDefaultForTesting( |
| 87 GetDependenciesFromPriority()); |
| 87 session_deps_.net_log = &net_log_; | 88 session_deps_.net_log = &net_log_; |
| 88 } | 89 } |
| 89 | 90 |
| 90 ~SpdyHttpStreamTest() { | 91 ~SpdyHttpStreamTest() { |
| 91 SpdySession::SetPriorityDependencyDefaultForTesting(false); | 92 Http2PriorityDependencies::SetEnabledDefaultForTesting( |
| 93 old_dependency_default_); |
| 92 } | 94 } |
| 93 | 95 |
| 94 protected: | 96 protected: |
| 95 NextProto GetProtocol() const { | 97 NextProto GetProtocol() const { |
| 96 return GetParam() == kTestCaseSPDY31 ? kProtoSPDY31 : kProtoHTTP2; | 98 return GetParam() == kTestCaseSPDY31 ? kProtoSPDY31 : kProtoHTTP2; |
| 97 } | 99 } |
| 98 | 100 |
| 99 bool GetDependenciesFromPriority() const { | 101 bool GetDependenciesFromPriority() const { |
| 100 return GetParam() == kTestCaseHTTP2PriorityDependencies; | 102 return GetParam() == kTestCaseHTTP2PriorityDependencies; |
| 101 } | 103 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 128 | 130 |
| 129 SpdyTestUtil spdy_util_; | 131 SpdyTestUtil spdy_util_; |
| 130 TestNetLog net_log_; | 132 TestNetLog net_log_; |
| 131 SpdySessionDependencies session_deps_; | 133 SpdySessionDependencies session_deps_; |
| 132 scoped_ptr<SequencedSocketData> sequenced_data_; | 134 scoped_ptr<SequencedSocketData> sequenced_data_; |
| 133 scoped_ptr<HttpNetworkSession> http_session_; | 135 scoped_ptr<HttpNetworkSession> http_session_; |
| 134 base::WeakPtr<SpdySession> session_; | 136 base::WeakPtr<SpdySession> session_; |
| 135 | 137 |
| 136 private: | 138 private: |
| 137 MockECSignatureCreatorFactory ec_signature_creator_factory_; | 139 MockECSignatureCreatorFactory ec_signature_creator_factory_; |
| 140 bool old_dependency_default_; |
| 138 }; | 141 }; |
| 139 | 142 |
| 140 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, | 143 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, |
| 141 SpdyHttpStreamTest, | 144 SpdyHttpStreamTest, |
| 142 testing::Values(kTestCaseSPDY31, | 145 testing::Values(kTestCaseSPDY31, |
| 143 kTestCaseHTTP2NoPriorityDependencies, | 146 kTestCaseHTTP2NoPriorityDependencies, |
| 144 kTestCaseHTTP2PriorityDependencies)); | 147 kTestCaseHTTP2PriorityDependencies)); |
| 145 | 148 |
| 146 // SpdyHttpStream::GetUploadProgress() should still work even before the | 149 // SpdyHttpStream::GetUploadProgress() should still work even before the |
| 147 // stream is initialized. | 150 // stream is initialized. |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); | 865 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); |
| 863 | 866 |
| 864 ASSERT_TRUE(response.headers.get()); | 867 ASSERT_TRUE(response.headers.get()); |
| 865 ASSERT_EQ(200, response.headers->response_code()); | 868 ASSERT_EQ(200, response.headers->response_code()); |
| 866 } | 869 } |
| 867 | 870 |
| 868 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 871 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
| 869 // methods. | 872 // methods. |
| 870 | 873 |
| 871 } // namespace net | 874 } // namespace net |
| OLD | NEW |