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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "net/spdy/spdy_io_buffer.h" | 7 #include "net/spdy/spdy_io_buffer.h" |
8 #include "net/spdy/spdy_session_pool.h" | 8 #include "net/spdy/spdy_session_pool.h" |
9 #include "net/spdy/spdy_stream.h" | 9 #include "net/spdy/spdy_stream.h" |
10 #include "net/spdy/spdy_test_util.h" | 10 #include "net/spdy/spdy_test_util.h" |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 } | 520 } |
521 | 521 |
522 TEST_F(SpdySessionTest, IPPooling) { | 522 TEST_F(SpdySessionTest, IPPooling) { |
523 IPPoolingTest(false); | 523 IPPoolingTest(false); |
524 } | 524 } |
525 | 525 |
526 TEST_F(SpdySessionTest, IPPoolingCloseCurrentSessions) { | 526 TEST_F(SpdySessionTest, IPPoolingCloseCurrentSessions) { |
527 IPPoolingTest(true); | 527 IPPoolingTest(true); |
528 } | 528 } |
529 | 529 |
| 530 TEST_F(SpdySessionTest, ClearSettingsStorage) { |
| 531 SpdySettingsStorage settings_storage; |
| 532 const std::string kTestHost("www.foo.com"); |
| 533 const int kTestPort = 80; |
| 534 HostPortPair test_host_port_pair(kTestHost, kTestPort); |
| 535 spdy::SpdySettings test_settings; |
| 536 spdy::SettingsFlagsAndId id(0); |
| 537 id.set_id(spdy::SETTINGS_MAX_CONCURRENT_STREAMS); |
| 538 id.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); |
| 539 const size_t max_concurrent_streams = 2; |
| 540 test_settings.push_back(spdy::SpdySetting(id, max_concurrent_streams)); |
| 541 |
| 542 settings_storage.Set(test_host_port_pair, test_settings); |
| 543 EXPECT_NE(0u, settings_storage.Get(test_host_port_pair).size()); |
| 544 settings_storage.Clear(); |
| 545 EXPECT_EQ(0u, settings_storage.Get(test_host_port_pair).size()); |
| 546 } |
| 547 |
| 548 TEST_F(SpdySessionTest, ClearSettingsStorageOnIPAddressChanged) { |
| 549 const std::string kTestHost("www.foo.com"); |
| 550 const int kTestPort = 80; |
| 551 HostPortPair test_host_port_pair(kTestHost, kTestPort); |
| 552 |
| 553 SpdySessionDependencies session_deps; |
| 554 scoped_refptr<HttpNetworkSession> http_session( |
| 555 SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
| 556 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
| 557 |
| 558 SpdySettingsStorage* test_settings_storage = |
| 559 spdy_session_pool->mutable_spdy_settings(); |
| 560 spdy::SettingsFlagsAndId id(0); |
| 561 id.set_id(spdy::SETTINGS_MAX_CONCURRENT_STREAMS); |
| 562 id.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); |
| 563 const size_t max_concurrent_streams = 2; |
| 564 spdy::SpdySettings test_settings; |
| 565 test_settings.push_back(spdy::SpdySetting(id, max_concurrent_streams)); |
| 566 |
| 567 test_settings_storage->Set(test_host_port_pair, test_settings); |
| 568 EXPECT_NE(0u, test_settings_storage->Get(test_host_port_pair).size()); |
| 569 spdy_session_pool->OnIPAddressChanged(); |
| 570 EXPECT_EQ(0u, test_settings_storage->Get(test_host_port_pair).size()); |
| 571 } |
| 572 |
530 } // namespace | 573 } // namespace |
531 | 574 |
532 } // namespace net | 575 } // namespace net |
OLD | NEW |