| 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 "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 "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4082 new DelayedSocketData(1, reads, arraysize(reads), | 4082 new DelayedSocketData(1, reads, arraysize(reads), |
| 4083 writes, arraysize(writes))); | 4083 writes, arraysize(writes))); |
| 4084 helper.AddData(data.get()); | 4084 helper.AddData(data.get()); |
| 4085 helper.RunDefaultTest(); | 4085 helper.RunDefaultTest(); |
| 4086 helper.VerifyDataConsumed(); | 4086 helper.VerifyDataConsumed(); |
| 4087 TransactionHelperResult out = helper.output(); | 4087 TransactionHelperResult out = helper.output(); |
| 4088 EXPECT_EQ(OK, out.rv); | 4088 EXPECT_EQ(OK, out.rv); |
| 4089 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); | 4089 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); |
| 4090 EXPECT_EQ("hello!", out.response_data); | 4090 EXPECT_EQ("hello!", out.response_data); |
| 4091 | 4091 |
| 4092 // TODO(rtenneti): Persist spdy settings. |
| 4093 #ifdef PERSIST_SPDY_SETTINGS |
| 4092 { | 4094 { |
| 4093 // Verify we had two persisted settings. | 4095 // Verify we had two persisted settings. |
| 4094 spdy::SpdySettings saved_settings = | 4096 spdy::SpdySettings saved_settings = |
| 4095 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4097 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4096 host_port_pair); | 4098 host_port_pair); |
| 4097 ASSERT_EQ(2u, saved_settings.size()); | 4099 ASSERT_EQ(2u, saved_settings.size()); |
| 4098 | 4100 |
| 4099 // Verify the first persisted setting. | 4101 // Verify the first persisted setting. |
| 4100 spdy::SpdySetting setting = saved_settings.front(); | 4102 spdy::SpdySetting setting = saved_settings.front(); |
| 4101 saved_settings.pop_front(); | 4103 saved_settings.pop_front(); |
| 4102 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); | 4104 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); |
| 4103 EXPECT_EQ(kSampleId1, setting.first.id()); | 4105 EXPECT_EQ(kSampleId1, setting.first.id()); |
| 4104 EXPECT_EQ(kSampleValue1, setting.second); | 4106 EXPECT_EQ(kSampleValue1, setting.second); |
| 4105 | 4107 |
| 4106 // Verify the second persisted setting. | 4108 // Verify the second persisted setting. |
| 4107 setting = saved_settings.front(); | 4109 setting = saved_settings.front(); |
| 4108 saved_settings.pop_front(); | 4110 saved_settings.pop_front(); |
| 4109 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); | 4111 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); |
| 4110 EXPECT_EQ(kSampleId3, setting.first.id()); | 4112 EXPECT_EQ(kSampleId3, setting.first.id()); |
| 4111 EXPECT_EQ(kSampleValue3, setting.second); | 4113 EXPECT_EQ(kSampleValue3, setting.second); |
| 4112 } | 4114 } |
| 4115 #endif |
| 4113 } | 4116 } |
| 4114 | 4117 |
| 4115 // Test that when there are settings saved that they are sent back to the | 4118 // Test that when there are settings saved that they are sent back to the |
| 4116 // server upon session establishment. | 4119 // server upon session establishment. |
| 4117 TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsPlayback) { | 4120 TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsPlayback) { |
| 4118 static const SpdyHeaderInfo kSynReplyInfo = { | 4121 static const SpdyHeaderInfo kSynReplyInfo = { |
| 4119 spdy::SYN_REPLY, // Syn Reply | 4122 spdy::SYN_REPLY, // Syn Reply |
| 4120 1, // Stream ID | 4123 1, // Stream ID |
| 4121 0, // Associated Stream ID | 4124 0, // Associated Stream ID |
| 4122 net::ConvertRequestPriorityToSpdyPriority(LOWEST), | 4125 net::ConvertRequestPriorityToSpdyPriority(LOWEST), |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5498 << " Write index: " | 5501 << " Write index: " |
| 5499 << data->write_index(); | 5502 << data->write_index(); |
| 5500 | 5503 |
| 5501 // Verify the SYN_REPLY. | 5504 // Verify the SYN_REPLY. |
| 5502 HttpResponseInfo response = *trans->GetResponseInfo(); | 5505 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 5503 EXPECT_TRUE(response.headers != NULL); | 5506 EXPECT_TRUE(response.headers != NULL); |
| 5504 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); | 5507 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); |
| 5505 } | 5508 } |
| 5506 | 5509 |
| 5507 } // namespace net | 5510 } // namespace net |
| OLD | NEW |