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 <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 4397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4408 EXPECT_TRUE(it3 != settings_map.end()); | 4408 EXPECT_TRUE(it3 != settings_map.end()); |
4409 SettingsFlagsAndValue flags_and_value3 = it3->second; | 4409 SettingsFlagsAndValue flags_and_value3 = it3->second; |
4410 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value3.first); | 4410 EXPECT_EQ(SETTINGS_FLAG_PERSISTED, flags_and_value3.first); |
4411 EXPECT_EQ(kSampleValue3, flags_and_value3.second); | 4411 EXPECT_EQ(kSampleValue3, flags_and_value3.second); |
4412 } | 4412 } |
4413 } | 4413 } |
4414 | 4414 |
4415 // Test that when there are settings saved that they are sent back to the | 4415 // Test that when there are settings saved that they are sent back to the |
4416 // server upon session establishment. | 4416 // server upon session establishment. |
4417 TEST_P(SpdyNetworkTransactionTest, SettingsPlayback) { | 4417 TEST_P(SpdyNetworkTransactionTest, SettingsPlayback) { |
| 4418 // TODO(jgraettinger): Remove settings persistence mechanisms altogether. |
4418 static const SpdyHeaderInfo kSynReplyInfo = { | 4419 static const SpdyHeaderInfo kSynReplyInfo = { |
4419 SYN_REPLY, // Syn Reply | 4420 SYN_REPLY, // Syn Reply |
4420 1, // Stream ID | 4421 1, // Stream ID |
4421 0, // Associated Stream ID | 4422 0, // Associated Stream ID |
4422 ConvertRequestPriorityToSpdyPriority( | 4423 ConvertRequestPriorityToSpdyPriority( |
4423 LOWEST, spdy_util_.spdy_version()), | 4424 LOWEST, spdy_util_.spdy_version()), |
4424 kSpdyCredentialSlotUnused, | 4425 kSpdyCredentialSlotUnused, |
4425 CONTROL_FLAG_NONE, // Control Flags | 4426 CONTROL_FLAG_NONE, // Control Flags |
4426 false, // Compressed | 4427 false, // Compressed |
4427 RST_STREAM_INVALID, // Status | 4428 RST_STREAM_INVALID, // Status |
(...skipping 10 matching lines...) Expand all Loading... |
4438 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4439 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
4439 | 4440 |
4440 SpdySessionPoolPeer pool_peer(spdy_session_pool); | 4441 SpdySessionPoolPeer pool_peer(spdy_session_pool); |
4441 pool_peer.SetEnableSendingInitialData(true); | 4442 pool_peer.SetEnableSendingInitialData(true); |
4442 | 4443 |
4443 // Verify that no settings exist initially. | 4444 // Verify that no settings exist initially. |
4444 HostPortPair host_port_pair("www.google.com", helper.port()); | 4445 HostPortPair host_port_pair("www.google.com", helper.port()); |
4445 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( | 4446 EXPECT_TRUE(spdy_session_pool->http_server_properties()->GetSpdySettings( |
4446 host_port_pair).empty()); | 4447 host_port_pair).empty()); |
4447 | 4448 |
4448 const SpdySettingsIds kSampleId1 = SETTINGS_UPLOAD_BANDWIDTH; | 4449 const SpdySettingsIds kSampleId1 = SETTINGS_MAX_CONCURRENT_STREAMS; |
4449 unsigned int kSampleValue1 = 0x0a0a0a0a; | 4450 unsigned int kSampleValue1 = 0x0a0a0a0a; |
4450 const SpdySettingsIds kSampleId2 = SETTINGS_ROUND_TRIP_TIME; | 4451 const SpdySettingsIds kSampleId2 = SETTINGS_INITIAL_WINDOW_SIZE; |
4451 unsigned int kSampleValue2 = 0x0c0c0c0c; | 4452 unsigned int kSampleValue2 = 0x0c0c0c0c; |
4452 | 4453 |
4453 // First add a persisted setting. | 4454 // First add a persisted setting. |
4454 spdy_session_pool->http_server_properties()->SetSpdySetting( | 4455 spdy_session_pool->http_server_properties()->SetSpdySetting( |
4455 host_port_pair, | 4456 host_port_pair, |
4456 kSampleId1, | 4457 kSampleId1, |
4457 SETTINGS_FLAG_PLEASE_PERSIST, | 4458 SETTINGS_FLAG_PLEASE_PERSIST, |
4458 kSampleValue1); | 4459 kSampleValue1); |
4459 | 4460 |
4460 // Next add another persisted setting. | 4461 // Next add another persisted setting. |
(...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6550 // since we're send-stalled. | 6551 // since we're send-stalled. |
6551 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); | 6552 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); |
6552 | 6553 |
6553 // Read in WINDOW_UPDATE or SETTINGS frame. | 6554 // Read in WINDOW_UPDATE or SETTINGS frame. |
6554 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); | 6555 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); |
6555 rv = callback.WaitForResult(); | 6556 rv = callback.WaitForResult(); |
6556 helper.VerifyDataConsumed(); | 6557 helper.VerifyDataConsumed(); |
6557 } | 6558 } |
6558 | 6559 |
6559 } // namespace net | 6560 } // namespace net |
OLD | NEW |