| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| (...skipping 4188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4199 "version", "HTTP/1.1" | 4199 "version", "HTTP/1.1" |
| 4200 }; | 4200 }; |
| 4201 | 4201 |
| 4202 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 4202 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
| 4203 BoundNetLog(), GetParam()); | 4203 BoundNetLog(), GetParam()); |
| 4204 helper.RunPreTestSetup(); | 4204 helper.RunPreTestSetup(); |
| 4205 | 4205 |
| 4206 // Verify that no settings exist initially. | 4206 // Verify that no settings exist initially. |
| 4207 HostPortPair host_port_pair("www.google.com", helper.port()); | 4207 HostPortPair host_port_pair("www.google.com", helper.port()); |
| 4208 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4208 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
| 4209 EXPECT_TRUE(spdy_session_pool->spdy_settings().Get(host_port_pair).empty()); | 4209 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4210 host_port_pair).empty()); |
| 4210 | 4211 |
| 4211 // Construct the request. | 4212 // Construct the request. |
| 4212 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 4213 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 4213 MockWrite writes[] = { CreateMockWrite(*req) }; | 4214 MockWrite writes[] = { CreateMockWrite(*req) }; |
| 4214 | 4215 |
| 4215 // Construct the reply. | 4216 // Construct the reply. |
| 4216 scoped_ptr<spdy::SpdyFrame> reply( | 4217 scoped_ptr<spdy::SpdyFrame> reply( |
| 4217 ConstructSpdyPacket(kSynReplyInfo, | 4218 ConstructSpdyPacket(kSynReplyInfo, |
| 4218 kExtraHeaders, | 4219 kExtraHeaders, |
| 4219 arraysize(kExtraHeaders) / 2, | 4220 arraysize(kExtraHeaders) / 2, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4261 helper.RunDefaultTest(); | 4262 helper.RunDefaultTest(); |
| 4262 helper.VerifyDataConsumed(); | 4263 helper.VerifyDataConsumed(); |
| 4263 TransactionHelperResult out = helper.output(); | 4264 TransactionHelperResult out = helper.output(); |
| 4264 EXPECT_EQ(OK, out.rv); | 4265 EXPECT_EQ(OK, out.rv); |
| 4265 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); | 4266 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); |
| 4266 EXPECT_EQ("hello!", out.response_data); | 4267 EXPECT_EQ("hello!", out.response_data); |
| 4267 | 4268 |
| 4268 { | 4269 { |
| 4269 // Verify we had two persisted settings. | 4270 // Verify we had two persisted settings. |
| 4270 spdy::SpdySettings saved_settings = | 4271 spdy::SpdySettings saved_settings = |
| 4271 spdy_session_pool->spdy_settings().Get(host_port_pair); | 4272 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4273 host_port_pair); |
| 4272 ASSERT_EQ(2u, saved_settings.size()); | 4274 ASSERT_EQ(2u, saved_settings.size()); |
| 4273 | 4275 |
| 4274 // Verify the first persisted setting. | 4276 // Verify the first persisted setting. |
| 4275 spdy::SpdySetting setting = saved_settings.front(); | 4277 spdy::SpdySetting setting = saved_settings.front(); |
| 4276 saved_settings.pop_front(); | 4278 saved_settings.pop_front(); |
| 4277 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); | 4279 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); |
| 4278 EXPECT_EQ(kSampleId1, setting.first.id()); | 4280 EXPECT_EQ(kSampleId1, setting.first.id()); |
| 4279 EXPECT_EQ(kSampleValue1, setting.second); | 4281 EXPECT_EQ(kSampleValue1, setting.second); |
| 4280 | 4282 |
| 4281 // Verify the second persisted setting. | 4283 // Verify the second persisted setting. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4308 "version", "HTTP/1.1" | 4310 "version", "HTTP/1.1" |
| 4309 }; | 4311 }; |
| 4310 | 4312 |
| 4311 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 4313 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
| 4312 BoundNetLog(), GetParam()); | 4314 BoundNetLog(), GetParam()); |
| 4313 helper.RunPreTestSetup(); | 4315 helper.RunPreTestSetup(); |
| 4314 | 4316 |
| 4315 // Verify that no settings exist initially. | 4317 // Verify that no settings exist initially. |
| 4316 HostPortPair host_port_pair("www.google.com", helper.port()); | 4318 HostPortPair host_port_pair("www.google.com", helper.port()); |
| 4317 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4319 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
| 4318 EXPECT_TRUE(spdy_session_pool->spdy_settings().Get(host_port_pair).empty()); | 4320 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4321 host_port_pair).empty()); |
| 4319 | 4322 |
| 4320 unsigned int kSampleId1 = 0x1; | 4323 unsigned int kSampleId1 = 0x1; |
| 4321 unsigned int kSampleValue1 = 0x0a0a0a0a; | 4324 unsigned int kSampleValue1 = 0x0a0a0a0a; |
| 4322 unsigned int kSampleId2 = 0xababab; | 4325 unsigned int kSampleId2 = 0xababab; |
| 4323 unsigned int kSampleValue2 = 0x0c0c0c0c; | 4326 unsigned int kSampleValue2 = 0x0c0c0c0c; |
| 4324 // Manually insert settings into the SpdySettingsStorage here. | 4327 // Manually insert settings into the SpdySettingsStorage here. |
| 4325 { | 4328 { |
| 4326 spdy::SpdySettings settings; | 4329 spdy::SpdySettings settings; |
| 4327 spdy::SettingsFlagsAndId setting(0); | 4330 spdy::SettingsFlagsAndId setting(0); |
| 4328 // First add a persisted setting | 4331 // First add a persisted setting |
| 4329 setting.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | 4332 setting.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); |
| 4330 setting.set_id(kSampleId1); | 4333 setting.set_id(kSampleId1); |
| 4331 settings.push_back(std::make_pair(setting, kSampleValue1)); | 4334 settings.push_back(std::make_pair(setting, kSampleValue1)); |
| 4332 // Next add another persisted setting | 4335 // Next add another persisted setting |
| 4333 setting.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | 4336 setting.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); |
| 4334 setting.set_id(kSampleId2); | 4337 setting.set_id(kSampleId2); |
| 4335 settings.push_back(std::make_pair(setting, kSampleValue2)); | 4338 settings.push_back(std::make_pair(setting, kSampleValue2)); |
| 4336 | 4339 |
| 4337 spdy_session_pool->mutable_spdy_settings()->Set(host_port_pair, settings); | 4340 spdy_session_pool->http_server_properties()->SetSpdySettings( |
| 4341 host_port_pair, settings); |
| 4338 } | 4342 } |
| 4339 | 4343 |
| 4340 EXPECT_EQ(2u, spdy_session_pool->spdy_settings().Get(host_port_pair).size()); | 4344 EXPECT_EQ(2u, spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4345 host_port_pair).size()); |
| 4341 | 4346 |
| 4342 // Construct the SETTINGS frame. | 4347 // Construct the SETTINGS frame. |
| 4343 const spdy::SpdySettings& settings = | 4348 const spdy::SpdySettings& settings = |
| 4344 spdy_session_pool->spdy_settings().Get(host_port_pair); | 4349 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4350 host_port_pair); |
| 4345 scoped_ptr<spdy::SpdyFrame> settings_frame(ConstructSpdySettings(settings)); | 4351 scoped_ptr<spdy::SpdyFrame> settings_frame(ConstructSpdySettings(settings)); |
| 4346 | 4352 |
| 4347 // Construct the request. | 4353 // Construct the request. |
| 4348 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 4354 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 4349 | 4355 |
| 4350 MockWrite writes[] = { | 4356 MockWrite writes[] = { |
| 4351 CreateMockWrite(*settings_frame), | 4357 CreateMockWrite(*settings_frame), |
| 4352 CreateMockWrite(*req), | 4358 CreateMockWrite(*req), |
| 4353 }; | 4359 }; |
| 4354 | 4360 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4374 helper.RunDefaultTest(); | 4380 helper.RunDefaultTest(); |
| 4375 helper.VerifyDataConsumed(); | 4381 helper.VerifyDataConsumed(); |
| 4376 TransactionHelperResult out = helper.output(); | 4382 TransactionHelperResult out = helper.output(); |
| 4377 EXPECT_EQ(OK, out.rv); | 4383 EXPECT_EQ(OK, out.rv); |
| 4378 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); | 4384 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); |
| 4379 EXPECT_EQ("hello!", out.response_data); | 4385 EXPECT_EQ("hello!", out.response_data); |
| 4380 | 4386 |
| 4381 { | 4387 { |
| 4382 // Verify we had two persisted settings. | 4388 // Verify we had two persisted settings. |
| 4383 spdy::SpdySettings saved_settings = | 4389 spdy::SpdySettings saved_settings = |
| 4384 spdy_session_pool->spdy_settings().Get(host_port_pair); | 4390 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4391 host_port_pair); |
| 4385 ASSERT_EQ(2u, saved_settings.size()); | 4392 ASSERT_EQ(2u, saved_settings.size()); |
| 4386 | 4393 |
| 4387 // Verify the first persisted setting. | 4394 // Verify the first persisted setting. |
| 4388 spdy::SpdySetting setting = saved_settings.front(); | 4395 spdy::SpdySetting setting = saved_settings.front(); |
| 4389 saved_settings.pop_front(); | 4396 saved_settings.pop_front(); |
| 4390 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); | 4397 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); |
| 4391 EXPECT_EQ(kSampleId1, setting.first.id()); | 4398 EXPECT_EQ(kSampleId1, setting.first.id()); |
| 4392 EXPECT_EQ(kSampleValue1, setting.second); | 4399 EXPECT_EQ(kSampleValue1, setting.second); |
| 4393 | 4400 |
| 4394 // Verify the second persisted setting. | 4401 // Verify the second persisted setting. |
| (...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5655 << " Write index: " | 5662 << " Write index: " |
| 5656 << data->write_index(); | 5663 << data->write_index(); |
| 5657 | 5664 |
| 5658 // Verify the SYN_REPLY. | 5665 // Verify the SYN_REPLY. |
| 5659 HttpResponseInfo response = *trans->GetResponseInfo(); | 5666 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 5660 EXPECT_TRUE(response.headers != NULL); | 5667 EXPECT_TRUE(response.headers != NULL); |
| 5661 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); | 5668 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); |
| 5662 } | 5669 } |
| 5663 | 5670 |
| 5664 } // namespace net | 5671 } // namespace net |
| OLD | NEW |