Commit 9bf39445 authored by James Cook's avatar James Cook Committed by Commit Bot

Reland: cros: Fix SyncConsentTest when SplitSettingsSync is enabled

Fix:
I missed one case where we look up an element with the wrong name when
the feature is enabled.

Original description:
SplitSettingsSync adds some text to the OOBE sync consent dialog.
Update test expectations to match, otherwise the test will fail when
we flip the flag.

Bug: 1067212
Test: browser_tests --enable-features=SplitSettingsSync
Change-Id: I5273f94c389f0cb4c2a6f0ac9149e9d65ec24106
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136881
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Auto-Submit: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756667}

TBR=xiyuan@chromium.org

Change-Id: I5273f94c389f0cb4c2a6f0ac9149e9d65ec24106
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136871Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756786}
parent 17fdf440
...@@ -97,6 +97,29 @@ class SyncConsentTest : public OobeBaseTest { ...@@ -97,6 +97,29 @@ class SyncConsentTest : public OobeBaseTest {
void SetUpOnMainThread() override { void SetUpOnMainThread() override {
OobeBaseTest::SetUpOnMainThread(); OobeBaseTest::SetUpOnMainThread();
branded_build_override_ = WizardController::ForceBrandedBuildForTesting(); branded_build_override_ = WizardController::ForceBrandedBuildForTesting();
if (features::IsSplitSettingsSyncEnabled()) {
expected_consent_ids_ = {
IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE,
IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME,
IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_DESCRIPTION,
IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_NAME,
IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_DESCRIPTION,
IDS_LOGIN_SYNC_CONSENT_SCREEN_REVIEW_BROWSER_SYNC_OPTIONS,
IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_NAME,
IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_DESCRIPTION,
IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT_AND_CONTINUE,
};
} else {
expected_consent_ids_ = {
IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE,
IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_NAME,
IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_DESCRIPTION,
IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_NAME,
IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_DESCRIPTION,
IDS_LOGIN_SYNC_CONSENT_SCREEN_REVIEW_SYNC_OPTIONS_LATER,
IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT_AND_CONTINUE,
};
}
} }
void TearDownOnMainThread() override { void TearDownOnMainThread() override {
...@@ -158,8 +181,13 @@ class SyncConsentTest : public OobeBaseTest { ...@@ -158,8 +181,13 @@ class SyncConsentTest : public OobeBaseTest {
screen->OnStateChanged(nullptr); screen->OnStateChanged(nullptr);
test::OobeJS().CreateVisibilityWaiter(true, {"sync-consent-impl"})->Wait(); test::OobeJS().CreateVisibilityWaiter(true, {"sync-consent-impl"})->Wait();
test::OobeJS().ExpectVisiblePath( if (features::IsSplitSettingsSyncEnabled()) {
{"sync-consent-impl", "syncConsentOverviewDialog"}); test::OobeJS().ExpectVisiblePath(
{"sync-consent-impl", "splitSettingsSyncConsentDialog"});
} else {
test::OobeJS().ExpectVisiblePath(
{"sync-consent-impl", "syncConsentOverviewDialog"});
}
test::OobeJS().TapOnPath( test::OobeJS().TapOnPath(
{"sync-consent-impl", "settingsSaveAndContinueButton"}); {"sync-consent-impl", "settingsSaveAndContinueButton"});
consent_recorded_waiter.Wait(); consent_recorded_waiter.Wait();
...@@ -174,7 +202,7 @@ class SyncConsentTest : public OobeBaseTest { ...@@ -174,7 +202,7 @@ class SyncConsentTest : public OobeBaseTest {
consent_recorded_waiter.consent_description_strings_); consent_recorded_waiter.consent_description_strings_);
EXPECT_EQ(expected_consent_confirmation_string, EXPECT_EQ(expected_consent_confirmation_string,
consent_recorded_waiter.consent_confirmation_string_); consent_recorded_waiter.consent_confirmation_string_);
EXPECT_EQ(expected_consent_ids, EXPECT_EQ(expected_consent_ids_,
consent_recorded_waiter.consent_description_ids_); consent_recorded_waiter.consent_description_ids_);
EXPECT_EQ(expected_consent_confirmation_id, EXPECT_EQ(expected_consent_confirmation_id,
consent_recorded_waiter.consent_confirmation_id_); consent_recorded_waiter.consent_confirmation_id_);
...@@ -182,23 +210,14 @@ class SyncConsentTest : public OobeBaseTest { ...@@ -182,23 +210,14 @@ class SyncConsentTest : public OobeBaseTest {
std::vector<std::string> GetLocalizedExpectedConsentStrings() const { std::vector<std::string> GetLocalizedExpectedConsentStrings() const {
std::vector<std::string> result; std::vector<std::string> result;
for (const int& id : expected_consent_ids) { for (const int& id : expected_consent_ids_) {
result.push_back(GetLocalizedConsentString(id)); result.push_back(GetLocalizedConsentString(id));
} }
return result; return result;
} }
const std::vector<int> expected_consent_ids = {
IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE,
IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_NAME,
IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_DESCRIPTION,
IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_NAME,
IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_DESCRIPTION,
IDS_LOGIN_SYNC_CONSENT_SCREEN_REVIEW_SYNC_OPTIONS_LATER,
IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT_AND_CONTINUE,
};
std::unique_ptr<base::AutoReset<bool>> branded_build_override_; std::unique_ptr<base::AutoReset<bool>> branded_build_override_;
std::vector<int> expected_consent_ids_;
FakeGaiaMixin fake_gaia_{&mixin_host_, embedded_test_server()}; FakeGaiaMixin fake_gaia_{&mixin_host_, embedded_test_server()};
private: private:
...@@ -209,15 +228,35 @@ IN_PROC_BROWSER_TEST_F(SyncConsentTest, SyncConsentRecorder) { ...@@ -209,15 +228,35 @@ IN_PROC_BROWSER_TEST_F(SyncConsentTest, SyncConsentRecorder) {
EXPECT_EQ(g_browser_process->GetApplicationLocale(), "en-US"); EXPECT_EQ(g_browser_process->GetApplicationLocale(), "en-US");
LoginToSyncConsentScreen(); LoginToSyncConsentScreen();
// For En-US we hardcode strings here to catch string issues too. // For En-US we hardcode strings here to catch string issues too.
const std::vector<std::string> expected_consent_strings( std::vector<std::string> expected_consent_strings;
{"You're signed in!", "Chrome sync", if (features::IsSplitSettingsSyncEnabled()) {
"Your bookmarks, history, passwords, and other settings will be synced " expected_consent_strings = {
"to your Google Account so you can use them on all your devices.", "You're signed in!",
"Personalize Google services", "Settings sync",
"Google may use your browsing history to personalize Search, ads, and " "Your apps, settings, and other customizations will sync across all "
"other Google services. You can change this anytime at " "Chrome OS devices signed in with your Google Account.",
"myaccount.google.com/activitycontrols/search", "Chrome sync",
"Review sync options following setup", "Accept and continue"}); "Your bookmarks, history, passwords, and other settings will be synced "
"to your Google Account so you can use them on all your devices.",
"Review browser sync options following setup",
"Personalize Google services",
"Google may use your browsing history to personalize Search, ads, and "
"other Google services. You can change this anytime at "
"myaccount.google.com/activitycontrols/search",
"Accept and continue"};
} else {
expected_consent_strings = {
"You're signed in!",
"Chrome sync",
"Your bookmarks, history, passwords, and other settings will be synced "
"to your Google Account so you can use them on all your devices.",
"Personalize Google services",
"Google may use your browsing history to personalize Search, ads, and "
"other Google services. You can change this anytime at "
"myaccount.google.com/activitycontrols/search",
"Review sync options following setup",
"Accept and continue"};
}
const std::string expected_consent_confirmation_string = const std::string expected_consent_confirmation_string =
"Accept and continue"; "Accept and continue";
SyncConsentRecorderTestImpl(expected_consent_strings, SyncConsentRecorderTestImpl(expected_consent_strings,
......
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