Chromium Code Reviews| Index: net/spdy/spdy_session_unittest.cc |
| =================================================================== |
| --- net/spdy/spdy_session_unittest.cc (revision 85710) |
| +++ net/spdy/spdy_session_unittest.cc (working copy) |
| @@ -527,6 +527,47 @@ |
| IPPoolingTest(true); |
| } |
| +TEST_F(SpdySessionTest, ClearSettingsStorage) { |
| + SpdySettingsStorage new_settings_storage; |
|
wtc
2011/05/21 01:38:33
Nit: please remove "new_" from the variable name.
rkn1
2011/05/21 01:54:40
Done.
|
| + const std::string kTestHost("www.foo.com"); |
| + const int kTestPort = 80; |
| + HostPortPair test_host_port_pair(kTestHost, kTestPort); |
| + spdy::SpdySettings test_settings; |
| + spdy::SettingsFlagsAndId id(spdy::SETTINGS_FLAG_PLEASE_PERSIST); |
| + id.set_id(spdy::SETTINGS_FLAG_PLEASE_PERSIST); |
|
wtc
2011/05/21 01:38:33
This comment also applies to the next unit test.
rkn1
2011/05/21 01:54:40
Done.
|
| + const size_t max_concurrent_streams = 2; |
| + test_settings.push_back(spdy::SpdySetting(id, max_concurrent_streams)); |
| + |
| + new_settings_storage.Set(test_host_port_pair, test_settings); |
| + EXPECT_NE(0u, new_settings_storage.Get(test_host_port_pair).size()); |
| + new_settings_storage.Clear(); |
| + EXPECT_EQ(0u, new_settings_storage.Get(test_host_port_pair).size()); |
| +} |
| + |
| +TEST_F(SpdySessionTest, ClearSettingsStorageOnIPAddressChanged) { |
| + const std::string kTestHost("www.foo.com"); |
| + const int kTestPort = 80; |
| + HostPortPair test_host_port_pair(kTestHost, kTestPort); |
| + HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct()); |
|
wtc
2011/05/21 01:38:33
Delete this line. The 'pair' variable is not used
rkn1
2011/05/21 01:54:40
Done.
|
| + |
| + SpdySessionDependencies session_deps; |
| + scoped_refptr<HttpNetworkSession> http_session( |
| + SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
| + SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
| + |
| + SpdySettingsStorage* test_settings_storage = |
| + spdy_session_pool->mutable_spdy_settings(); |
| + spdy::SettingsFlagsAndId id(spdy::SETTINGS_FLAG_PLEASE_PERSIST); |
| + const size_t max_concurrent_streams = 2; |
| + spdy::SpdySettings test_settings; |
| + test_settings.push_back(spdy::SpdySetting(id, max_concurrent_streams)); |
| + |
| + test_settings_storage->Set(test_host_port_pair, test_settings); |
| + EXPECT_NE(0u, test_settings_storage->Get(test_host_port_pair).size()); |
| + spdy_session_pool->OnIPAddressChanged(); |
| + EXPECT_EQ(0u, test_settings_storage->Get(test_host_port_pair).size()); |
| +} |
| + |
| } // namespace |
| } // namespace net |