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_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 scoped_refptr<HttpNetworkSession> http_session_; | 174 scoped_refptr<HttpNetworkSession> http_session_; |
175 SpdySessionPool* spdy_session_pool_; | 175 SpdySessionPool* spdy_session_pool_; |
176 GURL test_url_; | 176 GURL test_url_; |
177 HostPortPair test_host_port_pair_; | 177 HostPortPair test_host_port_pair_; |
178 SpdySessionKey key_; | 178 SpdySessionKey key_; |
179 }; | 179 }; |
180 | 180 |
181 INSTANTIATE_TEST_CASE_P( | 181 INSTANTIATE_TEST_CASE_P( |
182 NextProto, | 182 NextProto, |
183 SpdySessionTest, | 183 SpdySessionTest, |
184 testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2, | 184 testing::Values(kProtoDeprecatedSPDY2, |
| 185 kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2, |
185 kProtoHTTP2Draft04)); | 186 kProtoHTTP2Draft04)); |
186 | 187 |
187 // Try to create a SPDY session that will fail during | 188 // Try to create a SPDY session that will fail during |
188 // initialization. Nothing should blow up. | 189 // initialization. Nothing should blow up. |
189 TEST_P(SpdySessionTest, InitialReadError) { | 190 TEST_P(SpdySessionTest, InitialReadError) { |
190 CreateDeterministicNetworkSession(); | 191 CreateDeterministicNetworkSession(); |
191 | 192 |
192 TryCreateFakeSpdySessionExpectingFailure( | 193 TryCreateFakeSpdySessionExpectingFailure( |
193 spdy_session_pool_, key_, ERR_FAILED); | 194 spdy_session_pool_, key_, ERR_FAILED); |
194 } | 195 } |
(...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 2699 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
2699 data.set_connect_data(connect_data); | 2700 data.set_connect_data(connect_data); |
2700 session_deps_.socket_factory->AddSocketDataProvider(&data); | 2701 session_deps_.socket_factory->AddSocketDataProvider(&data); |
2701 | 2702 |
2702 CreateNetworkSession(); | 2703 CreateNetworkSession(); |
2703 base::WeakPtr<SpdySession> session = | 2704 base::WeakPtr<SpdySession> session = |
2704 CreateFakeSpdySession(spdy_session_pool_, key_); | 2705 CreateFakeSpdySession(spdy_session_pool_, key_); |
2705 | 2706 |
2706 EXPECT_EQ(spdy_util_.spdy_version(), | 2707 EXPECT_EQ(spdy_util_.spdy_version(), |
2707 session->buffered_spdy_framer_->protocol_version()); | 2708 session->buffered_spdy_framer_->protocol_version()); |
2708 if (GetParam() == kProtoSPDY2) { | 2709 if (GetParam() == kProtoDeprecatedSPDY2) { |
2709 EXPECT_EQ(SpdySession::FLOW_CONTROL_NONE, session->flow_control_state()); | 2710 EXPECT_EQ(SpdySession::FLOW_CONTROL_NONE, session->flow_control_state()); |
2710 EXPECT_EQ(0, session->session_send_window_size_); | 2711 EXPECT_EQ(0, session->session_send_window_size_); |
2711 EXPECT_EQ(0, session->session_recv_window_size_); | 2712 EXPECT_EQ(0, session->session_recv_window_size_); |
2712 } else if (GetParam() == kProtoSPDY3) { | 2713 } else if (GetParam() == kProtoSPDY3) { |
2713 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM, session->flow_control_state()); | 2714 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM, session->flow_control_state()); |
2714 EXPECT_EQ(0, session->session_send_window_size_); | 2715 EXPECT_EQ(0, session->session_send_window_size_); |
2715 EXPECT_EQ(0, session->session_recv_window_size_); | 2716 EXPECT_EQ(0, session->session_recv_window_size_); |
2716 } else { | 2717 } else { |
2717 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION, | 2718 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION, |
2718 session->flow_control_state()); | 2719 session->flow_control_state()); |
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4209 EXPECT_TRUE(delegate1.send_headers_completed()); | 4210 EXPECT_TRUE(delegate1.send_headers_completed()); |
4210 EXPECT_EQ(std::string(), delegate1.TakeReceivedData()); | 4211 EXPECT_EQ(std::string(), delegate1.TakeReceivedData()); |
4211 | 4212 |
4212 EXPECT_TRUE(delegate2.send_headers_completed()); | 4213 EXPECT_TRUE(delegate2.send_headers_completed()); |
4213 EXPECT_EQ(std::string(), delegate2.TakeReceivedData()); | 4214 EXPECT_EQ(std::string(), delegate2.TakeReceivedData()); |
4214 | 4215 |
4215 EXPECT_TRUE(data.at_write_eof()); | 4216 EXPECT_TRUE(data.at_write_eof()); |
4216 } | 4217 } |
4217 | 4218 |
4218 } // namespace net | 4219 } // namespace net |
OLD | NEW |