Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Unified Diff: net/spdy/spdy_session_unittest.cc

Issue 7046016: I added a function "void SpdySettingsStorage::Clear()". I added a call to this function "spdy_set... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_settings_storage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,68 @@
IPPoolingTest(true);
}
+TEST_F(SpdySessionTest, ClearSettingsStorage) {
+ SpdySettingsStorage new_settings_storage;
+ 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);
+ 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, ClearOnIPAddressChanged) {
wtc 2011/05/20 23:04:28 This test should be named ClearSettingsStorageOnIP
rkn1 2011/05/21 01:05:48 Done.
+ SpdySessionDependencies session_deps;
+ session_deps.host_resolver->set_synchronous_mode(true);
+
+ MockConnect connect_data(false, OK);
+ scoped_ptr<spdy::SpdyFrame> goaway(ConstructSpdyGoAway());
+ MockRead reads[] = {
+ CreateMockRead(*goaway),
+ MockRead(false, 0, 0) // EOF
+ };
+ StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0);
+ data.set_connect_data(connect_data);
+ session_deps.socket_factory->AddSocketDataProvider(&data);
+
+ SSLSocketDataProvider ssl(false, OK);
+ session_deps.socket_factory->AddSSLSocketDataProvider(&ssl);
+
+ scoped_refptr<HttpNetworkSession> http_session(
+ SpdySessionDependencies::SpdyCreateSession(&session_deps));
+
+ 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());
+
+ SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool());
+ // All of the above code is copied from
+ // "TEST_F(SpdySessionTest, SpdyIOBuffer)"
+ // 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.
+
+ SpdySettingsStorage* test_settings_storage =
+ 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.
+ spdy::SettingsFlagsAndId id(spdy::SETTINGS_FLAG_PLEASE_PERSIST);
+ id.set_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
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_settings_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698