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

Unified Diff: net/http/http_server_properties_manager_unittest.cc

Issue 1142413004: HttpServerProperties - Don't persist if ConfirmAlternativeService is (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 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/http/http_server_properties_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_manager_unittest.cc
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc
index 751888d9abff785ae671054b058546877db8a669..8aaa9d1dcf90fe1addbe37e5f6e8baaef2839384 100644
--- a/net/http/http_server_properties_manager_unittest.cc
+++ b/net/http/http_server_properties_manager_unittest.cc
@@ -549,6 +549,52 @@ TEST_F(HttpServerPropertiesManagerTest, ClearAlternativeService) {
EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
}
+TEST_F(HttpServerPropertiesManagerTest, ConfirmAlternativeService) {
+ ExpectPrefsUpdate();
+
+ HostPortPair spdy_server_mail("mail.google.com", 80);
+ EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
+ AlternativeService alternative_service(NPN_SPDY_4, "mail.google.com", 443);
+
+ ExpectScheduleUpdatePrefsOnNetworkThread();
+ http_server_props_manager_->SetAlternativeService(spdy_server_mail,
+ alternative_service, 1.0);
+
+ EXPECT_FALSE(http_server_props_manager_->IsAlternativeServiceBroken(
+ alternative_service));
+ EXPECT_FALSE(http_server_props_manager_->WasAlternativeServiceRecentlyBroken(
+ alternative_service));
+
+ ExpectScheduleUpdatePrefsOnNetworkThread();
+ http_server_props_manager_->MarkAlternativeServiceBroken(alternative_service);
+ EXPECT_TRUE(http_server_props_manager_->IsAlternativeServiceBroken(
+ alternative_service));
+ EXPECT_TRUE(http_server_props_manager_->WasAlternativeServiceRecentlyBroken(
+ alternative_service));
+
+ ExpectScheduleUpdatePrefsOnNetworkThread();
+ http_server_props_manager_->ConfirmAlternativeService(alternative_service);
+ EXPECT_FALSE(http_server_props_manager_->IsAlternativeServiceBroken(
+ alternative_service));
+ EXPECT_FALSE(http_server_props_manager_->WasAlternativeServiceRecentlyBroken(
+ alternative_service));
+ // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once.
+ http_server_props_manager_->ConfirmAlternativeService(alternative_service);
+ EXPECT_FALSE(http_server_props_manager_->IsAlternativeServiceBroken(
+ alternative_service));
+ EXPECT_FALSE(http_server_props_manager_->WasAlternativeServiceRecentlyBroken(
+ alternative_service));
+
+ // Run the task.
+ base::RunLoop().RunUntilIdle();
+ Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
+
+ EXPECT_FALSE(http_server_props_manager_->IsAlternativeServiceBroken(
+ alternative_service));
+ EXPECT_FALSE(http_server_props_manager_->WasAlternativeServiceRecentlyBroken(
+ alternative_service));
+}
+
TEST_F(HttpServerPropertiesManagerTest, SupportsQuic) {
ExpectPrefsUpdate();
ExpectScheduleUpdatePrefsOnNetworkThread();
« no previous file with comments | « net/http/http_server_properties_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698