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

Unified Diff: chrome/browser/net/http_server_properties_manager_unittest.cc

Issue 8770035: Save pipelining capabilities for the most used hosts between sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
Index: chrome/browser/net/http_server_properties_manager_unittest.cc
diff --git a/chrome/browser/net/http_server_properties_manager_unittest.cc b/chrome/browser/net/http_server_properties_manager_unittest.cc
index 98cb86b00d43164c1846f3c5010b9e789bdfad2f..e5f5593790374606741ccaa42382b620ec7c5f86 100644
--- a/chrome/browser/net/http_server_properties_manager_unittest.cc
+++ b/chrome/browser/net/http_server_properties_manager_unittest.cc
@@ -306,6 +306,33 @@ TEST_F(HttpServerPropertiesManagerTest, HasAlternateProtocol) {
EXPECT_EQ(net::NPN_SPDY_2, port_alternate_protocol.protocol);
}
+TEST_F(HttpServerPropertiesManagerTest, PipelineCapability) {
+ ExpectPrefsUpdate();
+
+ // Post an update task to the IO thread. SetPipelineCapability calls
+ // ScheduleUpdatePrefsOnIO.
mmenke 2011/12/02 21:52:10 Think it's a little clearer if you put this just a
James Simonsen 2011/12/03 03:16:00 Done.
+
+ net::HostPortPair known_pipeliner("pipeline.com", 8080);
+ net::HostPortPair bad_pipeliner("wordpress.com", 80);
+ EXPECT_EQ(net::HttpPipelinedHost::UNKNOWN,
+ http_server_props_manager_->GetPipelineCapability(known_pipeliner));
+ EXPECT_EQ(net::HttpPipelinedHost::UNKNOWN,
+ http_server_props_manager_->GetPipelineCapability(bad_pipeliner));
+ http_server_props_manager_->SetPipelineCapability(
+ known_pipeliner, net::HttpPipelinedHost::CAPABLE);
+ http_server_props_manager_->SetPipelineCapability(
+ bad_pipeliner, net::HttpPipelinedHost::INCAPABLE);
+
+ // Run the task.
+ loop_.RunAllPending();
+
+ EXPECT_EQ(net::HttpPipelinedHost::CAPABLE,
+ http_server_props_manager_->GetPipelineCapability(known_pipeliner));
+ EXPECT_EQ(net::HttpPipelinedHost::INCAPABLE,
+ http_server_props_manager_->GetPipelineCapability(bad_pipeliner));
+ Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
+}
+
TEST_F(HttpServerPropertiesManagerTest, Clear) {
ExpectPrefsUpdate();
@@ -321,6 +348,10 @@ TEST_F(HttpServerPropertiesManagerTest, Clear) {
spdy_settings.push_back(std::make_pair(id1, 31337));
http_server_props_manager_->SetSpdySettings(spdy_server_mail, spdy_settings);
+ net::HostPortPair known_pipeliner("pipeline.com", 8080);
+ http_server_props_manager_->SetPipelineCapability(
+ known_pipeliner, net::HttpPipelinedHost::CAPABLE);
+
// Run the task.
loop_.RunAllPending();
@@ -337,6 +368,9 @@ TEST_F(HttpServerPropertiesManagerTest, Clear) {
EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, id1_ret.flags());
EXPECT_EQ(31337U, spdy_setting1_ret.second);
+ EXPECT_EQ(net::HttpPipelinedHost::CAPABLE,
+ http_server_props_manager_->GetPipelineCapability(known_pipeliner));
+
Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
ExpectPrefsUpdate();
@@ -354,6 +388,9 @@ TEST_F(HttpServerPropertiesManagerTest, Clear) {
http_server_props_manager_->GetSpdySettings(spdy_server_mail);
EXPECT_EQ(0U, spdy_settings1_ret.size());
+ EXPECT_EQ(net::HttpPipelinedHost::UNKNOWN,
+ http_server_props_manager_->GetPipelineCapability(known_pipeliner));
+
Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
}

Powered by Google App Engine
This is Rietveld 408576698