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 4435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4446 new DelayedSocketData(1, reads, arraysize(reads), | 4446 new DelayedSocketData(1, reads, arraysize(reads), |
4447 writes, arraysize(writes))); | 4447 writes, arraysize(writes))); |
4448 helper.AddData(data.get()); | 4448 helper.AddData(data.get()); |
4449 helper.RunDefaultTest(); | 4449 helper.RunDefaultTest(); |
4450 helper.VerifyDataConsumed(); | 4450 helper.VerifyDataConsumed(); |
4451 TransactionHelperResult out = helper.output(); | 4451 TransactionHelperResult out = helper.output(); |
4452 EXPECT_EQ(OK, out.rv); | 4452 EXPECT_EQ(OK, out.rv); |
4453 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); | 4453 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); |
4454 EXPECT_EQ("hello!", out.response_data); | 4454 EXPECT_EQ("hello!", out.response_data); |
4455 | 4455 |
| 4456 // TODO(rtenneti): Persist spdy settings. |
| 4457 #ifdef PERSIST_SPDY_SETTINGS |
4456 { | 4458 { |
4457 // Verify we had two persisted settings. | 4459 // Verify we had two persisted settings. |
4458 spdy::SpdySettings saved_settings = | 4460 spdy::SpdySettings saved_settings = |
4459 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4461 spdy_session_pool->http_server_properties()->GetSpdySettings( |
4460 host_port_pair); | 4462 host_port_pair); |
4461 ASSERT_EQ(2u, saved_settings.size()); | 4463 ASSERT_EQ(2u, saved_settings.size()); |
4462 | 4464 |
4463 // Verify the first persisted setting. | 4465 // Verify the first persisted setting. |
4464 spdy::SpdySetting setting = saved_settings.front(); | 4466 spdy::SpdySetting setting = saved_settings.front(); |
4465 saved_settings.pop_front(); | 4467 saved_settings.pop_front(); |
4466 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); | 4468 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); |
4467 EXPECT_EQ(kSampleId1, setting.first.id()); | 4469 EXPECT_EQ(kSampleId1, setting.first.id()); |
4468 EXPECT_EQ(kSampleValue1, setting.second); | 4470 EXPECT_EQ(kSampleValue1, setting.second); |
4469 | 4471 |
4470 // Verify the second persisted setting. | 4472 // Verify the second persisted setting. |
4471 setting = saved_settings.front(); | 4473 setting = saved_settings.front(); |
4472 saved_settings.pop_front(); | 4474 saved_settings.pop_front(); |
4473 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); | 4475 EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, setting.first.flags()); |
4474 EXPECT_EQ(kSampleId3, setting.first.id()); | 4476 EXPECT_EQ(kSampleId3, setting.first.id()); |
4475 EXPECT_EQ(kSampleValue3, setting.second); | 4477 EXPECT_EQ(kSampleValue3, setting.second); |
4476 } | 4478 } |
| 4479 #endif |
4477 } | 4480 } |
4478 | 4481 |
4479 // Test that when there are settings saved that they are sent back to the | 4482 // Test that when there are settings saved that they are sent back to the |
4480 // server upon session establishment. | 4483 // server upon session establishment. |
4481 TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsPlayback) { | 4484 TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsPlayback) { |
4482 static const SpdyHeaderInfo kSynReplyInfo = { | 4485 static const SpdyHeaderInfo kSynReplyInfo = { |
4483 spdy::SYN_REPLY, // Syn Reply | 4486 spdy::SYN_REPLY, // Syn Reply |
4484 1, // Stream ID | 4487 1, // Stream ID |
4485 0, // Associated Stream ID | 4488 0, // Associated Stream ID |
4486 net::ConvertRequestPriorityToSpdyPriority(LOWEST), | 4489 net::ConvertRequestPriorityToSpdyPriority(LOWEST), |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5862 << " Write index: " | 5865 << " Write index: " |
5863 << data->write_index(); | 5866 << data->write_index(); |
5864 | 5867 |
5865 // Verify the SYN_REPLY. | 5868 // Verify the SYN_REPLY. |
5866 HttpResponseInfo response = *trans->GetResponseInfo(); | 5869 HttpResponseInfo response = *trans->GetResponseInfo(); |
5867 EXPECT_TRUE(response.headers != NULL); | 5870 EXPECT_TRUE(response.headers != NULL); |
5868 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); | 5871 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); |
5869 } | 5872 } |
5870 | 5873 |
5871 } // namespace net | 5874 } // namespace net |
OLD | NEW |