Commit 4c600c1b authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Remove invalidation::prefs::kInvalidationServiceUseGCMChannel

It's always true in practice.
Unfortunately, the pre-GCM code is still not quite dead: The
ChromeOS-only TiclDeviceSettingsProvider still says to *not* use the
GCM channel by default.

Bug: 904782
Change-Id: I904db5088bd0e869343b8acf5bbb62cc7047c300
Reviewed-on: https://chromium-review.googlesource.com/c/1341831Reviewed-by: default avatarTatiana Gornak <melandory@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609255}
parent 44faf674
......@@ -1058,9 +1058,6 @@ void ProfileSyncService::OnExperimentsChanged(
return;
current_experiments_ = experiments;
sync_client_->GetPrefService()->SetBoolean(
invalidation::prefs::kInvalidationServiceUseGCMChannel, true);
}
void ProfileSyncService::OnConnectionStatusChange(
......
......@@ -18,12 +18,6 @@ const char kInvalidatorInvalidationState[] = "invalidator.invalidation_state";
// yet. Used to keep invalidation clients in sync in case of a restart.
const char kInvalidatorSavedInvalidations[] = "invalidator.saved_invalidations";
// Boolean indicating that TiclInvalidationService should use GCM channel.
// False means XMPPPushClient channel.
// TODO(crbug.com/904782): Get rid of this; it's always true.
const char kInvalidationServiceUseGCMChannel[] =
"invalidation_service.use_gcm_channel";
// The prefference for storing client ID for the invalidator.
const char kFCMInvalidationClientIDCache[] = "fcm.invalidation.client_id_cache";
......
......@@ -14,8 +14,6 @@ extern const char kInvalidatorInvalidationState[];
extern const char kInvalidatorSavedInvalidations[];
extern const char kInvalidationServiceUseGCMChannel[];
extern const char kFCMInvalidationClientIDCache[];
} // namespace prefs
......
......@@ -7,9 +7,10 @@
namespace invalidation {
namespace switches {
// Invalidation service should use GCM network channel even if experiment is not
// enabled.
#if defined(OS_CHROMEOS)
// Device invalidation service should use GCM network channel.
const char kInvalidationUseGCMChannel[] = "invalidation-use-gcm-channel";
#endif // OS_CHROMEOS
// Overrides the default host:port used for notifications.
const char kSyncNotificationHostPort[] = "sync-notification-host-port";
......
......@@ -6,11 +6,15 @@
#define COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SWITCHES_H
#include "base/feature_list.h"
#include "build/build_config.h"
namespace invalidation {
namespace switches {
#if defined(OS_CHROMEOS)
extern const char kInvalidationUseGCMChannel[];
#endif // OS_CHROMEOS
extern const char kSyncNotificationHostPort[];
extern const char kSyncAllowInsecureXmppConnection[];
extern const base::Feature kFCMInvalidations;
......
......@@ -36,10 +36,6 @@ void ProfileInvalidationProvider::Shutdown() {
// static
void ProfileInvalidationProvider::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(
prefs::kInvalidationServiceUseGCMChannel,
true); // if no value in prefs, use GCM channel.
registry->RegisterStringPref(prefs::kFCMInvalidationClientIDCache,
/*default_value=*/std::string());
}
......
......@@ -18,10 +18,6 @@ namespace invalidation {
TiclProfileSettingsProvider::TiclProfileSettingsProvider(PrefService* prefs)
: prefs_(prefs) {
registrar_.Init(prefs_);
registrar_.Add(
prefs::kInvalidationServiceUseGCMChannel,
base::Bind(&TiclProfileSettingsProvider::FireOnUseGCMChannelChanged,
base::Unretained(this)));
registrar_.Add(
gcm::prefs::kGCMChannelStatus,
base::Bind(&TiclProfileSettingsProvider::FireOnUseGCMChannelChanged,
......@@ -31,19 +27,7 @@ TiclProfileSettingsProvider::TiclProfileSettingsProvider(PrefService* prefs)
TiclProfileSettingsProvider::~TiclProfileSettingsProvider() {}
bool TiclProfileSettingsProvider::UseGCMChannel() const {
if (prefs_->GetBoolean(prefs::kInvalidationServiceUseGCMChannel)) {
// Use GCM channel if it was enabled via prefs.
return true;
}
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kInvalidationUseGCMChannel)) {
// Use GCM channel if it was enabled via a command-line switch.
return true;
}
// By default, do not use GCM channel.
return false;
}
} // namespace invalidation
......@@ -90,30 +90,17 @@ TEST_F(TiclProfileSettingsProviderTest, ChannelSelectionTest) {
// Default value should be GCM channel.
EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
// If GCM is enabled and invalidation channel setting is not set or set to
// true then use GCM channel.
// If GCM is enabled then use GCM channel.
pref_service_.SetBoolean(gcm::prefs::kGCMChannelStatus, true);
pref_service_.SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true);
EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
pref_service_.SetBoolean(gcm::prefs::kGCMChannelStatus, true);
pref_service_.ClearPref(prefs::kInvalidationServiceUseGCMChannel);
EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
pref_service_.ClearPref(gcm::prefs::kGCMChannelStatus);
pref_service_.SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true);
EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
// If invalidation channel setting says use GCM but GCM is not enabled, do not
// fall back to push channel.
pref_service_.SetBoolean(gcm::prefs::kGCMChannelStatus, false);
pref_service_.SetBoolean(prefs::kInvalidationServiceUseGCMChannel, true);
EXPECT_EQ(TiclInvalidationService::GCM_NETWORK_CHANNEL, GetNetworkChannel());
// If invalidation channel setting is set to false, fall back to push channel.
pref_service_.SetBoolean(gcm::prefs::kGCMChannelStatus, true);
pref_service_.SetBoolean(prefs::kInvalidationServiceUseGCMChannel, false);
EXPECT_EQ(TiclInvalidationService::PUSH_CLIENT_CHANNEL, GetNetworkChannel());
}
} // namespace invalidation
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment