| 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 <string> | 5 #include <string> |
| 6 #include <utility> | 6 #include <utility> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 4103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4114 DATA_FLAG_NONE // Data Flags | 4114 DATA_FLAG_NONE // Data Flags |
| 4115 }; | 4115 }; |
| 4116 | 4116 |
| 4117 BoundNetLog net_log; | 4117 BoundNetLog net_log; |
| 4118 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 4118 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 4119 net_log, GetParam(), NULL); | 4119 net_log, GetParam(), NULL); |
| 4120 helper.RunPreTestSetup(); | 4120 helper.RunPreTestSetup(); |
| 4121 | 4121 |
| 4122 // Verify that no settings exist initially. | 4122 // Verify that no settings exist initially. |
| 4123 HostPortPair host_port_pair("www.example.org", helper.port()); | 4123 HostPortPair host_port_pair("www.example.org", helper.port()); |
| 4124 url::SchemeHostPort scheme_origin("http", "www.example.org", helper.port()); |
| 4124 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4125 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
| 4125 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( | 4126 EXPECT_TRUE(spdy_session_pool->http_server_properties() |
| 4126 host_port_pair).empty()); | 4127 ->GetSpdySettings(scheme_origin) |
| 4128 .empty()); |
| 4127 | 4129 |
| 4128 // Construct the request. | 4130 // Construct the request. |
| 4129 scoped_ptr<SpdyFrame> req( | 4131 scoped_ptr<SpdyFrame> req( |
| 4130 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 4132 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 4131 MockWrite writes[] = {CreateMockWrite(*req, 0)}; | 4133 MockWrite writes[] = {CreateMockWrite(*req, 0)}; |
| 4132 | 4134 |
| 4133 // Construct the reply. | 4135 // Construct the reply. |
| 4134 scoped_ptr<SpdyHeaderBlock> reply_headers(new SpdyHeaderBlock()); | 4136 scoped_ptr<SpdyHeaderBlock> reply_headers(new SpdyHeaderBlock()); |
| 4135 (*reply_headers)[spdy_util_.GetStatusKey()] = "200"; | 4137 (*reply_headers)[spdy_util_.GetStatusKey()] = "200"; |
| 4136 (*reply_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; | 4138 (*reply_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4173 helper.VerifyDataConsumed(); | 4175 helper.VerifyDataConsumed(); |
| 4174 TransactionHelperResult out = helper.output(); | 4176 TransactionHelperResult out = helper.output(); |
| 4175 EXPECT_EQ(OK, out.rv); | 4177 EXPECT_EQ(OK, out.rv); |
| 4176 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 4178 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 4177 EXPECT_EQ("hello!", out.response_data); | 4179 EXPECT_EQ("hello!", out.response_data); |
| 4178 | 4180 |
| 4179 { | 4181 { |
| 4180 // Verify we had two persisted settings. | 4182 // Verify we had two persisted settings. |
| 4181 const SettingsMap& settings_map = | 4183 const SettingsMap& settings_map = |
| 4182 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4184 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4183 host_port_pair); | 4185 scheme_origin); |
| 4184 ASSERT_EQ(2u, settings_map.size()); | 4186 ASSERT_EQ(2u, settings_map.size()); |
| 4185 | 4187 |
| 4186 // Verify the first persisted setting. | 4188 // Verify the first persisted setting. |
| 4187 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); | 4189 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); |
| 4188 EXPECT_TRUE(it1 != settings_map.end()); | 4190 EXPECT_TRUE(it1 != settings_map.end()); |
| 4189 SettingsFlagsAndValue flags_and_value1 = it1->second; | 4191 SettingsFlagsAndValue flags_and_value1 = it1->second; |
| 4190 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); | 4192 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); |
| 4191 EXPECT_EQ(kSampleValue1, flags_and_value1.second); | 4193 EXPECT_EQ(kSampleValue1, flags_and_value1.second); |
| 4192 | 4194 |
| 4193 // Verify the second persisted setting. | 4195 // Verify the second persisted setting. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4224 net_log, GetParam(), NULL); | 4226 net_log, GetParam(), NULL); |
| 4225 helper.RunPreTestSetup(); | 4227 helper.RunPreTestSetup(); |
| 4226 | 4228 |
| 4227 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4229 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
| 4228 | 4230 |
| 4229 SpdySessionPoolPeer pool_peer(spdy_session_pool); | 4231 SpdySessionPoolPeer pool_peer(spdy_session_pool); |
| 4230 pool_peer.SetEnableSendingInitialData(true); | 4232 pool_peer.SetEnableSendingInitialData(true); |
| 4231 | 4233 |
| 4232 // Verify that no settings exist initially. | 4234 // Verify that no settings exist initially. |
| 4233 HostPortPair host_port_pair("www.example.org", helper.port()); | 4235 HostPortPair host_port_pair("www.example.org", helper.port()); |
| 4234 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( | 4236 url::SchemeHostPort scheme_origin("http", "www.example.org", helper.port()); |
| 4235 host_port_pair).empty()); | 4237 |
| 4238 EXPECT_TRUE(spdy_session_pool->http_server_properties() |
| 4239 ->GetSpdySettings(scheme_origin) |
| 4240 .empty()); |
| 4236 | 4241 |
| 4237 const SpdySettingsIds kSampleId1 = SETTINGS_MAX_CONCURRENT_STREAMS; | 4242 const SpdySettingsIds kSampleId1 = SETTINGS_MAX_CONCURRENT_STREAMS; |
| 4238 unsigned int kSampleValue1 = 0x0a0a0a0a; | 4243 unsigned int kSampleValue1 = 0x0a0a0a0a; |
| 4239 const SpdySettingsIds kSampleId2 = SETTINGS_INITIAL_WINDOW_SIZE; | 4244 const SpdySettingsIds kSampleId2 = SETTINGS_INITIAL_WINDOW_SIZE; |
| 4240 unsigned int kSampleValue2 = 0x0c0c0c0c; | 4245 unsigned int kSampleValue2 = 0x0c0c0c0c; |
| 4241 | 4246 |
| 4242 // First add a persisted setting. | 4247 // First add a persisted setting. |
| 4243 spdy_session_pool->http_server_properties()->SetSpdySetting( | 4248 spdy_session_pool->http_server_properties()->SetSpdySetting( |
| 4244 host_port_pair, | 4249 scheme_origin, kSampleId1, SETTINGS_FLAG_PLEASE_PERSIST, kSampleValue1); |
| 4245 kSampleId1, | |
| 4246 SETTINGS_FLAG_PLEASE_PERSIST, | |
| 4247 kSampleValue1); | |
| 4248 | 4250 |
| 4249 // Next add another persisted setting. | 4251 // Next add another persisted setting. |
| 4250 spdy_session_pool->http_server_properties()->SetSpdySetting( | 4252 spdy_session_pool->http_server_properties()->SetSpdySetting( |
| 4251 host_port_pair, | 4253 scheme_origin, kSampleId2, SETTINGS_FLAG_PLEASE_PERSIST, kSampleValue2); |
| 4252 kSampleId2, | |
| 4253 SETTINGS_FLAG_PLEASE_PERSIST, | |
| 4254 kSampleValue2); | |
| 4255 | 4254 |
| 4256 EXPECT_EQ(2u, spdy_session_pool->http_server_properties()->GetSpdySettings( | 4255 EXPECT_EQ(2u, spdy_session_pool->http_server_properties() |
| 4257 host_port_pair).size()); | 4256 ->GetSpdySettings(scheme_origin) |
| 4257 .size()); |
| 4258 | 4258 |
| 4259 // Construct the initial SETTINGS frame. | 4259 // Construct the initial SETTINGS frame. |
| 4260 SettingsMap initial_settings; | 4260 SettingsMap initial_settings; |
| 4261 initial_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = | 4261 initial_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = |
| 4262 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); | 4262 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); |
| 4263 scoped_ptr<SpdyFrame> initial_settings_frame( | 4263 scoped_ptr<SpdyFrame> initial_settings_frame( |
| 4264 spdy_util_.ConstructSpdySettings(initial_settings)); | 4264 spdy_util_.ConstructSpdySettings(initial_settings)); |
| 4265 | 4265 |
| 4266 // Construct the persisted SETTINGS frame. | 4266 // Construct the persisted SETTINGS frame. |
| 4267 const SettingsMap& settings = | 4267 const SettingsMap& settings = |
| 4268 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4268 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4269 host_port_pair); | 4269 scheme_origin); |
| 4270 scoped_ptr<SpdyFrame> settings_frame( | 4270 scoped_ptr<SpdyFrame> settings_frame( |
| 4271 spdy_util_.ConstructSpdySettings(settings)); | 4271 spdy_util_.ConstructSpdySettings(settings)); |
| 4272 | 4272 |
| 4273 // Construct the request. | 4273 // Construct the request. |
| 4274 scoped_ptr<SpdyFrame> req( | 4274 scoped_ptr<SpdyFrame> req( |
| 4275 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 4275 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 4276 | 4276 |
| 4277 MockWrite writes[] = { | 4277 MockWrite writes[] = { |
| 4278 CreateMockWrite(*initial_settings_frame, 0), | 4278 CreateMockWrite(*initial_settings_frame, 0), |
| 4279 CreateMockWrite(*settings_frame, 1), | 4279 CreateMockWrite(*settings_frame, 1), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 4300 helper.VerifyDataConsumed(); | 4300 helper.VerifyDataConsumed(); |
| 4301 TransactionHelperResult out = helper.output(); | 4301 TransactionHelperResult out = helper.output(); |
| 4302 EXPECT_EQ(OK, out.rv); | 4302 EXPECT_EQ(OK, out.rv); |
| 4303 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 4303 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 4304 EXPECT_EQ("hello!", out.response_data); | 4304 EXPECT_EQ("hello!", out.response_data); |
| 4305 | 4305 |
| 4306 { | 4306 { |
| 4307 // Verify we had two persisted settings. | 4307 // Verify we had two persisted settings. |
| 4308 const SettingsMap& settings_map = | 4308 const SettingsMap& settings_map = |
| 4309 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4309 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4310 host_port_pair); | 4310 scheme_origin); |
| 4311 ASSERT_EQ(2u, settings_map.size()); | 4311 ASSERT_EQ(2u, settings_map.size()); |
| 4312 | 4312 |
| 4313 // Verify the first persisted setting. | 4313 // Verify the first persisted setting. |
| 4314 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); | 4314 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); |
| 4315 EXPECT_TRUE(it1 != settings_map.end()); | 4315 EXPECT_TRUE(it1 != settings_map.end()); |
| 4316 SettingsFlagsAndValue flags_and_value1 = it1->second; | 4316 SettingsFlagsAndValue flags_and_value1 = it1->second; |
| 4317 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); | 4317 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); |
| 4318 EXPECT_EQ(kSampleValue1, flags_and_value1.second); | 4318 EXPECT_EQ(kSampleValue1, flags_and_value1.second); |
| 4319 | 4319 |
| 4320 // Verify the second persisted setting. | 4320 // Verify the second persisted setting. |
| (...skipping 2655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6976 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6976 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 6977 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6977 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
| 6978 new SSLSocketDataProvider(ASYNC, OK)); | 6978 new SSLSocketDataProvider(ASYNC, OK)); |
| 6979 // Set to TLS_RSA_WITH_NULL_MD5 | 6979 // Set to TLS_RSA_WITH_NULL_MD5 |
| 6980 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6980 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 6981 | 6981 |
| 6982 RunTLSUsageCheckTest(std::move(ssl_provider)); | 6982 RunTLSUsageCheckTest(std::move(ssl_provider)); |
| 6983 } | 6983 } |
| 6984 | 6984 |
| 6985 } // namespace net | 6985 } // namespace net |
| OLD | NEW |