| 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 b2f11528bdb6a81c88f45554792ea29b474bff37..9a552f9980203ae6a9ca979cab0c1fc22cf15dbe 100644
|
| --- a/net/http/http_server_properties_manager_unittest.cc
|
| +++ b/net/http/http_server_properties_manager_unittest.cc
|
| @@ -221,17 +221,10 @@ class HttpServerPropertiesManagerTest : public testing::TestWithParam<int> {
|
| ScheduleUpdatePrefsOnNetworkThreadConcrete));
|
| }
|
|
|
| - void ExpectPrefsUpdate() {
|
| - EXPECT_CALL(*http_server_props_manager_,
|
| - UpdatePrefsFromCacheOnNetworkThread(_))
|
| - .WillOnce(Invoke(http_server_props_manager_.get(),
|
| - &TestingHttpServerPropertiesManager::
|
| - UpdatePrefsFromCacheOnNetworkThreadConcrete));
|
| - }
|
| -
|
| - void ExpectPrefsUpdateRepeatedly() {
|
| + void ExpectPrefsUpdate(int times) {
|
| EXPECT_CALL(*http_server_props_manager_,
|
| UpdatePrefsFromCacheOnNetworkThread(_))
|
| + .Times(times)
|
| .WillRepeatedly(
|
| Invoke(http_server_props_manager_.get(),
|
| &TestingHttpServerPropertiesManager::
|
| @@ -487,7 +480,7 @@ TEST_P(HttpServerPropertiesManagerTest,
|
| TEST_P(HttpServerPropertiesManagerTest, BadCachedHostPortPair) {
|
| ExpectCacheUpdate();
|
| // The prefs are automatically updated in the case corruption is detected.
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThread();
|
|
|
| base::DictionaryValue* server_pref_dict = new base::DictionaryValue;
|
| @@ -577,7 +570,7 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedHostPortPair) {
|
| TEST_P(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) {
|
| ExpectCacheUpdate();
|
| // The prefs are automatically updated in the case corruption is detected.
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThread();
|
|
|
| base::DictionaryValue* server_pref_dict = new base::DictionaryValue;
|
| @@ -638,7 +631,7 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) {
|
| }
|
|
|
| TEST_P(HttpServerPropertiesManagerTest, SupportsSpdy) {
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThread();
|
|
|
| // Post an update task to the network thread. SetSupportsSpdy calls
|
| @@ -673,7 +666,7 @@ TEST_P(HttpServerPropertiesManagerTest,
|
| SinglePrefUpdateForTwoSpdyServerCacheChangese) {
|
| http_server_props_manager_->set_pref_update_delay(
|
| base::TimeDelta::FromMilliseconds(60));
|
| - ExpectPrefsUpdateRepeatedly();
|
| + ExpectPrefsUpdate(2);
|
| ExpectScheduleUpdatePrefsOnNetworkThreadRepeatedly();
|
|
|
| // Post an update task to the network thread. SetSupportsSpdy calls
|
| @@ -728,7 +721,7 @@ TEST_P(HttpServerPropertiesManagerTest,
|
| }
|
|
|
| TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServices) {
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThread();
|
|
|
| url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80);
|
| @@ -759,7 +752,7 @@ TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServices) {
|
| }
|
|
|
| TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) {
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThread();
|
|
|
| url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80);
|
| @@ -814,7 +807,7 @@ TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServicesEmpty) {
|
| }
|
|
|
| TEST_P(HttpServerPropertiesManagerTest, ConfirmAlternativeService) {
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
|
|
| url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80);
|
| EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
|
| @@ -867,7 +860,7 @@ TEST_P(HttpServerPropertiesManagerTest, ConfirmAlternativeService) {
|
| }
|
|
|
| TEST_P(HttpServerPropertiesManagerTest, SupportsQuic) {
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThread();
|
|
|
| IPAddress address;
|
| @@ -894,7 +887,7 @@ TEST_P(HttpServerPropertiesManagerTest, SupportsQuic) {
|
| }
|
|
|
| TEST_P(HttpServerPropertiesManagerTest, ServerNetworkStats) {
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThread();
|
|
|
| url::SchemeHostPort mail_server("http", "mail.google.com", 80);
|
| @@ -924,7 +917,7 @@ TEST_P(HttpServerPropertiesManagerTest, ServerNetworkStats) {
|
| }
|
|
|
| TEST_P(HttpServerPropertiesManagerTest, QuicServerInfo) {
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThread();
|
|
|
| QuicServerId mail_quic_server_id("mail.google.com", 80);
|
| @@ -957,7 +950,7 @@ TEST_P(HttpServerPropertiesManagerTest, Clear) {
|
| // thus can not mock the pref task runner.
|
| SetUpWithNonTaskRunner();
|
|
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectScheduleUpdatePrefsOnNetworkThreadRepeatedly();
|
|
|
| url::SchemeHostPort spdy_server("https", "mail.google.com", 443);
|
| @@ -995,7 +988,7 @@ TEST_P(HttpServerPropertiesManagerTest, Clear) {
|
|
|
| Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
|
|
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
|
|
| // Clear http server data, time out if we do not get a completion callback.
|
| http_server_props_manager_->Clear(base::MessageLoop::QuitWhenIdleClosure());
|
| @@ -1163,7 +1156,7 @@ TEST_P(HttpServerPropertiesManagerTest, UpdateCacheWithPrefs) {
|
| http_server_props_manager_->SetSupportsQuic(true, actual_address);
|
|
|
| // Update cache.
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectCacheUpdate();
|
| http_server_props_manager_->ScheduleUpdateCacheOnPrefThread();
|
|
|
| @@ -1300,7 +1293,7 @@ TEST_P(HttpServerPropertiesManagerTest,
|
| server, alternative_service_info_vector);
|
|
|
| // Update cache.
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| ExpectCacheUpdate();
|
| http_server_props_manager_->ScheduleUpdateCacheOnPrefThread();
|
|
|
| @@ -1446,7 +1439,7 @@ TEST_P(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdatePrefs0) {
|
| }
|
|
|
| TEST_P(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdatePrefs1) {
|
| - ExpectPrefsUpdate();
|
| + ExpectPrefsUpdate(1);
|
| // Post an update task.
|
| http_server_props_manager_->ScheduleUpdatePrefsOnNetworkThread();
|
| // Shutdown comes before the task is executed.
|
|
|