Chromium Code Reviews| 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 new_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(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | |
| 537 id.set_id(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | |
| 538 const size_t max_concurrent_streams = 2; | |
| 539 test_settings.push_back(spdy::SpdySetting(id, max_concurrent_streams)); | |
| 540 | |
| 541 new_settings_storage.Set(test_host_port_pair, test_settings); | |
| 542 EXPECT_NE(0u, new_settings_storage.Get(test_host_port_pair).size()); | |
| 543 new_settings_storage.Clear(); | |
| 544 EXPECT_EQ(0u, new_settings_storage.Get(test_host_port_pair).size()); | |
| 545 } | |
| 546 | |
| 547 TEST_F(SpdySessionTest, ClearOnIPAddressChanged) { | |
|
wtc
2011/05/20 23:04:28
This test should be named ClearSettingsStorageOnIP
rkn1
2011/05/21 01:05:48
Done.
| |
| 548 SpdySessionDependencies session_deps; | |
| 549 session_deps.host_resolver->set_synchronous_mode(true); | |
| 550 | |
| 551 MockConnect connect_data(false, OK); | |
| 552 scoped_ptr<spdy::SpdyFrame> goaway(ConstructSpdyGoAway()); | |
| 553 MockRead reads[] = { | |
| 554 CreateMockRead(*goaway), | |
| 555 MockRead(false, 0, 0) // EOF | |
| 556 }; | |
| 557 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | |
| 558 data.set_connect_data(connect_data); | |
| 559 session_deps.socket_factory->AddSocketDataProvider(&data); | |
| 560 | |
| 561 SSLSocketDataProvider ssl(false, OK); | |
| 562 session_deps.socket_factory->AddSSLSocketDataProvider(&ssl); | |
| 563 | |
| 564 scoped_refptr<HttpNetworkSession> http_session( | |
| 565 SpdySessionDependencies::SpdyCreateSession(&session_deps)); | |
| 566 | |
| 567 const std::string kTestHost("www.foo.com"); | |
| 568 const int kTestPort = 80; | |
| 569 HostPortPair test_host_port_pair(kTestHost, kTestPort); | |
| 570 HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct()); | |
| 571 | |
| 572 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); | |
| 573 // All of the above code is copied from | |
| 574 // "TEST_F(SpdySessionTest, SpdyIOBuffer)" | |
| 575 // in order to create a SpdySessionPool object. | |
|
rkn1
2011/05/20 22:01:36
The above code in this test was copied from a test
wtc
2011/05/20 23:04:28
This comment is not necessary. (It's also wrong;
rkn1
2011/05/21 01:05:48
Done.
| |
| 576 | |
| 577 SpdySettingsStorage* test_settings_storage = | |
| 578 spdy_session_pool->mutable_spdy_settings(); | |
|
wtc
2011/05/20 23:04:28
This continuation line should be indented by 4 spa
rkn1
2011/05/21 01:05:48
Done.
| |
| 579 spdy::SettingsFlagsAndId id(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | |
| 580 id.set_id(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | |
| 581 const size_t max_concurrent_streams = 2; | |
| 582 spdy::SpdySettings test_settings; | |
| 583 test_settings.push_back(spdy::SpdySetting(id, max_concurrent_streams)); | |
| 584 | |
| 585 test_settings_storage->Set(test_host_port_pair, test_settings); | |
| 586 EXPECT_NE(0u, test_settings_storage->Get(test_host_port_pair).size()); | |
| 587 spdy_session_pool->OnIPAddressChanged(); | |
| 588 EXPECT_EQ(0u, test_settings_storage->Get(test_host_port_pair).size()); | |
| 589 | |
| 590 } | |
| 591 | |
| 530 } // namespace | 592 } // namespace |
| 531 | 593 |
| 532 } // namespace net | 594 } // namespace net |
| OLD | NEW |