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

Unified Diff: net/http/http_server_properties_manager_unittest.cc

Issue 2171743002: Do not persist HttpServerProperties to disk that often. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #7. Created 4 years, 5 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
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 51f509496a9735f45f0d09414583ae88cf59d75c..e0432447409ffb1e7c6c2b64edfd0df734c85a3d 100644
--- a/net/http/http_server_properties_manager_unittest.cc
+++ b/net/http/http_server_properties_manager_unittest.cc
@@ -713,20 +713,22 @@ TEST_P(HttpServerPropertiesManagerTest, ClearAllSpdySetting) {
TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServices) {
ExpectPrefsUpdate();
+ // ScheduleUpdatePrefsOnNetworkThread() should be called only once.
ExpectScheduleUpdatePrefsOnNetworkThread();
url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80);
EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
const AlternativeService alternative_service(NPN_HTTP_2, "mail.google.com",
443);
+
http_server_props_manager_->SetAlternativeService(
spdy_server_mail, alternative_service, one_day_from_now_);
- // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once.
+ base::RunLoop().RunUntilIdle();
+
http_server_props_manager_->SetAlternativeService(
spdy_server_mail, alternative_service, one_day_from_now_);
-
- // Run the task.
base::RunLoop().RunUntilIdle();
+
Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
AlternativeServiceVector alternative_service_vector =
@@ -737,6 +739,7 @@ TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServices) {
TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) {
ExpectPrefsUpdate();
+ // ScheduleUpdatePrefsOnNetworkThread() should be called only once.
ExpectScheduleUpdatePrefsOnNetworkThread();
url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80);
@@ -749,14 +752,15 @@ TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) {
const AlternativeService alternative_service2(QUIC, "mail.google.com", 1234);
alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, one_day_from_now_));
+
http_server_props_manager_->SetAlternativeServices(
spdy_server_mail, alternative_service_info_vector);
- // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once.
+ base::RunLoop().RunUntilIdle();
+
http_server_props_manager_->SetAlternativeServices(
spdy_server_mail, alternative_service_info_vector);
-
- // Run the task.
base::RunLoop().RunUntilIdle();
+
Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
AlternativeServiceVector alternative_service_vector =
@@ -766,22 +770,6 @@ TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) {
EXPECT_EQ(alternative_service2, alternative_service_vector[1]);
}
-TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServicesEmpty) {
Bence 2016/07/22 16:28:54 I'm removing this test because now even empty => e
- url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80);
- EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
- const AlternativeService alternative_service(NPN_HTTP_2, "mail.google.com",
- 443);
- http_server_props_manager_->SetAlternativeServices(
- spdy_server_mail, AlternativeServiceInfoVector());
- // ExpectScheduleUpdatePrefsOnNetworkThread() should not be called.
-
- // Run the task.
- base::RunLoop().RunUntilIdle();
- Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
-
- EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
-}
-
TEST_P(HttpServerPropertiesManagerTest, ConfirmAlternativeService) {
ExpectPrefsUpdate();
« net/http/http_server_properties_manager.cc ('K') | « 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