Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 1866983006: SHP 2: Change SpdySettingsMap to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SHP_1
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 spdy_server("https", host_port_pair.host(),
4125 host_port_pair.port());
4126
4124 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); 4127 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool();
4125 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( 4128 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings(
4126 host_port_pair).empty()); 4129 spdy_server).empty());
4127 4130
4128 // Construct the request. 4131 // Construct the request.
4129 scoped_ptr<SpdyFrame> req( 4132 scoped_ptr<SpdyFrame> req(
4130 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); 4133 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
4131 MockWrite writes[] = {CreateMockWrite(*req, 0)}; 4134 MockWrite writes[] = {CreateMockWrite(*req, 0)};
4132 4135
4133 // Construct the reply. 4136 // Construct the reply.
4134 scoped_ptr<SpdyHeaderBlock> reply_headers(new SpdyHeaderBlock()); 4137 scoped_ptr<SpdyHeaderBlock> reply_headers(new SpdyHeaderBlock());
4135 (*reply_headers)[spdy_util_.GetStatusKey()] = "200"; 4138 (*reply_headers)[spdy_util_.GetStatusKey()] = "200";
4136 (*reply_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; 4139 (*reply_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4173 helper.VerifyDataConsumed(); 4176 helper.VerifyDataConsumed();
4174 TransactionHelperResult out = helper.output(); 4177 TransactionHelperResult out = helper.output();
4175 EXPECT_EQ(OK, out.rv); 4178 EXPECT_EQ(OK, out.rv);
4176 EXPECT_EQ("HTTP/1.1 200", out.status_line); 4179 EXPECT_EQ("HTTP/1.1 200", out.status_line);
4177 EXPECT_EQ("hello!", out.response_data); 4180 EXPECT_EQ("hello!", out.response_data);
4178 4181
4179 { 4182 {
4180 // Verify we had two persisted settings. 4183 // Verify we had two persisted settings.
4181 const SettingsMap& settings_map = 4184 const SettingsMap& settings_map =
4182 spdy_session_pool->http_server_properties()->GetSpdySettings( 4185 spdy_session_pool->http_server_properties()->GetSpdySettings(
4183 host_port_pair); 4186 spdy_server);
4184 ASSERT_EQ(2u, settings_map.size()); 4187 ASSERT_EQ(2u, settings_map.size());
4185 4188
4186 // Verify the first persisted setting. 4189 // Verify the first persisted setting.
4187 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); 4190 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1);
4188 EXPECT_TRUE(it1 != settings_map.end()); 4191 EXPECT_TRUE(it1 != settings_map.end());
4189 SettingsFlagsAndValue flags_and_value1 = it1->second; 4192 SettingsFlagsAndValue flags_and_value1 = it1->second;
4190 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); 4193 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first);
4191 EXPECT_EQ(kSampleValue1, flags_and_value1.second); 4194 EXPECT_EQ(kSampleValue1, flags_and_value1.second);
4192 4195
4193 // Verify the second persisted setting. 4196 // Verify the second persisted setting.
(...skipping 30 matching lines...) Expand all
4224 net_log, GetParam(), NULL); 4227 net_log, GetParam(), NULL);
4225 helper.RunPreTestSetup(); 4228 helper.RunPreTestSetup();
4226 4229
4227 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); 4230 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool();
4228 4231
4229 SpdySessionPoolPeer pool_peer(spdy_session_pool); 4232 SpdySessionPoolPeer pool_peer(spdy_session_pool);
4230 pool_peer.SetEnableSendingInitialData(true); 4233 pool_peer.SetEnableSendingInitialData(true);
4231 4234
4232 // Verify that no settings exist initially. 4235 // Verify that no settings exist initially.
4233 HostPortPair host_port_pair("www.example.org", helper.port()); 4236 HostPortPair host_port_pair("www.example.org", helper.port());
4237 url::SchemeHostPort spdy_server("https", host_port_pair.host(),
4238 host_port_pair.port());
4234 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( 4239 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings(
4235 host_port_pair).empty()); 4240 spdy_server).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 spdy_server,
4245 kSampleId1, 4250 kSampleId1,
4246 SETTINGS_FLAG_PLEASE_PERSIST, 4251 SETTINGS_FLAG_PLEASE_PERSIST,
4247 kSampleValue1); 4252 kSampleValue1);
4248 4253
4249 // Next add another persisted setting. 4254 // Next add another persisted setting.
4250 spdy_session_pool->http_server_properties()->SetSpdySetting( 4255 spdy_session_pool->http_server_properties()->SetSpdySetting(
4251 host_port_pair, 4256 spdy_server,
4252 kSampleId2, 4257 kSampleId2,
4253 SETTINGS_FLAG_PLEASE_PERSIST, 4258 SETTINGS_FLAG_PLEASE_PERSIST,
4254 kSampleValue2); 4259 kSampleValue2);
4255 4260
4256 EXPECT_EQ(2u, spdy_session_pool->http_server_properties()->GetSpdySettings( 4261 EXPECT_EQ(2u, spdy_session_pool->http_server_properties()->GetSpdySettings(
4257 host_port_pair).size()); 4262 spdy_server).size());
4258 4263
4259 // Construct the initial SETTINGS frame. 4264 // Construct the initial SETTINGS frame.
4260 SettingsMap initial_settings; 4265 SettingsMap initial_settings;
4261 initial_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = 4266 initial_settings[SETTINGS_MAX_CONCURRENT_STREAMS] =
4262 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); 4267 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams);
4263 scoped_ptr<SpdyFrame> initial_settings_frame( 4268 scoped_ptr<SpdyFrame> initial_settings_frame(
4264 spdy_util_.ConstructSpdySettings(initial_settings)); 4269 spdy_util_.ConstructSpdySettings(initial_settings));
4265 4270
4266 // Construct the persisted SETTINGS frame. 4271 // Construct the persisted SETTINGS frame.
4267 const SettingsMap& settings = 4272 const SettingsMap& settings =
4268 spdy_session_pool->http_server_properties()->GetSpdySettings( 4273 spdy_session_pool->http_server_properties()->GetSpdySettings(spdy_server);
4269 host_port_pair);
4270 scoped_ptr<SpdyFrame> settings_frame( 4274 scoped_ptr<SpdyFrame> settings_frame(
4271 spdy_util_.ConstructSpdySettings(settings)); 4275 spdy_util_.ConstructSpdySettings(settings));
4272 4276
4273 // Construct the request. 4277 // Construct the request.
4274 scoped_ptr<SpdyFrame> req( 4278 scoped_ptr<SpdyFrame> req(
4275 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); 4279 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
4276 4280
4277 MockWrite writes[] = { 4281 MockWrite writes[] = {
4278 CreateMockWrite(*initial_settings_frame, 0), 4282 CreateMockWrite(*initial_settings_frame, 0),
4279 CreateMockWrite(*settings_frame, 1), 4283 CreateMockWrite(*settings_frame, 1),
(...skipping 20 matching lines...) Expand all
4300 helper.VerifyDataConsumed(); 4304 helper.VerifyDataConsumed();
4301 TransactionHelperResult out = helper.output(); 4305 TransactionHelperResult out = helper.output();
4302 EXPECT_EQ(OK, out.rv); 4306 EXPECT_EQ(OK, out.rv);
4303 EXPECT_EQ("HTTP/1.1 200", out.status_line); 4307 EXPECT_EQ("HTTP/1.1 200", out.status_line);
4304 EXPECT_EQ("hello!", out.response_data); 4308 EXPECT_EQ("hello!", out.response_data);
4305 4309
4306 { 4310 {
4307 // Verify we had two persisted settings. 4311 // Verify we had two persisted settings.
4308 const SettingsMap& settings_map = 4312 const SettingsMap& settings_map =
4309 spdy_session_pool->http_server_properties()->GetSpdySettings( 4313 spdy_session_pool->http_server_properties()->GetSpdySettings(
4310 host_port_pair); 4314 spdy_server);
4311 ASSERT_EQ(2u, settings_map.size()); 4315 ASSERT_EQ(2u, settings_map.size());
4312 4316
4313 // Verify the first persisted setting. 4317 // Verify the first persisted setting.
4314 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1); 4318 SettingsMap::const_iterator it1 = settings_map.find(kSampleId1);
4315 EXPECT_TRUE(it1 != settings_map.end()); 4319 EXPECT_TRUE(it1 != settings_map.end());
4316 SettingsFlagsAndValue flags_and_value1 = it1->second; 4320 SettingsFlagsAndValue flags_and_value1 = it1->second;
4317 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first); 4321 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value1.first);
4318 EXPECT_EQ(kSampleValue1, flags_and_value1.second); 4322 EXPECT_EQ(kSampleValue1, flags_and_value1.second);
4319 4323
4320 // Verify the second persisted setting. 4324 // Verify the second persisted setting.
(...skipping 2655 matching lines...) Expand 10 before | Expand all | Expand 10 after
6976 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { 6980 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) {
6977 scoped_ptr<SSLSocketDataProvider> ssl_provider( 6981 scoped_ptr<SSLSocketDataProvider> ssl_provider(
6978 new SSLSocketDataProvider(ASYNC, OK)); 6982 new SSLSocketDataProvider(ASYNC, OK));
6979 // Set to TLS_RSA_WITH_NULL_MD5 6983 // Set to TLS_RSA_WITH_NULL_MD5
6980 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); 6984 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status);
6981 6985
6982 RunTLSUsageCheckTest(std::move(ssl_provider)); 6986 RunTLSUsageCheckTest(std::move(ssl_provider));
6983 } 6987 }
6984 6988
6985 } // namespace net 6989 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698