Commit b322e080 authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Fix ExternalPrefLoader tests when SplitSettingsSync is enabled

ExternalPrefLoaderTest.PrefReadInitiatesCorrectly is only relevant
pre-SplitSettingsSync, so disable the feature for that test.

ExternalProviderImplChromeOSTest.PriorityCompleted needs to be updated
to mark OOBE completed and simulate the correct type of priority pref
sync.

This is in preparation to enable SplitSettingsSync by default. See
failing tests in tryjobs from:
https://chromium-review.googlesource.com/c/chromium/src/+/2210623

Bug: 1060289
Change-Id: I3a3807c304334fa5a22df7e102f85ee1c629c312
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215249Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772263}
parent 8e865006
......@@ -122,6 +122,10 @@ class ExternalPrefLoaderTest : public testing::Test {
// Tests that we fire pref reading correctly after priority sync state
// is resolved by ExternalPrefLoader.
TEST_F(ExternalPrefLoaderTest, PrefReadInitiatesCorrectly) {
// This test is only relevant pre-SplitSettingsSync.
base::test::ScopedFeatureList feature_list;
feature_list.InitAndDisableFeature(chromeos::features::kSplitSettingsSync);
base::RunLoop run_loop;
scoped_refptr<ExternalPrefLoader> loader(
new TestExternalPrefLoader(profile(), run_loop.QuitWhenIdleClosure()));
......
......@@ -25,6 +25,8 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_pref_names.h"
#include "chromeos/system/fake_statistics_provider.h"
#include "chromeos/system/statistics_provider.h"
#include "components/sync/base/pref_names.h"
......@@ -231,18 +233,27 @@ TEST_F(ExternalProviderImplChromeOSTest, PriorityCompleted) {
identity_test_env_profile_adaptor->identity_test_env()->SetPrimaryAccount(
"test_user@gmail.com");
// OOBE screen completed with OS sync enabled.
PrefService* prefs = profile()->GetPrefs();
prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, true);
prefs->SetBoolean(chromeos::prefs::kSyncOobeCompleted, true);
// App sync will wait for priority sync to complete.
service_->CheckForExternalUpdates();
// SplitSettingsSync makes ExternalPrefLoader wait for OS priority prefs.
syncer::ModelType priority_pref_type =
chromeos::features::IsSplitSettingsSyncEnabled()
? syncer::OS_PRIORITY_PREFERENCES
: syncer::PRIORITY_PREFERENCES;
// Priority sync completed.
PrefServiceSyncableFromProfile(profile_.get())
->GetSyncableService(syncer::PRIORITY_PREFERENCES)
->MergeDataAndStartSyncing(syncer::PRIORITY_PREFERENCES,
syncer::SyncDataList(),
std::unique_ptr<syncer::SyncChangeProcessor>(
new syncer::FakeSyncChangeProcessor),
std::unique_ptr<syncer::SyncErrorFactory>(
new syncer::SyncErrorFactoryMock()));
PrefServiceSyncableFromProfile(profile())
->GetSyncableService(priority_pref_type)
->MergeDataAndStartSyncing(
priority_pref_type, syncer::SyncDataList(),
std::make_unique<syncer::FakeSyncChangeProcessor>(),
std::make_unique<syncer::SyncErrorFactoryMock>());
content::WindowedNotificationObserver(
extensions::NOTIFICATION_CRX_INSTALLER_DONE,
......
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