| 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..c2b3d9040fc232953a1bf32b3d8e0df626ee2487 100644
|
| --- a/chrome/browser/net/http_server_properties_manager_unittest.cc
|
| +++ b/chrome/browser/net/http_server_properties_manager_unittest.cc
|
| @@ -60,14 +60,16 @@ class TestingHttpServerPropertiesManager : public HttpServerPropertiesManager {
|
|
|
| MOCK_METHOD0(UpdateCacheFromPrefsOnUI, void());
|
| MOCK_METHOD0(UpdatePrefsFromCacheOnIO, void());
|
| - MOCK_METHOD3(UpdateCacheFromPrefsOnIO,
|
| + MOCK_METHOD4(UpdateCacheFromPrefsOnIO,
|
| void(std::vector<std::string>* spdy_servers,
|
| net::SpdySettingsMap* spdy_settings_map,
|
| - net::AlternateProtocolMap* alternate_protocol_map));
|
| - MOCK_METHOD3(UpdatePrefsOnUI,
|
| + net::AlternateProtocolMap* alternate_protocol_map,
|
| + net::PipelineCapabilityMap* pipeline_capability_map));
|
| + MOCK_METHOD4(UpdatePrefsOnUI,
|
| void(base::ListValue* spdy_server_list,
|
| net::SpdySettingsMap* spdy_settings_map,
|
| - net::AlternateProtocolMap* alternate_protocol_map));
|
| + net::AlternateProtocolMap* alternate_protocol_map,
|
| + net::PipelineCapabilityMap* pipeline_capability_map));
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(TestingHttpServerPropertiesManager);
|
| @@ -152,6 +154,9 @@ TEST_F(HttpServerPropertiesManagerTest,
|
| server_pref_dict->SetWithoutPathExpansion(
|
| "alternate_protocol", alternate_protocol);
|
|
|
| + // Set pipeline capability for www.google.com:80.
|
| + server_pref_dict->SetInteger("pipeline_capability", net::PIPELINE_CAPABLE);
|
| +
|
| // Set the server preference for www.google.com:80.
|
| base::DictionaryValue* http_server_properties_dict =
|
| new base::DictionaryValue;
|
| @@ -181,6 +186,9 @@ TEST_F(HttpServerPropertiesManagerTest,
|
| server_pref_dict1->SetWithoutPathExpansion(
|
| "alternate_protocol", alternate_protocol1);
|
|
|
| + // Set pipelining capability for mail.google.com:80
|
| + server_pref_dict1->SetInteger("pipeline_capability", net::PIPELINE_INCAPABLE);
|
| +
|
| // Set the server preference for mail.google.com:80.
|
| http_server_properties_dict->SetWithoutPathExpansion(
|
| "mail.google.com:80", server_pref_dict1);
|
| @@ -238,6 +246,14 @@ TEST_F(HttpServerPropertiesManagerTest,
|
| net::HostPortPair::FromString("mail.google.com:80"));
|
| EXPECT_EQ(444, port_alternate_protocol.port);
|
| EXPECT_EQ(net::NPN_SPDY_2, port_alternate_protocol.protocol);
|
| +
|
| + // Verify pipeline capability.
|
| + EXPECT_EQ(net::PIPELINE_CAPABLE,
|
| + http_server_props_manager_->GetPipelineCapability(
|
| + net::HostPortPair::FromString("www.google.com:80")));
|
| + EXPECT_EQ(net::PIPELINE_INCAPABLE,
|
| + http_server_props_manager_->GetPipelineCapability(
|
| + net::HostPortPair::FromString("mail.google.com:80")));
|
| }
|
|
|
| TEST_F(HttpServerPropertiesManagerTest, SupportsSpdy) {
|
| @@ -306,6 +322,33 @@ TEST_F(HttpServerPropertiesManagerTest, HasAlternateProtocol) {
|
| EXPECT_EQ(net::NPN_SPDY_2, port_alternate_protocol.protocol);
|
| }
|
|
|
| +TEST_F(HttpServerPropertiesManagerTest, PipelineCapability) {
|
| + ExpectPrefsUpdate();
|
| +
|
| + net::HostPortPair known_pipeliner("pipeline.com", 8080);
|
| + net::HostPortPair bad_pipeliner("wordpress.com", 80);
|
| + EXPECT_EQ(net::PIPELINE_UNKNOWN,
|
| + http_server_props_manager_->GetPipelineCapability(known_pipeliner));
|
| + EXPECT_EQ(net::PIPELINE_UNKNOWN,
|
| + http_server_props_manager_->GetPipelineCapability(bad_pipeliner));
|
| +
|
| + // Post an update task to the IO thread. SetPipelineCapability calls
|
| + // ScheduleUpdatePrefsOnIO.
|
| + http_server_props_manager_->SetPipelineCapability(known_pipeliner,
|
| + net::PIPELINE_CAPABLE);
|
| + http_server_props_manager_->SetPipelineCapability(bad_pipeliner,
|
| + net::PIPELINE_INCAPABLE);
|
| +
|
| + // Run the task.
|
| + loop_.RunAllPending();
|
| +
|
| + EXPECT_EQ(net::PIPELINE_CAPABLE,
|
| + http_server_props_manager_->GetPipelineCapability(known_pipeliner));
|
| + EXPECT_EQ(net::PIPELINE_INCAPABLE,
|
| + http_server_props_manager_->GetPipelineCapability(bad_pipeliner));
|
| + Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
|
| +}
|
| +
|
| TEST_F(HttpServerPropertiesManagerTest, Clear) {
|
| ExpectPrefsUpdate();
|
|
|
| @@ -321,6 +364,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::PIPELINE_CAPABLE);
|
| +
|
| // Run the task.
|
| loop_.RunAllPending();
|
|
|
| @@ -337,6 +384,9 @@ TEST_F(HttpServerPropertiesManagerTest, Clear) {
|
| EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, id1_ret.flags());
|
| EXPECT_EQ(31337U, spdy_setting1_ret.second);
|
|
|
| + EXPECT_EQ(net::PIPELINE_CAPABLE,
|
| + http_server_props_manager_->GetPipelineCapability(known_pipeliner));
|
| +
|
| Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
|
|
|
| ExpectPrefsUpdate();
|
| @@ -354,6 +404,9 @@ TEST_F(HttpServerPropertiesManagerTest, Clear) {
|
| http_server_props_manager_->GetSpdySettings(spdy_server_mail);
|
| EXPECT_EQ(0U, spdy_settings1_ret.size());
|
|
|
| + EXPECT_EQ(net::PIPELINE_UNKNOWN,
|
| + http_server_props_manager_->GetPipelineCapability(known_pipeliner));
|
| +
|
| Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
|
| }
|
|
|
|
|