| 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 4212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4223 DATA_FLAG_NONE // Data Flags | 4223 DATA_FLAG_NONE // Data Flags |
| 4224 }; | 4224 }; |
| 4225 | 4225 |
| 4226 BoundNetLog net_log; | 4226 BoundNetLog net_log; |
| 4227 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 4227 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 4228 net_log, GetParam(), NULL); | 4228 net_log, GetParam(), NULL); |
| 4229 helper.RunPreTestSetup(); | 4229 helper.RunPreTestSetup(); |
| 4230 | 4230 |
| 4231 // Verify that no settings exist initially. | 4231 // Verify that no settings exist initially. |
| 4232 HostPortPair host_port_pair("www.example.org", helper.port()); | 4232 HostPortPair host_port_pair("www.example.org", helper.port()); |
| 4233 url::SchemeHostPort spdy_server("https", host_port_pair.host(), |
| 4234 host_port_pair.port()); |
| 4235 |
| 4233 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4236 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
| 4234 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( | 4237 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4235 host_port_pair).empty()); | 4238 spdy_server).empty()); |
| 4236 | 4239 |
| 4237 // Construct the request. | 4240 // Construct the request. |
| 4238 std::unique_ptr<SpdySerializedFrame> req( | 4241 std::unique_ptr<SpdySerializedFrame> req( |
| 4239 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 4242 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 4240 MockWrite writes[] = {CreateMockWrite(*req, 0)}; | 4243 MockWrite writes[] = {CreateMockWrite(*req, 0)}; |
| 4241 | 4244 |
| 4242 // Construct the reply. | 4245 // Construct the reply. |
| 4243 std::unique_ptr<SpdyHeaderBlock> reply_headers(new SpdyHeaderBlock()); | 4246 std::unique_ptr<SpdyHeaderBlock> reply_headers(new SpdyHeaderBlock()); |
| 4244 (*reply_headers)[spdy_util_.GetStatusKey()] = "200"; | 4247 (*reply_headers)[spdy_util_.GetStatusKey()] = "200"; |
| 4245 (*reply_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; | 4248 (*reply_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4283 helper.VerifyDataConsumed(); | 4286 helper.VerifyDataConsumed(); |
| 4284 TransactionHelperResult out = helper.output(); | 4287 TransactionHelperResult out = helper.output(); |
| 4285 EXPECT_EQ(OK, out.rv); | 4288 EXPECT_EQ(OK, out.rv); |
| 4286 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 4289 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 4287 EXPECT_EQ("hello!", out.response_data); | 4290 EXPECT_EQ("hello!", out.response_data); |
| 4288 | 4291 |
| 4289 { | 4292 { |
| 4290 // Verify we had two persisted settings. | 4293 // Verify we had two persisted settings. |
| 4291 const SettingsMap& settings_map = | 4294 const SettingsMap& settings_map = |
| 4292 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4295 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4293 host_port_pair); | 4296 spdy_server); |
| 4294 ASSERT_EQ(2u, settings_map.size()); | 4297 ASSERT_EQ(2u, settings_map.size()); |
| 4295 | 4298 |
| 4296 // Verify the first persisted setting. | 4299 // Verify the first persisted setting. |
| 4297 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); | 4300 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); |
| 4298 EXPECT_TRUE(it1 != settings_map.end()); | 4301 EXPECT_TRUE(it1 != settings_map.end()); |
| 4299 SettingsFlagsAndValue flags_and_value1 = it1->second; | 4302 SettingsFlagsAndValue flags_and_value1 = it1->second; |
| 4300 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); | 4303 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); |
| 4301 EXPECT_EQ(kSampleValue1, flags_and_value1.second); | 4304 EXPECT_EQ(kSampleValue1, flags_and_value1.second); |
| 4302 | 4305 |
| 4303 // Verify the second persisted setting. | 4306 // Verify the second persisted setting. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4334 net_log, GetParam(), NULL); | 4337 net_log, GetParam(), NULL); |
| 4335 helper.RunPreTestSetup(); | 4338 helper.RunPreTestSetup(); |
| 4336 | 4339 |
| 4337 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4340 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
| 4338 | 4341 |
| 4339 SpdySessionPoolPeer pool_peer(spdy_session_pool); | 4342 SpdySessionPoolPeer pool_peer(spdy_session_pool); |
| 4340 pool_peer.SetEnableSendingInitialData(true); | 4343 pool_peer.SetEnableSendingInitialData(true); |
| 4341 | 4344 |
| 4342 // Verify that no settings exist initially. | 4345 // Verify that no settings exist initially. |
| 4343 HostPortPair host_port_pair("www.example.org", helper.port()); | 4346 HostPortPair host_port_pair("www.example.org", helper.port()); |
| 4347 url::SchemeHostPort spdy_server("https", host_port_pair.host(), |
| 4348 host_port_pair.port()); |
| 4344 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( | 4349 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4345 host_port_pair).empty()); | 4350 spdy_server).empty()); |
| 4346 | 4351 |
| 4347 const SpdySettingsIds kSampleId1 = SETTINGS_MAX_CONCURRENT_STREAMS; | 4352 const SpdySettingsIds kSampleId1 = SETTINGS_MAX_CONCURRENT_STREAMS; |
| 4348 unsigned int kSampleValue1 = 0x0a0a0a0a; | 4353 unsigned int kSampleValue1 = 0x0a0a0a0a; |
| 4349 const SpdySettingsIds kSampleId2 = SETTINGS_INITIAL_WINDOW_SIZE; | 4354 const SpdySettingsIds kSampleId2 = SETTINGS_INITIAL_WINDOW_SIZE; |
| 4350 unsigned int kSampleValue2 = 0x0c0c0c0c; | 4355 unsigned int kSampleValue2 = 0x0c0c0c0c; |
| 4351 | 4356 |
| 4352 // First add a persisted setting. | 4357 // First add a persisted setting. |
| 4353 spdy_session_pool->http_server_properties()->SetSpdySetting( | 4358 spdy_session_pool->http_server_properties()->SetSpdySetting( |
| 4354 host_port_pair, | 4359 spdy_server, |
| 4355 kSampleId1, | 4360 kSampleId1, |
| 4356 SETTINGS_FLAG_PLEASE_PERSIST, | 4361 SETTINGS_FLAG_PLEASE_PERSIST, |
| 4357 kSampleValue1); | 4362 kSampleValue1); |
| 4358 | 4363 |
| 4359 // Next add another persisted setting. | 4364 // Next add another persisted setting. |
| 4360 spdy_session_pool->http_server_properties()->SetSpdySetting( | 4365 spdy_session_pool->http_server_properties()->SetSpdySetting( |
| 4361 host_port_pair, | 4366 spdy_server, |
| 4362 kSampleId2, | 4367 kSampleId2, |
| 4363 SETTINGS_FLAG_PLEASE_PERSIST, | 4368 SETTINGS_FLAG_PLEASE_PERSIST, |
| 4364 kSampleValue2); | 4369 kSampleValue2); |
| 4365 | 4370 |
| 4366 EXPECT_EQ(2u, spdy_session_pool->http_server_properties()->GetSpdySettings( | 4371 EXPECT_EQ(2u, spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4367 host_port_pair).size()); | 4372 spdy_server).size()); |
| 4368 | 4373 |
| 4369 // Construct the initial SETTINGS frame. | 4374 // Construct the initial SETTINGS frame. |
| 4370 SettingsMap initial_settings; | 4375 SettingsMap initial_settings; |
| 4371 initial_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = | 4376 initial_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = |
| 4372 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); | 4377 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); |
| 4373 std::unique_ptr<SpdySerializedFrame> initial_settings_frame( | 4378 std::unique_ptr<SpdySerializedFrame> initial_settings_frame( |
| 4374 spdy_util_.ConstructSpdySettings(initial_settings)); | 4379 spdy_util_.ConstructSpdySettings(initial_settings)); |
| 4375 | 4380 |
| 4376 // Construct the persisted SETTINGS frame. | 4381 // Construct the persisted SETTINGS frame. |
| 4377 const SettingsMap& settings = | 4382 const SettingsMap& settings = |
| 4378 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4383 spdy_session_pool->http_server_properties()->GetSpdySettings(spdy_server); |
| 4379 host_port_pair); | |
| 4380 std::unique_ptr<SpdySerializedFrame> settings_frame( | 4384 std::unique_ptr<SpdySerializedFrame> settings_frame( |
| 4381 spdy_util_.ConstructSpdySettings(settings)); | 4385 spdy_util_.ConstructSpdySettings(settings)); |
| 4382 | 4386 |
| 4383 // Construct the request. | 4387 // Construct the request. |
| 4384 std::unique_ptr<SpdySerializedFrame> req( | 4388 std::unique_ptr<SpdySerializedFrame> req( |
| 4385 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 4389 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 4386 | 4390 |
| 4387 MockWrite writes[] = { | 4391 MockWrite writes[] = { |
| 4388 CreateMockWrite(*initial_settings_frame, 0), | 4392 CreateMockWrite(*initial_settings_frame, 0), |
| 4389 CreateMockWrite(*settings_frame, 1), | 4393 CreateMockWrite(*settings_frame, 1), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4411 helper.VerifyDataConsumed(); | 4415 helper.VerifyDataConsumed(); |
| 4412 TransactionHelperResult out = helper.output(); | 4416 TransactionHelperResult out = helper.output(); |
| 4413 EXPECT_EQ(OK, out.rv); | 4417 EXPECT_EQ(OK, out.rv); |
| 4414 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 4418 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 4415 EXPECT_EQ("hello!", out.response_data); | 4419 EXPECT_EQ("hello!", out.response_data); |
| 4416 | 4420 |
| 4417 { | 4421 { |
| 4418 // Verify we had two persisted settings. | 4422 // Verify we had two persisted settings. |
| 4419 const SettingsMap& settings_map = | 4423 const SettingsMap& settings_map = |
| 4420 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4424 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4421 host_port_pair); | 4425 spdy_server); |
| 4422 ASSERT_EQ(2u, settings_map.size()); | 4426 ASSERT_EQ(2u, settings_map.size()); |
| 4423 | 4427 |
| 4424 // Verify the first persisted setting. | 4428 // Verify the first persisted setting. |
| 4425 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); | 4429 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); |
| 4426 EXPECT_TRUE(it1 != settings_map.end()); | 4430 EXPECT_TRUE(it1 != settings_map.end()); |
| 4427 SettingsFlagsAndValue flags_and_value1 = it1->second; | 4431 SettingsFlagsAndValue flags_and_value1 = it1->second; |
| 4428 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); | 4432 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); |
| 4429 EXPECT_EQ(kSampleValue1, flags_and_value1.second); | 4433 EXPECT_EQ(kSampleValue1, flags_and_value1.second); |
| 4430 | 4434 |
| 4431 // Verify the second persisted setting. | 4435 // Verify the second persisted setting. |
| (...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7125 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 7129 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 7126 std::unique_ptr<SSLSocketDataProvider> ssl_provider( | 7130 std::unique_ptr<SSLSocketDataProvider> ssl_provider( |
| 7127 new SSLSocketDataProvider(ASYNC, OK)); | 7131 new SSLSocketDataProvider(ASYNC, OK)); |
| 7128 // Set to TLS_RSA_WITH_NULL_MD5 | 7132 // Set to TLS_RSA_WITH_NULL_MD5 |
| 7129 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 7133 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 7130 | 7134 |
| 7131 RunTLSUsageCheckTest(std::move(ssl_provider)); | 7135 RunTLSUsageCheckTest(std::move(ssl_provider)); |
| 7132 } | 7136 } |
| 7133 | 7137 |
| 7134 } // namespace net | 7138 } // namespace net |
| OLD | NEW |