diff options
author | rtenneti <rtenneti@chromium.org> | 2015-06-05 14:55:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-05 21:57:19 +0000 |
commit | cefb99b8043239c486ce4b43ca758dd2d4d0d635 (patch) | |
tree | 4e2697c55e767453bd7930ce5a86809d0188f78f /net/http/http_server_properties_manager_unittest.cc | |
parent | e267d6a5e8f7fd198c4ac5d11d7098a1d17228c5 (diff) | |
download | chromium_src-cefb99b8043239c486ce4b43ca758dd2d4d0d635.zip chromium_src-cefb99b8043239c486ce4b43ca758dd2d4d0d635.tar.gz chromium_src-cefb99b8043239c486ce4b43ca758dd2d4d0d635.tar.bz2 |
HttpServerProperties - Don't persist if ClearAlternativeService is
called with the same origin (HostPortPair) and nothing was deleted.
This change reduces the number of times ClearAlternativeService tries to
persist HttpServerProperties to disk (currently ~11% of persist calls
are due to ClearAlternativeService).
BUG=451256
R=rch@chromium.org
Review URL: https://codereview.chromium.org/1156513004
Cr-Commit-Position: refs/heads/master@{#333147}
Diffstat (limited to 'net/http/http_server_properties_manager_unittest.cc')
-rw-r--r-- | net/http/http_server_properties_manager_unittest.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc index 79c1723..751888d 100644 --- a/net/http/http_server_properties_manager_unittest.cc +++ b/net/http/http_server_properties_manager_unittest.cc @@ -528,6 +528,27 @@ TEST_F(HttpServerPropertiesManagerTest, GetAlternativeService) { EXPECT_EQ(NPN_SPDY_4, alternative_service.protocol); } +TEST_F(HttpServerPropertiesManagerTest, ClearAlternativeService) { + ExpectPrefsUpdate(); + ExpectScheduleUpdatePrefsOnNetworkThread(); + + HostPortPair spdy_server_mail("mail.google.com", 80); + EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); + AlternativeService alternative_service(NPN_SPDY_4, "mail.google.com", 443); + http_server_props_manager_->SetAlternativeService(spdy_server_mail, + alternative_service, 1.0); + ExpectScheduleUpdatePrefsOnNetworkThread(); + http_server_props_manager_->ClearAlternativeService(spdy_server_mail); + // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once. + http_server_props_manager_->ClearAlternativeService(spdy_server_mail); + + // Run the task. + base::RunLoop().RunUntilIdle(); + Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); + + EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); +} + TEST_F(HttpServerPropertiesManagerTest, SupportsQuic) { ExpectPrefsUpdate(); ExpectScheduleUpdatePrefsOnNetworkThread(); |