Commit 5a61f4aa authored by Paula Vidas's avatar Paula Vidas Committed by Commit Bot

[SyncInvalidations] Introduce new Sync Invalidations feature flags.

SubscribeForSyncInvalidations flag is removed, and mostly replaced by
the new flag SyncSendInterestedDataTypes. If that flag is enabled,
SyncInvalidationsService is created, and the set of interested data
types is sent to the server (as part of DeviceInfo).

New flag UseSyncInvalidations is introduced. If both
SyncSendInterestedDataTypes and this flag are enabled, FCMHandler can
register with FCM and listen to new invalidations. Also, FCM token will
be included in DeviceInfo.

Unsubscribing from old invalidations behind these flags will be added
in a separate CL.

Bug: 1082115
Change-Id: I66eb2f254473d2f897cc15f054dcd6dafdc76708
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429008Reviewed-by: default avatarRushan Suleymanov <rushans@google.com>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Paula Vidas <paulavidas@google.com>
Cr-Commit-Position: refs/heads/master@{#811150}
parent 612a34f2
...@@ -37,7 +37,7 @@ SyncInvalidationsServiceFactory::~SyncInvalidationsServiceFactory() = default; ...@@ -37,7 +37,7 @@ SyncInvalidationsServiceFactory::~SyncInvalidationsServiceFactory() = default;
KeyedService* SyncInvalidationsServiceFactory::BuildServiceInstanceFor( KeyedService* SyncInvalidationsServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const { content::BrowserContext* context) const {
if (!base::FeatureList::IsEnabled(switches::kSubscribeForSyncInvalidations)) { if (!base::FeatureList::IsEnabled(switches::kSyncSendInterestedDataTypes)) {
return nullptr; return nullptr;
} }
......
...@@ -588,8 +588,8 @@ void SyncEngineBackend::DoOnInvalidatorClientIdChange( ...@@ -588,8 +588,8 @@ void SyncEngineBackend::DoOnInvalidatorClientIdChange(
void SyncEngineBackend::DoOnInvalidationReceived(const std::string& payload) { void SyncEngineBackend::DoOnInvalidationReceived(const std::string& payload) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK( DCHECK(base::FeatureList::IsEnabled(switches::kSyncSendInterestedDataTypes) &&
base::FeatureList::IsEnabled(switches::kSubscribeForSyncInvalidations)); base::FeatureList::IsEnabled(switches::kUseSyncInvalidations));
sync_pb::SyncInvalidationsPayload payload_message; sync_pb::SyncInvalidationsPayload payload_message;
// TODO(crbug.com/1119804): Track parsing failures in a histogram. // TODO(crbug.com/1119804): Track parsing failures in a histogram.
......
...@@ -325,8 +325,10 @@ class SyncEngineImplTest : public testing::Test { ...@@ -325,8 +325,10 @@ class SyncEngineImplTest : public testing::Test {
class SyncEngineImplWithSyncInvalidationsTest : public SyncEngineImplTest { class SyncEngineImplWithSyncInvalidationsTest : public SyncEngineImplTest {
public: public:
SyncEngineImplWithSyncInvalidationsTest() { SyncEngineImplWithSyncInvalidationsTest() {
override_features_.InitAndEnableFeature( override_features_.InitWithFeatures(
switches::kSubscribeForSyncInvalidations); /*enabled_features=*/{switches::kSyncSendInterestedDataTypes,
switches::kUseSyncInvalidations},
/*disabled_features=*/{});
} }
protected: protected:
......
...@@ -64,8 +64,7 @@ class ProfileSyncServiceBundle { ...@@ -64,8 +64,7 @@ class ProfileSyncServiceBundle {
} }
MockSyncInvalidationsService* sync_invalidations_service() { MockSyncInvalidationsService* sync_invalidations_service() {
if (base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(switches::kSyncSendInterestedDataTypes)) {
switches::kSubscribeForSyncInvalidations)) {
return &sync_invalidations_service_; return &sync_invalidations_service_;
} else { } else {
return nullptr; return nullptr;
......
...@@ -360,15 +360,16 @@ class ProfileSyncServiceTestWithStopSyncInPausedState ...@@ -360,15 +360,16 @@ class ProfileSyncServiceTestWithStopSyncInPausedState
base::test::ScopedFeatureList override_features_; base::test::ScopedFeatureList override_features_;
}; };
class ProfileSyncServiceTestWithSubscribeForSyncInvalidations class ProfileSyncServiceTestWithSyncInvalidationsServiceCreated
: public ProfileSyncServiceTest { : public ProfileSyncServiceTest {
public: public:
ProfileSyncServiceTestWithSubscribeForSyncInvalidations() { ProfileSyncServiceTestWithSyncInvalidationsServiceCreated() {
override_features_.InitAndEnableFeature( override_features_.InitAndEnableFeature(
switches::kSubscribeForSyncInvalidations); switches::kSyncSendInterestedDataTypes);
} }
~ProfileSyncServiceTestWithSubscribeForSyncInvalidations() override = default; ~ProfileSyncServiceTestWithSyncInvalidationsServiceCreated() override =
default;
private: private:
base::test::ScopedFeatureList override_features_; base::test::ScopedFeatureList override_features_;
...@@ -1621,7 +1622,7 @@ TEST_F(ProfileSyncServiceTest, ...@@ -1621,7 +1622,7 @@ TEST_F(ProfileSyncServiceTest,
EXPECT_EQ(signin::GetTestGaiaIdForEmail(kTestUser), sync_prefs.GetGaiaId()); EXPECT_EQ(signin::GetTestGaiaIdForEmail(kTestUser), sync_prefs.GetGaiaId());
} }
TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations, TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated,
ShouldSendDataTypesToSyncInvalidationsService) { ShouldSendDataTypesToSyncInvalidationsService) {
CreateService(ProfileSyncService::AUTO_START); CreateService(ProfileSyncService::AUTO_START);
SignIn(); SignIn();
...@@ -1633,7 +1634,7 @@ MATCHER(ContainsSessions, "") { ...@@ -1633,7 +1634,7 @@ MATCHER(ContainsSessions, "") {
return arg.Has(SESSIONS); return arg.Has(SESSIONS);
} }
TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations, TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated,
ShouldEnableAndDisableInvalidationsForSessions) { ShouldEnableAndDisableInvalidationsForSessions) {
CreateService(ProfileSyncService::AUTO_START, CreateService(ProfileSyncService::AUTO_START,
ModelTypeSet(SESSIONS, TYPED_URLS)); ModelTypeSet(SESSIONS, TYPED_URLS));
...@@ -1648,7 +1649,7 @@ TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations, ...@@ -1648,7 +1649,7 @@ TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations,
service()->SetInvalidationsForSessionsEnabled(false); service()->SetInvalidationsForSessionsEnabled(false);
} }
TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations, TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated,
ShouldActivateSyncInvalidationsServiceWhenSyncIsInitialized) { ShouldActivateSyncInvalidationsServiceWhenSyncIsInitialized) {
CreateService(ProfileSyncService::AUTO_START); CreateService(ProfileSyncService::AUTO_START);
EXPECT_CALL(*sync_invalidations_service(), SetActive(true)).Times(0); EXPECT_CALL(*sync_invalidations_service(), SetActive(true)).Times(0);
...@@ -1657,7 +1658,7 @@ TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations, ...@@ -1657,7 +1658,7 @@ TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations,
InitializeForFirstSync(); InitializeForFirstSync();
} }
TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations, TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated,
ShouldActivateSyncInvalidationsServiceOnSignIn) { ShouldActivateSyncInvalidationsServiceOnSignIn) {
CreateService(ProfileSyncService::AUTO_START); CreateService(ProfileSyncService::AUTO_START);
EXPECT_CALL(*sync_invalidations_service(), SetActive(false)); EXPECT_CALL(*sync_invalidations_service(), SetActive(false));
...@@ -1668,7 +1669,7 @@ TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations, ...@@ -1668,7 +1669,7 @@ TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations,
// CrOS does not support signout. // CrOS does not support signout.
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
TEST_F(ProfileSyncServiceTestWithSubscribeForSyncInvalidations, TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated,
ShouldDectivateSyncInvalidationsServiceOnSignOut) { ShouldDectivateSyncInvalidationsServiceOnSignOut) {
CreateService(ProfileSyncService::AUTO_START); CreateService(ProfileSyncService::AUTO_START);
SignIn(); SignIn();
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "components/gcm_driver/instance_id/instance_id_driver.h" #include "components/gcm_driver/instance_id/instance_id_driver.h"
#include "components/sync/invalidations/fcm_registration_token_observer.h" #include "components/sync/invalidations/fcm_registration_token_observer.h"
#include "components/sync/invalidations/invalidations_listener.h" #include "components/sync/invalidations/invalidations_listener.h"
#include "components/sync/invalidations/switches.h"
namespace syncer { namespace syncer {
...@@ -39,6 +40,7 @@ FCMHandler::~FCMHandler() { ...@@ -39,6 +40,7 @@ FCMHandler::~FCMHandler() {
void FCMHandler::StartListening() { void FCMHandler::StartListening() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!IsListening()); DCHECK(!IsListening());
DCHECK(base::FeatureList::IsEnabled(switches::kUseSyncInvalidations));
gcm_driver_->AddAppHandler(app_id_, this); gcm_driver_->AddAppHandler(app_id_, this);
StartTokenFetch(base::BindOnce(&FCMHandler::DidRetrieveToken, StartTokenFetch(base::BindOnce(&FCMHandler::DidRetrieveToken,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
...@@ -101,6 +103,7 @@ void FCMHandler::OnMessage(const std::string& app_id, ...@@ -101,6 +103,7 @@ void FCMHandler::OnMessage(const std::string& app_id,
const gcm::IncomingMessage& message) { const gcm::IncomingMessage& message) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_EQ(app_id, app_id_); DCHECK_EQ(app_id, app_id_);
DCHECK(base::FeatureList::IsEnabled(switches::kUseSyncInvalidations));
auto it = message.data.find(kPayloadKey); auto it = message.data.find(kPayloadKey);
std::string payload; std::string payload;
......
...@@ -11,12 +11,14 @@ ...@@ -11,12 +11,14 @@
#include <vector> #include <vector>
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "components/gcm_driver/fake_gcm_driver.h" #include "components/gcm_driver/fake_gcm_driver.h"
#include "components/gcm_driver/gcm_driver.h" #include "components/gcm_driver/gcm_driver.h"
#include "components/gcm_driver/instance_id/instance_id_driver.h" #include "components/gcm_driver/instance_id/instance_id_driver.h"
#include "components/sync/invalidations/fcm_registration_token_observer.h" #include "components/sync/invalidations/fcm_registration_token_observer.h"
#include "components/sync/invalidations/invalidations_listener.h" #include "components/sync/invalidations/invalidations_listener.h"
#include "components/sync/invalidations/switches.h"
#include "google_apis/gcm/engine/account_mapping.h" #include "google_apis/gcm/engine/account_mapping.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -94,11 +96,16 @@ class FCMHandlerTest : public testing::Test { ...@@ -94,11 +96,16 @@ class FCMHandlerTest : public testing::Test {
// This is called in the FCMHandler. // This is called in the FCMHandler.
ON_CALL(mock_instance_id_driver_, GetInstanceID(kSyncInvalidationsAppId)) ON_CALL(mock_instance_id_driver_, GetInstanceID(kSyncInvalidationsAppId))
.WillByDefault(Return(&mock_instance_id_)); .WillByDefault(Return(&mock_instance_id_));
override_features_.InitWithFeatures(
/*enabled_features=*/{switches::kSyncSendInterestedDataTypes,
switches::kUseSyncInvalidations},
/*disabled_features=*/{});
} }
protected: protected:
base::test::SingleThreadTaskEnvironment task_environment_{ base::test::SingleThreadTaskEnvironment task_environment_{
base::test::TaskEnvironment::TimeSource::MOCK_TIME}; base::test::TaskEnvironment::TimeSource::MOCK_TIME};
base::test::ScopedFeatureList override_features_;
gcm::FakeGCMDriver fake_gcm_driver_; gcm::FakeGCMDriver fake_gcm_driver_;
NiceMock<MockInstanceIDDriver> mock_instance_id_driver_; NiceMock<MockInstanceIDDriver> mock_instance_id_driver_;
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
namespace switches { namespace switches {
const base::Feature kSubscribeForSyncInvalidations = { const base::Feature kSyncSendInterestedDataTypes = {
"SubscribeForSyncInvalidations", base::FEATURE_DISABLED_BY_DEFAULT}; "SyncSendInterestedDataTypes", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kUseSyncInvalidations = {"UseSyncInvalidations",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace switches } // namespace switches
...@@ -9,7 +9,15 @@ ...@@ -9,7 +9,15 @@
namespace switches { namespace switches {
extern const base::Feature kSubscribeForSyncInvalidations; // If enabled, interested data types will be sent to the Sync Server as part of
// DeviceInfo.
extern const base::Feature kSyncSendInterestedDataTypes;
// If enabled, the device will register with FCM and listen to new
// invalidations. Also, FCM token will be set in DeviceInfo, which signals to
// the server that device listens to new invalidations.
// SyncSendInterestedDataTypes must be enabled for this to take effect.
extern const base::Feature kUseSyncInvalidations;
} // namespace switches } // namespace switches
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <utility> #include <utility>
#include "components/sync/invalidations/fcm_handler.h" #include "components/sync/invalidations/fcm_handler.h"
#include "components/sync/invalidations/switches.h"
namespace syncer { namespace syncer {
...@@ -28,7 +29,8 @@ SyncInvalidationsServiceImpl::SyncInvalidationsServiceImpl( ...@@ -28,7 +29,8 @@ SyncInvalidationsServiceImpl::SyncInvalidationsServiceImpl(
SyncInvalidationsServiceImpl::~SyncInvalidationsServiceImpl() = default; SyncInvalidationsServiceImpl::~SyncInvalidationsServiceImpl() = default;
void SyncInvalidationsServiceImpl::SetActive(bool active) { void SyncInvalidationsServiceImpl::SetActive(bool active) {
if (fcm_handler_->IsListening() == active) { if (!base::FeatureList::IsEnabled(switches::kUseSyncInvalidations) ||
fcm_handler_->IsListening() == active) {
return; return;
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "components/prefs/testing_pref_service.h" #include "components/prefs/testing_pref_service.h"
#include "components/sync/base/model_type.h" #include "components/sync/base/model_type.h"
#include "components/sync/base/time.h" #include "components/sync/base/time.h"
#include "components/sync/invalidations/switches.h"
#include "components/sync/model/data_batch.h" #include "components/sync/model/data_batch.h"
#include "components/sync/model/data_type_activation_request.h" #include "components/sync/model/data_type_activation_request.h"
#include "components/sync/model/data_type_error_handler_mock.h" #include "components/sync/model/data_type_error_handler_mock.h"
...@@ -234,17 +233,11 @@ sync_pb::SharingSpecificFields::EnabledFeatures SharingEnabledFeaturesForSuffix( ...@@ -234,17 +233,11 @@ sync_pb::SharingSpecificFields::EnabledFeatures SharingEnabledFeaturesForSuffix(
} }
std::string SyncInvalidationsInstanceIdTokenForSuffix(int suffix) { std::string SyncInvalidationsInstanceIdTokenForSuffix(int suffix) {
if (base::FeatureList::IsEnabled(switches::kSubscribeForSyncInvalidations)) { return base::StringPrintf("instance id token %d", suffix);
return base::StringPrintf("instance id token %d", suffix);
}
return std::string();
} }
ModelTypeSet SyncInvalidationsInterestedDataTypes() { ModelTypeSet SyncInvalidationsInterestedDataTypes() {
if (base::FeatureList::IsEnabled(switches::kSubscribeForSyncInvalidations)) { return ModelTypeSet(BOOKMARKS);
return ModelTypeSet(BOOKMARKS);
}
return ModelTypeSet();
} }
DataTypeActivationRequest TestDataTypeActivationRequest(SyncMode sync_mode) { DataTypeActivationRequest TestDataTypeActivationRequest(SyncMode sync_mode) {
...@@ -284,12 +277,8 @@ DeviceInfoSpecifics CreateSpecifics( ...@@ -284,12 +277,8 @@ DeviceInfoSpecifics CreateSpecifics(
specifics.mutable_sharing_fields()->add_enabled_features( specifics.mutable_sharing_fields()->add_enabled_features(
SharingEnabledFeaturesForSuffix(suffix)); SharingEnabledFeaturesForSuffix(suffix));
const std::string sync_invalidations_instance_id_token = specifics.mutable_invalidation_fields()->set_instance_id_token(
SyncInvalidationsInstanceIdTokenForSuffix(suffix); SyncInvalidationsInstanceIdTokenForSuffix(suffix));
if (!sync_invalidations_instance_id_token.empty()) {
specifics.mutable_invalidation_fields()->set_instance_id_token(
sync_invalidations_instance_id_token);
}
for (const ModelType type : SyncInvalidationsInterestedDataTypes()) { for (const ModelType type : SyncInvalidationsInterestedDataTypes()) {
specifics.mutable_invalidation_fields()->add_interested_data_type_ids( specifics.mutable_invalidation_fields()->add_interested_data_type_ids(
GetSpecificsFieldNumberFromModelType(type)); GetSpecificsFieldNumberFromModelType(type));
...@@ -1298,10 +1287,6 @@ TEST_F(DeviceInfoSyncBridgeTest, RefreshLocalDeviceNameForSyncModeToggle) { ...@@ -1298,10 +1287,6 @@ TEST_F(DeviceInfoSyncBridgeTest, RefreshLocalDeviceNameForSyncModeToggle) {
} }
TEST_F(DeviceInfoSyncBridgeTest, ShouldSendInvalidationFields) { TEST_F(DeviceInfoSyncBridgeTest, ShouldSendInvalidationFields) {
base::test::ScopedFeatureList override_features;
override_features.InitAndEnableFeature(
switches::kSubscribeForSyncInvalidations);
EXPECT_CALL(*processor(), EXPECT_CALL(*processor(),
Put(_, Put(_,
HasSpecifics( HasSpecifics(
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "components/sync/base/sync_prefs.h" #include "components/sync/base/sync_prefs.h"
#include "components/sync/base/sync_util.h" #include "components/sync/base/sync_util.h"
#include "components/sync/invalidations/switches.h"
#include "components/sync_device_info/device_info_sync_client.h" #include "components/sync_device_info/device_info_sync_client.h"
#include "components/sync_device_info/device_info_util.h" #include "components/sync_device_info/device_info_util.h"
#include "components/sync_device_info/local_device_info_util.h" #include "components/sync_device_info/local_device_info_util.h"
...@@ -41,13 +40,10 @@ const DeviceInfo* LocalDeviceInfoProviderImpl::GetLocalDeviceInfo() const { ...@@ -41,13 +40,10 @@ const DeviceInfo* LocalDeviceInfoProviderImpl::GetLocalDeviceInfo() const {
local_device_info_->set_send_tab_to_self_receiving_enabled( local_device_info_->set_send_tab_to_self_receiving_enabled(
sync_client_->GetSendTabToSelfReceivingEnabled()); sync_client_->GetSendTabToSelfReceivingEnabled());
local_device_info_->set_sharing_info(sync_client_->GetLocalSharingInfo()); local_device_info_->set_sharing_info(sync_client_->GetLocalSharingInfo());
local_device_info_->set_fcm_registration_token(
if (base::FeatureList::IsEnabled(switches::kSubscribeForSyncInvalidations)) { sync_client_->GetFCMRegistrationToken());
local_device_info_->set_fcm_registration_token( local_device_info_->set_interested_data_types(
sync_client_->GetFCMRegistrationToken()); sync_client_->GetInterestedDataTypes());
local_device_info_->set_interested_data_types(
sync_client_->GetInterestedDataTypes());
}
return local_device_info_.get(); return local_device_info_.get();
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "components/sync/base/model_type.h" #include "components/sync/base/model_type.h"
#include "components/sync/base/sync_util.h" #include "components/sync/base/sync_util.h"
#include "components/sync/invalidations/switches.h"
#include "components/sync_device_info/device_info_sync_client.h" #include "components/sync_device_info/device_info_sync_client.h"
#include "components/version_info/version_string.h" #include "components/version_info/version_string.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
...@@ -80,18 +79,6 @@ class LocalDeviceInfoProviderImplTest : public testing::Test { ...@@ -80,18 +79,6 @@ class LocalDeviceInfoProviderImplTest : public testing::Test {
std::unique_ptr<LocalDeviceInfoProviderImpl> provider_; std::unique_ptr<LocalDeviceInfoProviderImpl> provider_;
}; };
class LocalDeviceInfoProviderImplWithSyncInvalidationsTest
: public LocalDeviceInfoProviderImplTest {
public:
LocalDeviceInfoProviderImplWithSyncInvalidationsTest() {
override_features_.InitAndEnableFeature(
switches::kSubscribeForSyncInvalidations);
}
protected:
base::test::ScopedFeatureList override_features_;
};
TEST_F(LocalDeviceInfoProviderImplTest, GetLocalDeviceInfo) { TEST_F(LocalDeviceInfoProviderImplTest, GetLocalDeviceInfo) {
ASSERT_EQ(nullptr, provider_->GetLocalDeviceInfo()); ASSERT_EQ(nullptr, provider_->GetLocalDeviceInfo());
...@@ -183,8 +170,7 @@ TEST_F(LocalDeviceInfoProviderImplTest, SharingInfo) { ...@@ -183,8 +170,7 @@ TEST_F(LocalDeviceInfoProviderImplTest, SharingInfo) {
EXPECT_EQ(enabled_features, local_sharing_info->enabled_features); EXPECT_EQ(enabled_features, local_sharing_info->enabled_features);
} }
TEST_F(LocalDeviceInfoProviderImplWithSyncInvalidationsTest, TEST_F(LocalDeviceInfoProviderImplTest, ShouldPopulateFCMRegistrationToken) {
ShouldPopulateFCMRegistrationToken) {
InitializeProvider(); InitializeProvider();
ASSERT_THAT(provider_->GetLocalDeviceInfo(), NotNull()); ASSERT_THAT(provider_->GetLocalDeviceInfo(), NotNull());
EXPECT_TRUE( EXPECT_TRUE(
...@@ -198,8 +184,7 @@ TEST_F(LocalDeviceInfoProviderImplWithSyncInvalidationsTest, ...@@ -198,8 +184,7 @@ TEST_F(LocalDeviceInfoProviderImplWithSyncInvalidationsTest,
kFCMRegistrationToken); kFCMRegistrationToken);
} }
TEST_F(LocalDeviceInfoProviderImplWithSyncInvalidationsTest, TEST_F(LocalDeviceInfoProviderImplTest, ShouldPopulateInterestedDataTypes) {
ShouldPopulateInterestedDataTypes) {
InitializeProvider(); InitializeProvider();
ASSERT_THAT(provider_->GetLocalDeviceInfo(), NotNull()); ASSERT_THAT(provider_->GetLocalDeviceInfo(), NotNull());
EXPECT_TRUE(provider_->GetLocalDeviceInfo()->interested_data_types().Empty()); EXPECT_TRUE(provider_->GetLocalDeviceInfo()->interested_data_types().Empty());
......
...@@ -45,7 +45,7 @@ SyncInvalidationsServiceFactory::~SyncInvalidationsServiceFactory() = default; ...@@ -45,7 +45,7 @@ SyncInvalidationsServiceFactory::~SyncInvalidationsServiceFactory() = default;
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
SyncInvalidationsServiceFactory::BuildServiceInstanceFor( SyncInvalidationsServiceFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
if (!base::FeatureList::IsEnabled(switches::kSubscribeForSyncInvalidations)) { if (!base::FeatureList::IsEnabled(switches::kSyncSendInterestedDataTypes)) {
return nullptr; return nullptr;
} }
......
...@@ -48,7 +48,7 @@ WebViewSyncInvalidationsServiceFactory:: ...@@ -48,7 +48,7 @@ WebViewSyncInvalidationsServiceFactory::
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
WebViewSyncInvalidationsServiceFactory::BuildServiceInstanceFor( WebViewSyncInvalidationsServiceFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
if (!base::FeatureList::IsEnabled(switches::kSubscribeForSyncInvalidations)) { if (!base::FeatureList::IsEnabled(switches::kSyncSendInterestedDataTypes)) {
return nullptr; return nullptr;
} }
......
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