Commit bb23ebe4 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Add more sync integration tests for pseudo-USS

We add integration test coverage for PREFERENCES under pseudo-USS, and
factor out some duplicated code to a newly introduced FeatureToggler, a
helper class to run tests with a feature switch enabled and disabled.

Bug: 870624
Change-Id: I6b1b446439969d5c6e948e21ca160876e14c5cdb
Reviewed-on: https://chromium-review.googlesource.com/1253762
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595740}
parent d39a4f95
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/sync/test/integration/feature_toggler.h"
FeatureToggler::FeatureToggler(const base::Feature& feature) {
if (GetParam()) {
override_features_.InitAndEnableFeature(feature);
} else {
override_features_.InitAndDisableFeature(feature);
}
}
FeatureToggler::~FeatureToggler() {}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_FEATURE_TOGGLER_H_
#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_FEATURE_TOGGLER_H_
#include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "testing/gtest/include/gtest/gtest.h"
// Class that enables or disables a feature switch based on a gTest test
// parameter, intended to be used as a base class of the test fixture. Must be
// the first base class of the test fixture to take effect during the
// construction of the test fixture itself.
class FeatureToggler : public testing::WithParamInterface<bool> {
public:
explicit FeatureToggler(const base::Feature& feature);
~FeatureToggler();
private:
base::test::ScopedFeatureList override_features_;
DISALLOW_COPY_AND_ASSIGN(FeatureToggler);
};
#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_FEATURE_TOGGLER_H_
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/sync/test/integration/apps_helper.h" #include "chrome/browser/sync/test/integration/apps_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
#include "components/browser_sync/profile_sync_service.h" #include "components/browser_sync/profile_sync_service.h"
...@@ -16,25 +16,10 @@ using apps_helper::AllProfilesHaveSameApps; ...@@ -16,25 +16,10 @@ using apps_helper::AllProfilesHaveSameApps;
using apps_helper::InstallApp; using apps_helper::InstallApp;
using apps_helper::InstallPlatformApp; using apps_helper::InstallPlatformApp;
// Class that enables or disables USS based on test parameter. Must be the first class SingleClientAppsSyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { SingleClientAppsSyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncPseudoUSSApps), SyncTest(SINGLE_CLIENT) {}
override_features_.InitAndEnableFeature(switches::kSyncPseudoUSSApps);
} else {
override_features_.InitAndDisableFeature(switches::kSyncPseudoUSSApps);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class SingleClientAppsSyncTest : public UssSwitchToggler, public SyncTest {
public:
SingleClientAppsSyncTest() : SyncTest(SINGLE_CLIENT) {}
~SingleClientAppsSyncTest() override {} ~SingleClientAppsSyncTest() override {}
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h" #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
...@@ -50,25 +50,10 @@ using bookmarks_helper::SetTitle; ...@@ -50,25 +50,10 @@ using bookmarks_helper::SetTitle;
// SyncTest and using it in all single client tests. // SyncTest and using it in all single client tests.
const int kSingleProfileIndex = 0; const int kSingleProfileIndex = 0;
// Class that enables or disables USS based on test parameter. Must be the first class SingleClientBookmarksSyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { SingleClientBookmarksSyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncUSSBookmarks), SyncTest(SINGLE_CLIENT) {}
override_features_.InitAndEnableFeature(switches::kSyncUSSBookmarks);
} else {
override_features_.InitAndDisableFeature(switches::kSyncUSSBookmarks);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class SingleClientBookmarksSyncTest : public UssSwitchToggler, public SyncTest {
public:
SingleClientBookmarksSyncTest() : SyncTest(SINGLE_CLIENT) {}
~SingleClientBookmarksSyncTest() override {} ~SingleClientBookmarksSyncTest() override {}
// Verify that the local bookmark model (for the Profile corresponding to // Verify that the local bookmark model (for the Profile corresponding to
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/sync/test/integration/dictionary_helper.h" #include "chrome/browser/sync/test/integration/dictionary_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
#include "components/browser_sync/profile_sync_service.h" #include "components/browser_sync/profile_sync_service.h"
...@@ -12,28 +12,11 @@ ...@@ -12,28 +12,11 @@
namespace { namespace {
// Class that enables or disables USS based on test parameter. Must be the first class SingleClientDictionarySyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { SingleClientDictionarySyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncPseudoUSSDictionary),
override_features_.InitAndEnableFeature( SyncTest(SINGLE_CLIENT) {}
switches::kSyncPseudoUSSDictionary);
} else {
override_features_.InitAndDisableFeature(
switches::kSyncPseudoUSSDictionary);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class SingleClientDictionarySyncTest : public UssSwitchToggler,
public SyncTest {
public:
SingleClientDictionarySyncTest() : SyncTest(SINGLE_CLIENT) {}
~SingleClientDictionarySyncTest() override {} ~SingleClientDictionarySyncTest() override {}
private: private:
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h" #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/sync/test/integration/await_match_status_change_checker.h" #include "chrome/browser/sync/test/integration/await_match_status_change_checker.h"
#include "chrome/browser/sync/test/integration/extensions_helper.h" #include "chrome/browser/sync/test/integration/extensions_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
#include "components/browser_sync/profile_sync_service.h" #include "components/browser_sync/profile_sync_service.h"
...@@ -20,28 +20,11 @@ using extensions_helper::GetInstalledExtensions; ...@@ -20,28 +20,11 @@ using extensions_helper::GetInstalledExtensions;
using extensions_helper::InstallExtension; using extensions_helper::InstallExtension;
using extensions_helper::InstallExtensionForAllProfiles; using extensions_helper::InstallExtensionForAllProfiles;
// Class that enables or disables USS based on test parameter. Must be the first class SingleClientExtensionsSyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { SingleClientExtensionsSyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncPseudoUSSExtensions),
override_features_.InitAndEnableFeature( SyncTest(SINGLE_CLIENT) {}
switches::kSyncPseudoUSSExtensions);
} else {
override_features_.InitAndDisableFeature(
switches::kSyncPseudoUSSExtensions);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class SingleClientExtensionsSyncTest : public UssSwitchToggler,
public SyncTest {
public:
SingleClientExtensionsSyncTest() : SyncTest(SINGLE_CLIENT) {}
~SingleClientExtensionsSyncTest() override {} ~SingleClientExtensionsSyncTest() override {}
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/task/cancelable_task_tracker.h" #include "base/task/cancelable_task_tracker.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/web_history_service_factory.h" #include "chrome/browser/history/web_history_service_factory.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
...@@ -22,24 +22,6 @@ namespace { ...@@ -22,24 +22,6 @@ namespace {
using sync_pb::HistoryDeleteDirectiveSpecifics; using sync_pb::HistoryDeleteDirectiveSpecifics;
// Class that enables or disables USS based on test parameter. Must be the first
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public:
UssSwitchToggler() {
if (GetParam()) {
override_features_.InitAndEnableFeature(
switches::kSyncPseudoUSSHistoryDeleteDirectives);
} else {
override_features_.InitAndDisableFeature(
switches::kSyncPseudoUSSHistoryDeleteDirectives);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
// Allows to wait until the number of server-side entities is equal to a // Allows to wait until the number of server-side entities is equal to a
// expected number. // expected number.
class HistoryDeleteDirectivesEqualityChecker class HistoryDeleteDirectivesEqualityChecker
...@@ -80,10 +62,12 @@ class HistoryDeleteDirectivesEqualityChecker ...@@ -80,10 +62,12 @@ class HistoryDeleteDirectivesEqualityChecker
DISALLOW_COPY_AND_ASSIGN(HistoryDeleteDirectivesEqualityChecker); DISALLOW_COPY_AND_ASSIGN(HistoryDeleteDirectivesEqualityChecker);
}; };
class SingleClientHistoryDeleteDirectivesSyncTest : public UssSwitchToggler, class SingleClientHistoryDeleteDirectivesSyncTest : public FeatureToggler,
public SyncTest { public SyncTest {
public: public:
SingleClientHistoryDeleteDirectivesSyncTest() : SyncTest(SINGLE_CLIENT) {} SingleClientHistoryDeleteDirectivesSyncTest()
: FeatureToggler(switches::kSyncPseudoUSSHistoryDeleteDirectives),
SyncTest(SINGLE_CLIENT) {}
~SingleClientHistoryDeleteDirectivesSyncTest() override {} ~SingleClientHistoryDeleteDirectivesSyncTest() override {}
bool WaitForHistoryDeleteDirectives(size_t num_expected_directives) { bool WaitForHistoryDeleteDirectives(size_t num_expected_directives) {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/preferences_helper.h" #include "chrome/browser/sync/test/integration/preferences_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
#include "components/pref_registry/pref_registry_syncable.h" #include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/json_pref_store.h" #include "components/prefs/json_pref_store.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/sync/driver/sync_driver_switches.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
using preferences_helper::BooleanPrefMatches; using preferences_helper::BooleanPrefMatches;
...@@ -24,16 +26,18 @@ using testing::NotNull; ...@@ -24,16 +26,18 @@ using testing::NotNull;
namespace { namespace {
class SingleClientPreferencesSyncTest : public SyncTest { class SingleClientPreferencesSyncTest : public FeatureToggler, public SyncTest {
public: public:
SingleClientPreferencesSyncTest() : SyncTest(SINGLE_CLIENT) {} SingleClientPreferencesSyncTest()
: FeatureToggler(switches::kSyncPseudoUSSPreferences),
SyncTest(SINGLE_CLIENT) {}
~SingleClientPreferencesSyncTest() override {} ~SingleClientPreferencesSyncTest() override {}
private: private:
DISALLOW_COPY_AND_ASSIGN(SingleClientPreferencesSyncTest); DISALLOW_COPY_AND_ASSIGN(SingleClientPreferencesSyncTest);
}; };
IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest, Sanity) { IN_PROC_BROWSER_TEST_P(SingleClientPreferencesSyncTest, Sanity) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage)); ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
ChangeBooleanPref(0, prefs::kHomePageIsNewTabPage); ChangeBooleanPref(0, prefs::kHomePageIsNewTabPage);
...@@ -43,7 +47,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest, Sanity) { ...@@ -43,7 +47,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest, Sanity) {
// This test simply verifies that preferences registered after sync started // This test simply verifies that preferences registered after sync started
// get properly synced. // get properly synced.
IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest, LateRegistration) { IN_PROC_BROWSER_TEST_P(SingleClientPreferencesSyncTest, LateRegistration) {
ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
PrefRegistrySyncable* registry = GetRegistry(GetProfile(0)); PrefRegistrySyncable* registry = GetRegistry(GetProfile(0));
const std::string pref_name = "testing.my-test-preference"; const std::string pref_name = "testing.my-test-preference";
...@@ -64,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest, LateRegistration) { ...@@ -64,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest, LateRegistration) {
EXPECT_FALSE(BooleanPrefMatches(pref_name.c_str())); EXPECT_FALSE(BooleanPrefMatches(pref_name.c_str()));
} }
IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest, IN_PROC_BROWSER_TEST_P(SingleClientPreferencesSyncTest,
ShouldRemoveBadDataWhenRegistering) { ShouldRemoveBadDataWhenRegistering) {
// Populate the data store with data of type boolean but register as string. // Populate the data store with data of type boolean but register as string.
SetPreexistingPreferencesFileContents( SetPreexistingPreferencesFileContents(
...@@ -91,4 +95,8 @@ IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest, ...@@ -91,4 +95,8 @@ IN_PROC_BROWSER_TEST_F(SingleClientPreferencesSyncTest,
EXPECT_FALSE(pref_store->GetValue("testing.my-test-preference", &result)); EXPECT_FALSE(pref_store->GetValue("testing.my-test-preference", &result));
} }
INSTANTIATE_TEST_CASE_P(USS,
SingleClientPreferencesSyncTest,
::testing::Values(false, true));
} // namespace } // namespace
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/sync/sessions/sync_sessions_router_tab_helper.h" #include "chrome/browser/sync/sessions/sync_sessions_router_tab_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/session_hierarchy_match_checker.h" #include "chrome/browser/sync/test/integration/session_hierarchy_match_checker.h"
#include "chrome/browser/sync/test/integration/sessions_helper.h" #include "chrome/browser/sync/test/integration/sessions_helper.h"
...@@ -70,25 +70,10 @@ void ExpectUniqueSampleGE(const HistogramTester& histogram_tester, ...@@ -70,25 +70,10 @@ void ExpectUniqueSampleGE(const HistogramTester& histogram_tester,
EXPECT_EQ(sample_count, samples->TotalCount()); EXPECT_EQ(sample_count, samples->TotalCount());
} }
// Class that enables or disables USS based on test parameter. Must be the first class SingleClientSessionsSyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { SingleClientSessionsSyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncUSSSessions), SyncTest(SINGLE_CLIENT) {}
override_features_.InitAndEnableFeature(switches::kSyncUSSSessions);
} else {
override_features_.InitAndDisableFeature(switches::kSyncUSSSessions);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class SingleClientSessionsSyncTest : public UssSwitchToggler, public SyncTest {
public:
SingleClientSessionsSyncTest() : SyncTest(SINGLE_CLIENT) {}
~SingleClientSessionsSyncTest() override {} ~SingleClientSessionsSyncTest() override {}
void ExpectNavigationChain(const std::vector<GURL>& urls) { void ExpectNavigationChain(const std::vector<GURL>& urls) {
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/themes_helper.h" #include "chrome/browser/sync/test/integration/themes_helper.h"
...@@ -25,25 +25,11 @@ using themes_helper::UsingSystemTheme; ...@@ -25,25 +25,11 @@ using themes_helper::UsingSystemTheme;
namespace { namespace {
// Class that enables or disables USS based on test parameter. Must be the first class SingleClientThemesSyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { SingleClientThemesSyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncPseudoUSSThemes),
override_features_.InitAndEnableFeature(switches::kSyncPseudoUSSThemes); SyncTest(SINGLE_CLIENT) {}
} else {
override_features_.InitAndDisableFeature(switches::kSyncPseudoUSSThemes);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class SingleClientThemesSyncTest : public UssSwitchToggler, public SyncTest {
public:
SingleClientThemesSyncTest() : SyncTest(SINGLE_CLIENT) {}
~SingleClientThemesSyncTest() override {} ~SingleClientThemesSyncTest() override {}
private: private:
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/bookmark_app_helper.h" #include "chrome/browser/extensions/bookmark_app_helper.h"
...@@ -16,6 +15,7 @@ ...@@ -16,6 +15,7 @@
#include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/test/integration/apps_helper.h" #include "chrome/browser/sync/test/integration/apps_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_app_helper.h" #include "chrome/browser/sync/test/integration/sync_app_helper.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
...@@ -49,22 +49,6 @@ using apps_helper::UninstallApp; ...@@ -49,22 +49,6 @@ using apps_helper::UninstallApp;
namespace { namespace {
// Class that enables or disables USS based on test parameter. Must be the first
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public:
UssSwitchToggler() {
if (GetParam()) {
override_features_.InitAndEnableFeature(switches::kSyncPseudoUSSApps);
} else {
override_features_.InitAndDisableFeature(switches::kSyncPseudoUSSApps);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
extensions::ExtensionRegistry* GetExtensionRegistry(Profile* profile) { extensions::ExtensionRegistry* GetExtensionRegistry(Profile* profile) {
return extensions::ExtensionRegistry::Get(profile); return extensions::ExtensionRegistry::Get(profile);
} }
...@@ -75,9 +59,10 @@ extensions::ExtensionService* GetExtensionService(Profile* profile) { ...@@ -75,9 +59,10 @@ extensions::ExtensionService* GetExtensionService(Profile* profile) {
} // namespace } // namespace
class TwoClientAppsSyncTest : public UssSwitchToggler, public SyncTest { class TwoClientAppsSyncTest : public FeatureToggler, public SyncTest {
public: public:
TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) { TwoClientAppsSyncTest()
: FeatureToggler(switches::kSyncPseudoUSSApps), SyncTest(TWO_CLIENT) {
DisableVerifier(); DisableVerifier();
} }
......
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
#include "base/rand_util.h" #include "base/rand_util.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h" #include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h" #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
...@@ -78,22 +78,6 @@ const char kGenericFolderName[] = "Folder Name"; ...@@ -78,22 +78,6 @@ const char kGenericFolderName[] = "Folder Name";
const char kGenericSubfolderName[] = "Subfolder Name"; const char kGenericSubfolderName[] = "Subfolder Name";
const char kValidPassphrase[] = "passphrase!"; const char kValidPassphrase[] = "passphrase!";
// Class that enables or disables USS based on test parameter. Must be the first
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public:
UssSwitchToggler() {
if (GetParam()) {
override_features_.InitAndEnableFeature(switches::kSyncUSSBookmarks);
} else {
override_features_.InitAndDisableFeature(switches::kSyncUSSBookmarks);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class TwoClientBookmarksSyncTest : public SyncTest { class TwoClientBookmarksSyncTest : public SyncTest {
public: public:
TwoClientBookmarksSyncTest() : SyncTest(TWO_CLIENT) {} TwoClientBookmarksSyncTest() : SyncTest(TWO_CLIENT) {}
...@@ -115,10 +99,11 @@ class TwoClientBookmarksSyncTest : public SyncTest { ...@@ -115,10 +99,11 @@ class TwoClientBookmarksSyncTest : public SyncTest {
// TODO(crbug.com/516866): Merge the two fixtures into one when all tests are // TODO(crbug.com/516866): Merge the two fixtures into one when all tests are
// passing for USS. // passing for USS.
class TwoClientBookmarksSyncTestIncludingUssTests class TwoClientBookmarksSyncTestIncludingUssTests
: public UssSwitchToggler, : public FeatureToggler,
public TwoClientBookmarksSyncTest { public TwoClientBookmarksSyncTest {
public: public:
TwoClientBookmarksSyncTestIncludingUssTests() {} TwoClientBookmarksSyncTestIncludingUssTests()
: FeatureToggler(switches::kSyncUSSBookmarks) {}
~TwoClientBookmarksSyncTestIncludingUssTests() override {} ~TwoClientBookmarksSyncTestIncludingUssTests() override {}
private: private:
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/sync/test/integration/dictionary_helper.h" #include "chrome/browser/sync/test/integration/dictionary_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
...@@ -18,27 +18,11 @@ namespace { ...@@ -18,27 +18,11 @@ namespace {
using spellcheck::kMaxSyncableDictionaryWords; using spellcheck::kMaxSyncableDictionaryWords;
// Class that enables or disables USS based on test parameter. Must be the first class TwoClientDictionarySyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { TwoClientDictionarySyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncPseudoUSSDictionary),
override_features_.InitAndEnableFeature( SyncTest(TWO_CLIENT) {}
switches::kSyncPseudoUSSDictionary);
} else {
override_features_.InitAndDisableFeature(
switches::kSyncPseudoUSSDictionary);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class TwoClientDictionarySyncTest : public UssSwitchToggler, public SyncTest {
public:
TwoClientDictionarySyncTest() : SyncTest(TWO_CLIENT) {}
~TwoClientDictionarySyncTest() override {} ~TwoClientDictionarySyncTest() override {}
bool TestUsesSelfNotifications() override { return false; } bool TestUsesSelfNotifications() override { return false; }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/sync/test/integration/extensions_helper.h" #include "chrome/browser/sync/test/integration/extensions_helper.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
...@@ -23,27 +23,13 @@ using extensions_helper::IncognitoEnableExtension; ...@@ -23,27 +23,13 @@ using extensions_helper::IncognitoEnableExtension;
using extensions_helper::InstallExtension; using extensions_helper::InstallExtension;
using extensions_helper::UninstallExtension; using extensions_helper::UninstallExtension;
// Class that enables or disables USS based on test parameter. Must be the first class TwoClientExtensionsSyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { TwoClientExtensionsSyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncPseudoUSSExtensions),
override_features_.InitAndEnableFeature( SyncTest(TWO_CLIENT) {
switches::kSyncPseudoUSSExtensions); DisableVerifier();
} else {
override_features_.InitAndDisableFeature(
switches::kSyncPseudoUSSExtensions);
} }
}
private:
base::test::ScopedFeatureList override_features_;
};
class TwoClientExtensionsSyncTest : public UssSwitchToggler, public SyncTest {
public:
TwoClientExtensionsSyncTest() : SyncTest(TWO_CLIENT) { DisableVerifier(); }
bool TestUsesSelfNotifications() override { return false; } bool TestUsesSelfNotifications() override { return false; }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/preferences_helper.h" #include "chrome/browser/sync/test/integration/preferences_helper.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
...@@ -15,6 +16,7 @@ ...@@ -15,6 +16,7 @@
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h" #include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/sync/driver/sync_driver_switches.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
using preferences_helper::BooleanPrefMatches; using preferences_helper::BooleanPrefMatches;
...@@ -28,9 +30,13 @@ using preferences_helper::GetRegistry; ...@@ -28,9 +30,13 @@ using preferences_helper::GetRegistry;
using testing::Eq; using testing::Eq;
using user_prefs::PrefRegistrySyncable; using user_prefs::PrefRegistrySyncable;
class TwoClientPreferencesSyncTest : public SyncTest { namespace {
class TwoClientPreferencesSyncTest : public FeatureToggler, public SyncTest {
public: public:
TwoClientPreferencesSyncTest() : SyncTest(TWO_CLIENT) {} TwoClientPreferencesSyncTest()
: FeatureToggler(switches::kSyncPseudoUSSPreferences),
SyncTest(TWO_CLIENT) {}
~TwoClientPreferencesSyncTest() override {} ~TwoClientPreferencesSyncTest() override {}
bool TestUsesSelfNotifications() override { return false; } bool TestUsesSelfNotifications() override { return false; }
...@@ -39,7 +45,7 @@ class TwoClientPreferencesSyncTest : public SyncTest { ...@@ -39,7 +45,7 @@ class TwoClientPreferencesSyncTest : public SyncTest {
DISALLOW_COPY_AND_ASSIGN(TwoClientPreferencesSyncTest); DISALLOW_COPY_AND_ASSIGN(TwoClientPreferencesSyncTest);
}; };
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(Sanity)) { IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTest, E2E_ENABLED(Sanity)) {
DisableVerifier(); DisableVerifier();
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(StringPrefMatchChecker(prefs::kHomePage).Wait()); ASSERT_TRUE(StringPrefMatchChecker(prefs::kHomePage).Wait());
...@@ -52,7 +58,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(Sanity)) { ...@@ -52,7 +58,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(Sanity)) {
} }
} }
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(BooleanPref)) { IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTest, E2E_ENABLED(BooleanPref)) {
ASSERT_TRUE(SetupSync()); ASSERT_TRUE(SetupSync());
ASSERT_TRUE(BooleanPrefMatchChecker(prefs::kHomePageIsNewTabPage).Wait()); ASSERT_TRUE(BooleanPrefMatchChecker(prefs::kHomePageIsNewTabPage).Wait());
...@@ -60,7 +66,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(BooleanPref)) { ...@@ -60,7 +66,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(BooleanPref)) {
ASSERT_TRUE(BooleanPrefMatchChecker(prefs::kHomePageIsNewTabPage).Wait()); ASSERT_TRUE(BooleanPrefMatchChecker(prefs::kHomePageIsNewTabPage).Wait());
} }
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTest,
E2E_ENABLED(Bidirectional)) { E2E_ENABLED(Bidirectional)) {
ASSERT_TRUE(SetupSync()); ASSERT_TRUE(SetupSync());
...@@ -77,7 +83,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, ...@@ -77,7 +83,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
GetPrefs(0)->GetString(prefs::kHomePage)); GetPrefs(0)->GetString(prefs::kHomePage));
} }
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTest,
E2E_ENABLED(UnsyncableBooleanPref)) { E2E_ENABLED(UnsyncableBooleanPref)) {
ASSERT_TRUE(SetupSync()); ASSERT_TRUE(SetupSync());
DisableVerifier(); DisableVerifier();
...@@ -96,7 +102,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, ...@@ -96,7 +102,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
ASSERT_FALSE(BooleanPrefMatches(prefs::kDisableScreenshots)); ASSERT_FALSE(BooleanPrefMatches(prefs::kDisableScreenshots));
} }
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(StringPref)) { IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTest, E2E_ENABLED(StringPref)) {
ASSERT_TRUE(SetupSync()); ASSERT_TRUE(SetupSync());
ASSERT_TRUE(StringPrefMatchChecker(prefs::kHomePage).Wait()); ASSERT_TRUE(StringPrefMatchChecker(prefs::kHomePage).Wait());
...@@ -104,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(StringPref)) { ...@@ -104,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, E2E_ENABLED(StringPref)) {
ASSERT_TRUE(StringPrefMatchChecker(prefs::kHomePage).Wait()); ASSERT_TRUE(StringPrefMatchChecker(prefs::kHomePage).Wait());
} }
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTest,
E2E_ENABLED(ComplexPrefs)) { E2E_ENABLED(ComplexPrefs)) {
ASSERT_TRUE(SetupSync()); ASSERT_TRUE(SetupSync());
ASSERT_TRUE(IntegerPrefMatchChecker(prefs::kRestoreOnStartup).Wait()); ASSERT_TRUE(IntegerPrefMatchChecker(prefs::kRestoreOnStartup).Wait());
...@@ -130,7 +136,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, ...@@ -130,7 +136,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
#define MAYBE_SingleClientEnabledEncryptionBothChanged \ #define MAYBE_SingleClientEnabledEncryptionBothChanged \
SingleClientEnabledEncryptionBothChanged SingleClientEnabledEncryptionBothChanged
#endif #endif
IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_P(
TwoClientPreferencesSyncTest, TwoClientPreferencesSyncTest,
E2E_ENABLED(MAYBE_SingleClientEnabledEncryptionBothChanged)) { E2E_ENABLED(MAYBE_SingleClientEnabledEncryptionBothChanged)) {
ASSERT_TRUE(SetupSync()); ASSERT_TRUE(SetupSync());
...@@ -146,7 +152,8 @@ IN_PROC_BROWSER_TEST_F( ...@@ -146,7 +152,8 @@ IN_PROC_BROWSER_TEST_F(
ASSERT_TRUE(BooleanPrefMatchChecker(prefs::kHomePageIsNewTabPage).Wait()); ASSERT_TRUE(BooleanPrefMatchChecker(prefs::kHomePageIsNewTabPage).Wait());
} }
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, IN_PROC_BROWSER_TEST_P(
TwoClientPreferencesSyncTest,
E2E_ENABLED(BothClientsEnabledEncryptionAndChangedMultipleTimes)) { E2E_ENABLED(BothClientsEnabledEncryptionAndChangedMultipleTimes)) {
ASSERT_TRUE(SetupSync()); ASSERT_TRUE(SetupSync());
ASSERT_TRUE(BooleanPrefMatchChecker(prefs::kHomePageIsNewTabPage).Wait()); ASSERT_TRUE(BooleanPrefMatchChecker(prefs::kHomePageIsNewTabPage).Wait());
...@@ -163,9 +170,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, ...@@ -163,9 +170,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
// The following tests use lower-level mechanisms to wait for sync cycle // The following tests use lower-level mechanisms to wait for sync cycle
// completions. Those only work reliably with self notifications turned on. // completions. Those only work reliably with self notifications turned on.
class TwoClientPreferencesSyncTestWithSelfNotifications : public SyncTest { class TwoClientPreferencesSyncTestWithSelfNotifications : public FeatureToggler,
public SyncTest {
public: public:
TwoClientPreferencesSyncTestWithSelfNotifications() : SyncTest(TWO_CLIENT) {} TwoClientPreferencesSyncTestWithSelfNotifications()
: FeatureToggler(switches::kSyncPseudoUSSPreferences),
SyncTest(TWO_CLIENT) {}
~TwoClientPreferencesSyncTestWithSelfNotifications() override {} ~TwoClientPreferencesSyncTestWithSelfNotifications() override {}
void SetUp() override { void SetUp() override {
...@@ -183,7 +193,7 @@ class TwoClientPreferencesSyncTestWithSelfNotifications : public SyncTest { ...@@ -183,7 +193,7 @@ class TwoClientPreferencesSyncTestWithSelfNotifications : public SyncTest {
}; };
// Tests that late registered prefs are kept in sync with other clients. // Tests that late registered prefs are kept in sync with other clients.
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications, IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTestWithSelfNotifications,
E2E_ENABLED(LateRegisteredPrefsShouldSync)) { E2E_ENABLED(LateRegisteredPrefsShouldSync)) {
// client0 has the pref registered before sync and is modifying a pref before // client0 has the pref registered before sync and is modifying a pref before
// that pref got registered with client1 (but after client1 started syncing). // that pref got registered with client1 (but after client1 started syncing).
...@@ -222,7 +232,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications, ...@@ -222,7 +232,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications,
EXPECT_THAT(GetPrefs(0)->GetBoolean(pref_name), Eq(true)); EXPECT_THAT(GetPrefs(0)->GetBoolean(pref_name), Eq(true));
} }
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications, IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTestWithSelfNotifications,
E2E_ENABLED(ShouldKeepLocalDataOnTypeMismatch)) { E2E_ENABLED(ShouldKeepLocalDataOnTypeMismatch)) {
// Client 1 has type-conflicting data in it's pref file. Verify that incoming // Client 1 has type-conflicting data in it's pref file. Verify that incoming
// values from sync of other type do not modify the local state. // values from sync of other type do not modify the local state.
...@@ -258,7 +268,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications, ...@@ -258,7 +268,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications,
// Verifies that priority synced preferences and regular sycned preferences are // Verifies that priority synced preferences and regular sycned preferences are
// kept separate. // kept separate.
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications, IN_PROC_BROWSER_TEST_P(TwoClientPreferencesSyncTestWithSelfNotifications,
E2E_ENABLED(ShouldIsolatePriorityPreferences)) { E2E_ENABLED(ShouldIsolatePriorityPreferences)) {
// Register a pref as priority with client0 and regular synced with client1. // Register a pref as priority with client0 and regular synced with client1.
ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
...@@ -282,3 +292,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications, ...@@ -282,3 +292,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTestWithSelfNotifications,
EXPECT_THAT(GetPrefs(0)->GetString(pref_name), Eq("priority value")); EXPECT_THAT(GetPrefs(0)->GetString(pref_name), Eq("priority value"));
EXPECT_THAT(GetPrefs(1)->GetString(pref_name), Eq("non-priority value")); EXPECT_THAT(GetPrefs(1)->GetString(pref_name), Eq("non-priority value"));
} }
INSTANTIATE_TEST_CASE_P(USS,
TwoClientPreferencesSyncTest,
::testing::Values(false, true));
INSTANTIATE_TEST_CASE_P(USS,
TwoClientPreferencesSyncTestWithSelfNotifications,
::testing::Values(false, true));
} // namespace
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#include "base/guid.h" #include "base/guid.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/passwords_helper.h" #include "chrome/browser/sync/test/integration/passwords_helper.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sessions_helper.h" #include "chrome/browser/sync/test/integration/sessions_helper.h"
...@@ -32,25 +32,10 @@ using sessions_helper::SessionWindowMap; ...@@ -32,25 +32,10 @@ using sessions_helper::SessionWindowMap;
using sessions_helper::SyncedSessionVector; using sessions_helper::SyncedSessionVector;
using sessions_helper::WindowsMatch; using sessions_helper::WindowsMatch;
// Class that enables or disables USS based on test parameter. Must be the first class TwoClientSessionsSyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { TwoClientSessionsSyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncUSSSessions), SyncTest(TWO_CLIENT) {}
override_features_.InitAndEnableFeature(switches::kSyncUSSSessions);
} else {
override_features_.InitAndDisableFeature(switches::kSyncUSSSessions);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class TwoClientSessionsSyncTest : public UssSwitchToggler, public SyncTest {
public:
TwoClientSessionsSyncTest() : SyncTest(TWO_CLIENT) {}
~TwoClientSessionsSyncTest() override {} ~TwoClientSessionsSyncTest() override {}
void WaitForWindowsInForeignSession(int index, ScopedWindowMap windows) { void WaitForWindowsInForeignSession(int index, ScopedWindowMap windows) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h" #include "chrome/browser/sync/test/integration/feature_toggler.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
...@@ -21,25 +21,10 @@ using themes_helper::UsingCustomTheme; ...@@ -21,25 +21,10 @@ using themes_helper::UsingCustomTheme;
using themes_helper::UsingDefaultTheme; using themes_helper::UsingDefaultTheme;
using themes_helper::UsingSystemTheme; using themes_helper::UsingSystemTheme;
// Class that enables or disables USS based on test parameter. Must be the first class TwoClientThemesSyncTest : public FeatureToggler, public SyncTest {
// base class of the test fixture.
class UssSwitchToggler : public testing::WithParamInterface<bool> {
public: public:
UssSwitchToggler() { TwoClientThemesSyncTest()
if (GetParam()) { : FeatureToggler(switches::kSyncPseudoUSSThemes), SyncTest(TWO_CLIENT) {}
override_features_.InitAndEnableFeature(switches::kSyncPseudoUSSThemes);
} else {
override_features_.InitAndDisableFeature(switches::kSyncPseudoUSSThemes);
}
}
private:
base::test::ScopedFeatureList override_features_;
};
class TwoClientThemesSyncTest : public UssSwitchToggler, public SyncTest {
public:
TwoClientThemesSyncTest() : SyncTest(TWO_CLIENT) {}
~TwoClientThemesSyncTest() override {} ~TwoClientThemesSyncTest() override {}
bool TestUsesSelfNotifications() override { return false; } bool TestUsesSelfNotifications() override { return false; }
......
...@@ -5221,6 +5221,8 @@ if (!is_android && !is_fuchsia) { ...@@ -5221,6 +5221,8 @@ if (!is_android && !is_fuchsia) {
"../browser/sync/test/integration/fake_server_invalidation_service.h", "../browser/sync/test/integration/fake_server_invalidation_service.h",
"../browser/sync/test/integration/fake_server_match_status_checker.cc", "../browser/sync/test/integration/fake_server_match_status_checker.cc",
"../browser/sync/test/integration/fake_server_match_status_checker.h", "../browser/sync/test/integration/fake_server_match_status_checker.h",
"../browser/sync/test/integration/feature_toggler.cc",
"../browser/sync/test/integration/feature_toggler.h",
"../browser/sync/test/integration/migration_waiter.cc", "../browser/sync/test/integration/migration_waiter.cc",
"../browser/sync/test/integration/migration_waiter.h", "../browser/sync/test/integration/migration_waiter.h",
"../browser/sync/test/integration/migration_watcher.cc", "../browser/sync/test/integration/migration_watcher.cc",
......
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