summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpavely <pavely@chromium.org>2014-10-14 12:40:09 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-14 19:40:47 +0000
commit4f353d32856705a1ee2afde4c47b32a5fee86b45 (patch)
treed7f8a12623192d0f87c48942e06d2013361c2c39
parentc2ca458189c86d743b82de49e8a8a0c38bb38996 (diff)
downloadchromium_src-4f353d32856705a1ee2afde4c47b32a5fee86b45.zip
chromium_src-4f353d32856705a1ee2afde4c47b32a5fee86b45.tar.gz
chromium_src-4f353d32856705a1ee2afde4c47b32a5fee86b45.tar.bz2
Chrome should use GCM for invalidations by default.
Now that invalidations over GCM are enabled for all users it is time to make that default. With this change Chrome will use GCM for invalidations and only switch to XMPP explicitly as a result of sync experiment setting. BUG=422374 R=zea@chromium.org Review URL: https://codereview.chromium.org/654643004 Cr-Commit-Position: refs/heads/master@{#299525}
-rw-r--r--chrome/browser/invalidation/profile_invalidation_provider_factory.cc2
-rw-r--r--chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc31
-rw-r--r--components/invalidation/ticl_invalidation_service.cc2
-rw-r--r--sync/internal_api/public/util/experiments.h3
4 files changed, 17 insertions, 21 deletions
diff --git a/chrome/browser/invalidation/profile_invalidation_provider_factory.cc b/chrome/browser/invalidation/profile_invalidation_provider_factory.cc
index bba9b33..336c830 100644
--- a/chrome/browser/invalidation/profile_invalidation_provider_factory.cc
+++ b/chrome/browser/invalidation/profile_invalidation_provider_factory.cc
@@ -141,7 +141,7 @@ void ProfileInvalidationProviderFactory::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(
prefs::kInvalidationServiceUseGCMChannel,
- false,
+ true, // if no value in prefs, use GCM channel.
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
InvalidatorStorage::RegisterProfilePrefs(registry);
}
diff --git a/chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc b/chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc
index 508c120..5522ae9 100644
--- a/chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc
+++ b/chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc
@@ -73,39 +73,34 @@ TiclProfileSettingsProviderTest::GetNetworkChannel() {
}
TEST_F(TiclProfileSettingsProviderTest, ChannelSelectionTest) {
- EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel());
+ // Default value should be GCM channel.
+ EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
PrefService* prefs = profile_.GetPrefs();
- // If stars align, use GCM channel.
+ // If GCM is enabled and invalidation channel setting is not set or set to
+ // true then use GCM channel.
prefs->SetBoolean(prefs::kGCMChannelEnabled, true);
prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true);
EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
- // If invalidation channel setting is not set or says false, fall back to push
- // channel.
prefs->SetBoolean(prefs::kGCMChannelEnabled, true);
-
prefs->ClearPref(prefs::kInvalidationServiceUseGCMChannel);
- EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel());
+ EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
- prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, false);
- EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel());
+ prefs->ClearPref(prefs::kGCMChannelEnabled);
+ prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true);
+ EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
- // If invalidation channel setting says use GCM but GCM is not ALWAYS_ENABLED,
- // fall back to push channel.
+ // If invalidation channel setting is set to false, fall back to push channel.
+ prefs->SetBoolean(prefs::kGCMChannelEnabled, true);
prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, false);
-
- prefs->ClearPref(prefs::kGCMChannelEnabled);
EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel());
+ // If invalidation channel setting says use GCM but GCM is not enabled, fall
+ // back to push channel.
prefs->SetBoolean(prefs::kGCMChannelEnabled, false);
- EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel());
-
- // If invalidation channel setting is enabled first and the GCM setting is
- // enabled after that, switch to GCM channel.
prefs->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true);
- prefs->SetBoolean(prefs::kGCMChannelEnabled, true);
- EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
+ EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel());
}
} // namespace invalidation
diff --git a/components/invalidation/ticl_invalidation_service.cc b/components/invalidation/ticl_invalidation_service.cc
index 03dd30e..7fe5aee 100644
--- a/components/invalidation/ticl_invalidation_service.cc
+++ b/components/invalidation/ticl_invalidation_service.cc
@@ -63,7 +63,7 @@ TiclInvalidationService::TiclInvalidationService(
settings_provider_(settings_provider.Pass()),
invalidator_registrar_(new syncer::InvalidatorRegistrar()),
request_access_token_backoff_(&kRequestAccessTokenBackoffPolicy),
- network_channel_type_(PUSH_CLIENT_CHANNEL),
+ network_channel_type_(GCM_NETWORK_CHANNEL),
gcm_driver_(gcm_driver),
request_context_(request_context),
logger_() {}
diff --git a/sync/internal_api/public/util/experiments.h b/sync/internal_api/public/util/experiments.h
index 9063cbb..b61742d 100644
--- a/sync/internal_api/public/util/experiments.h
+++ b/sync/internal_api/public/util/experiments.h
@@ -29,7 +29,8 @@ struct Experiments {
: favicon_sync_limit(200),
gcm_channel_state(UNSET),
enhanced_bookmarks_enabled(false),
- gcm_invalidations_enabled(false) {}
+ gcm_invalidations_enabled(true) // By default GCM channel is enabled.
+ {}
bool Matches(const Experiments& rhs) {
return (favicon_sync_limit == rhs.favicon_sync_limit &&