| 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/spdy/spdy_stream.h" | 5 #include "net/spdy/spdy_stream.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // A function that takes a SpdyStream and the number of bytes which | 64 // A function that takes a SpdyStream and the number of bytes which |
| 65 // will unstall the next frame completely. | 65 // will unstall the next frame completely. |
| 66 typedef base::Callback<void(const base::WeakPtr<SpdyStream>&, int32_t)> | 66 typedef base::Callback<void(const base::WeakPtr<SpdyStream>&, int32_t)> |
| 67 UnstallFunction; | 67 UnstallFunction; |
| 68 | 68 |
| 69 SpdyStreamTest() | 69 SpdyStreamTest() |
| 70 : spdy_util_(GetProtocol(), GetDependenciesFromPriority()), | 70 : spdy_util_(GetProtocol(), GetDependenciesFromPriority()), |
| 71 session_deps_(GetProtocol()), | 71 session_deps_(GetProtocol()), |
| 72 session_(SpdySessionDependencies::SpdyCreateSession(&session_deps_)), | 72 session_(SpdySessionDependencies::SpdyCreateSession(&session_deps_)), |
| 73 offset_(0) { | 73 offset_(0) { |
| 74 SpdySession::SetPriorityDependencyDefaultForTesting( | 74 old_dependency_default_ = |
| 75 GetDependenciesFromPriority()); | 75 Http2PriorityDependencies::SetEnabledDefaultForTesting( |
| 76 GetDependenciesFromPriority()); |
| 76 } | 77 } |
| 77 | 78 |
| 78 ~SpdyStreamTest() { | 79 ~SpdyStreamTest() { |
| 79 SpdySession::SetPriorityDependencyDefaultForTesting(false); | 80 Http2PriorityDependencies::SetEnabledDefaultForTesting( |
| 81 old_dependency_default_); |
| 80 } | 82 } |
| 81 | 83 |
| 82 base::WeakPtr<SpdySession> CreateDefaultSpdySession() { | 84 base::WeakPtr<SpdySession> CreateDefaultSpdySession() { |
| 83 SpdySessionKey key(HostPortPair("www.example.org", 80), | 85 SpdySessionKey key(HostPortPair("www.example.org", 80), |
| 84 ProxyServer::Direct(), PRIVACY_MODE_DISABLED); | 86 ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
| 85 return CreateInsecureSpdySession(session_.get(), key, BoundNetLog()); | 87 return CreateInsecureSpdySession(session_.get(), key, BoundNetLog()); |
| 86 } | 88 } |
| 87 | 89 |
| 88 void TearDown() override { base::MessageLoop::current()->RunUntilIdle(); } | 90 void TearDown() override { base::MessageLoop::current()->RunUntilIdle(); } |
| 89 | 91 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 140 |
| 139 SpdyTestUtil spdy_util_; | 141 SpdyTestUtil spdy_util_; |
| 140 SpdySessionDependencies session_deps_; | 142 SpdySessionDependencies session_deps_; |
| 141 scoped_ptr<HttpNetworkSession> session_; | 143 scoped_ptr<HttpNetworkSession> session_; |
| 142 | 144 |
| 143 private: | 145 private: |
| 144 // Used by Add{Read,Write}() above. | 146 // Used by Add{Read,Write}() above. |
| 145 std::vector<MockWrite> writes_; | 147 std::vector<MockWrite> writes_; |
| 146 std::vector<MockRead> reads_; | 148 std::vector<MockRead> reads_; |
| 147 int offset_; | 149 int offset_; |
| 150 bool old_dependency_default_; |
| 148 }; | 151 }; |
| 149 | 152 |
| 150 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, | 153 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, |
| 151 SpdyStreamTest, | 154 SpdyStreamTest, |
| 152 testing::Values(kTestCaseSPDY31, | 155 testing::Values(kTestCaseSPDY31, |
| 153 kTestCaseHTTP2NoPriorityDependencies, | 156 kTestCaseHTTP2NoPriorityDependencies, |
| 154 kTestCaseHTTP2PriorityDependencies)); | 157 kTestCaseHTTP2PriorityDependencies)); |
| 155 | 158 |
| 156 TEST_P(SpdyStreamTest, SendDataAfterOpen) { | 159 TEST_P(SpdyStreamTest, SendDataAfterOpen) { |
| 157 GURL url(kStreamUrl); | 160 GURL url(kStreamUrl); |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 EXPECT_EQ(response_len, stream->raw_received_bytes()); | 1134 EXPECT_EQ(response_len, stream->raw_received_bytes()); |
| 1132 | 1135 |
| 1133 // FIN | 1136 // FIN |
| 1134 data.Resume(); | 1137 data.Resume(); |
| 1135 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose()); | 1138 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose()); |
| 1136 } | 1139 } |
| 1137 | 1140 |
| 1138 } // namespace test | 1141 } // namespace test |
| 1139 | 1142 |
| 1140 } // namespace net | 1143 } // namespace net |
| OLD | NEW |