Skip to content

Commit

Permalink
History Sync opt-in experiment: Update strings
Browse files Browse the repository at this point in the history
Update strings to approved ones, add more arms, remove double bottom margin.

Bug: 1412453
Fixed: 1417235
Change-Id: Iacb04f5c28e2dd16cbaf6e60c9562e28eee3f97b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4261571
Reviewed-by: Tanmoy Mollik <triploblastic@google.com>
Reviewed-by: Marc Treib <treib@chromium.org>
Commit-Queue: Jens Mueller <muellerj@google.com>
Cr-Commit-Position: refs/heads/main@{#1107396}
  • Loading branch information
Jens Mueller authored and Chromium LUCI CQ committed Feb 20, 2023
1 parent da38733 commit a50b40b
Show file tree
Hide file tree
Showing 15 changed files with 195 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,91 @@ public void testTangibleSyncConsentFragmentDefaultAccount() throws IOException {
"tangible_sync_consent_fragment_default_account");
}

@Test
@LargeTest
@Feature("RenderTest")
@EnableFeatures({ChromeFeatureList.TANGIBLE_SYNC + ":group_id/2"})
public void testTangibleSyncConsentFragmentVariantBDefaultAccount() throws IOException {
CoreAccountInfo accountInfo =
mSigninTestRule.addAccount(AccountManagerTestRule.TEST_ACCOUNT_EMAIL);
mSyncConsentActivity = ActivityTestUtils.waitForActivity(
InstrumentationRegistry.getInstrumentation(), SyncConsentActivity.class, () -> {
SyncConsentActivityLauncherImpl.get().launchActivityForTangibleSyncFlow(
mChromeActivityTestRule.getActivity(),
SigninAccessPoint.BOOKMARK_MANAGER, accountInfo.getEmail());
});
mRenderTestRule.render(mSyncConsentActivity.findViewById(R.id.fragment_container),
"tangible_sync_consent_fragment_variant_b_default_account");
}

@Test
@LargeTest
@Feature("RenderTest")
@EnableFeatures({ChromeFeatureList.TANGIBLE_SYNC + ":group_id/3"})
public void testTangibleSyncConsentFragmentVariantCDefaultAccount() throws IOException {
CoreAccountInfo accountInfo =
mSigninTestRule.addAccount(AccountManagerTestRule.TEST_ACCOUNT_EMAIL);
mSyncConsentActivity = ActivityTestUtils.waitForActivity(
InstrumentationRegistry.getInstrumentation(), SyncConsentActivity.class, () -> {
SyncConsentActivityLauncherImpl.get().launchActivityForTangibleSyncFlow(
mChromeActivityTestRule.getActivity(),
SigninAccessPoint.BOOKMARK_MANAGER, accountInfo.getEmail());
});
mRenderTestRule.render(mSyncConsentActivity.findViewById(R.id.fragment_container),
"tangible_sync_consent_fragment_variant_c_default_account");
}

@Test
@LargeTest
@Feature("RenderTest")
@EnableFeatures({ChromeFeatureList.TANGIBLE_SYNC + ":group_id/4"})
public void testTangibleSyncConsentFragmentVariantDDefaultAccount() throws IOException {
CoreAccountInfo accountInfo =
mSigninTestRule.addAccount(AccountManagerTestRule.TEST_ACCOUNT_EMAIL);
mSyncConsentActivity = ActivityTestUtils.waitForActivity(
InstrumentationRegistry.getInstrumentation(), SyncConsentActivity.class, () -> {
SyncConsentActivityLauncherImpl.get().launchActivityForTangibleSyncFlow(
mChromeActivityTestRule.getActivity(),
SigninAccessPoint.BOOKMARK_MANAGER, accountInfo.getEmail());
});
mRenderTestRule.render(mSyncConsentActivity.findViewById(R.id.fragment_container),
"tangible_sync_consent_fragment_variant_d_default_account");
}

@Test
@LargeTest
@Feature("RenderTest")
@EnableFeatures({ChromeFeatureList.TANGIBLE_SYNC + ":group_id/5"})
public void testTangibleSyncConsentFragmentVariantEDefaultAccount() throws IOException {
CoreAccountInfo accountInfo =
mSigninTestRule.addAccount(AccountManagerTestRule.TEST_ACCOUNT_EMAIL);
mSyncConsentActivity = ActivityTestUtils.waitForActivity(
InstrumentationRegistry.getInstrumentation(), SyncConsentActivity.class, () -> {
SyncConsentActivityLauncherImpl.get().launchActivityForTangibleSyncFlow(
mChromeActivityTestRule.getActivity(),
SigninAccessPoint.BOOKMARK_MANAGER, accountInfo.getEmail());
});
mRenderTestRule.render(mSyncConsentActivity.findViewById(R.id.fragment_container),
"tangible_sync_consent_fragment_variant_e_default_account");
}

@Test
@LargeTest
@Feature("RenderTest")
@EnableFeatures({ChromeFeatureList.TANGIBLE_SYNC + ":group_id/6"})
public void testTangibleSyncConsentFragmentVariantFDefaultAccount() throws IOException {
CoreAccountInfo accountInfo =
mSigninTestRule.addAccount(AccountManagerTestRule.TEST_ACCOUNT_EMAIL);
mSyncConsentActivity = ActivityTestUtils.waitForActivity(
InstrumentationRegistry.getInstrumentation(), SyncConsentActivity.class, () -> {
SyncConsentActivityLauncherImpl.get().launchActivityForTangibleSyncFlow(
mChromeActivityTestRule.getActivity(),
SigninAccessPoint.BOOKMARK_MANAGER, accountInfo.getEmail());
});
mRenderTestRule.render(mSyncConsentActivity.findViewById(R.id.fragment_container),
"tangible_sync_consent_fragment_variant_f_default_account");
}

@Test
@LargeTest
@Feature("RenderTest")
Expand Down Expand Up @@ -773,6 +858,33 @@ public void testTangibleSyncConsentFragmentOnlyEnablesSpecificDataTypes() {
});
}

@Test
@MediumTest
@EnableFeatures({ChromeFeatureList.TANGIBLE_SYNC + ":group_id/6"})
public void testTangibleSyncConsentFragmentGroupFEnablesAllDataTypes() {
CoreAccountInfo accountInfo =
mSigninTestRule.addAccount(AccountManagerTestRule.TEST_ACCOUNT_EMAIL);
mSyncConsentActivity = ActivityTestUtils.waitForActivity(
InstrumentationRegistry.getInstrumentation(), SyncConsentActivity.class, () -> {
SyncConsentActivityLauncherImpl.get().launchActivityForTangibleSyncFlow(
mChromeActivityTestRule.getActivity(), SigninAccessPoint.SETTINGS,
accountInfo.getEmail());
});
onView(withId(R.id.positive_button)).perform(click());
// Wait for sync opt-in process to finish.
CriteriaHelper.pollUiThread(() -> {
return IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile())
.getIdentityManager()
.hasPrimaryAccount(ConsentLevel.SYNC);
});

TestThreadUtils.runOnUiThreadBlocking(() -> {
assertEquals(ALL_CLANK_SYNCABLE_DATA_TYPES, SyncService.get().getSelectedTypes());
assertTrue(SyncService.get().hasKeepEverythingSynced());
});
}

@Test
@LargeTest
@DisableFeatures({ChromeFeatureList.TANGIBLE_SYNC})
Expand Down
19 changes: 14 additions & 5 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -869,13 +869,22 @@ const FeatureEntry::FeatureVariation kQueryTilesVariations[] = {
const FeatureEntry::FeatureParam kTangibleSyncGroupA[] = {{"group_id", "1"}};
const FeatureEntry::FeatureParam kTangibleSyncGroupB[] = {{"group_id", "2"}};
const FeatureEntry::FeatureParam kTangibleSyncGroupC[] = {{"group_id", "3"}};
const FeatureEntry::FeatureParam kTangibleSyncGroupD[] = {{"group_id", "4"}};
const FeatureEntry::FeatureParam kTangibleSyncGroupE[] = {{"group_id", "5"}};
const FeatureEntry::FeatureParam kTangibleSyncGroupF[] = {{"group_id", "6"}};
const FeatureEntry::FeatureVariation kTangibleSyncVariations[] = {
{"(turn on sync and back up)", kTangibleSyncGroupA,
{"(pick up where you left off)", kTangibleSyncGroupA,
std::size(kTangibleSyncGroupA), nullptr},
{"(sync and back up)", kTangibleSyncGroupB, std::size(kTangibleSyncGroupB),
nullptr},
{"(turn on sync and sync data)", kTangibleSyncGroupC,
std::size(kTangibleSyncGroupC), nullptr}};
{"(browse across devices)", kTangibleSyncGroupB,
std::size(kTangibleSyncGroupB), nullptr},
{"(save time and type less)", kTangibleSyncGroupC,
std::size(kTangibleSyncGroupC), nullptr},
{"(get better suggestions)", kTangibleSyncGroupD,
std::size(kTangibleSyncGroupD), nullptr},
{"(sync your tabs and history)", kTangibleSyncGroupE,
std::size(kTangibleSyncGroupE), nullptr},
{"(Turn on sync?)", kTangibleSyncGroupF, std::size(kTangibleSyncGroupF),
nullptr}};
#endif // BUILDFLAG(IS_ANDROID)

const FeatureEntry::Choice kEnableGpuRasterizationChoices[] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ found in the LICENSE file.
android:id="@+id/sync_consent_details_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:gravity="center"
android:textAppearance="@style/TextAppearance.TextSmall.Secondary"
app:leading="@dimen/text_size_small_leading" />
</org.chromium.chrome.browser.ui.signin.SyncConsentView>
</org.chromium.chrome.browser.ui.signin.SyncConsentView>
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,16 @@ public abstract class SyncConsentFragmentBase
}

/** Group name for different UIs in tangible sync experiment. */
@IntDef({TangibleSyncGroup.GROUP_A, TangibleSyncGroup.GROUP_B, TangibleSyncGroup.GROUP_C})
@IntDef({TangibleSyncGroup.GROUP_A, TangibleSyncGroup.GROUP_B, TangibleSyncGroup.GROUP_C,
TangibleSyncGroup.GROUP_D, TangibleSyncGroup.GROUP_E, TangibleSyncGroup.GROUP_F})
@Retention(RetentionPolicy.SOURCE)
@interface TangibleSyncGroup {
int GROUP_A = 1;
int GROUP_B = 2;
int GROUP_C = 3;
int GROUP_D = 4;
int GROUP_E = 5;
int GROUP_F = 6;
}

private final AccountManagerFacade mAccountManagerFacade;
Expand Down Expand Up @@ -268,7 +272,9 @@ protected void signinAndEnableSync(
public void onSignInComplete() {
UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled(
Profile.getLastUsedRegularProfile(), true);
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TANGIBLE_SYNC)) {
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TANGIBLE_SYNC)
&& getTangibleSyncGroup() != TangibleSyncGroup.GROUP_F) {
// Groups A-E are only for enabling History and Tab Sync
SyncService.get().setSelectedTypes(false,
Set.of(UserSelectableType.HISTORY,
UserSelectableType.TABS));
Expand Down Expand Up @@ -497,7 +503,7 @@ private void updateSigninDetailsDescription(boolean addSettingsLink) {
new SpanApplier.SpanInfo(SETTINGS_LINK_OPEN, SETTINGS_LINK_CLOSE, settingsLinkSpan);
if (mSyncConsentView != null) {
mConsentTextTracker.setText(mSyncConsentView.getDetailsDescriptionView(),
R.string.history_sync_consent_details_description,
R.string.sync_consent_details_description,
input -> SpanApplier.applySpans(input.toString(), spanInfo));
} else {
mConsentTextTracker.setText(mSigninView.getDetailsDescriptionView(),
Expand All @@ -508,14 +514,14 @@ private void updateSigninDetailsDescription(boolean addSettingsLink) {

/** Sets texts for immutable elements. Accept button text is set by {@link #setHasAccounts}. */
private void updateConsentText() {
final @StringRes int refuseButtonTextId =
mSigninAccessPoint == SigninAccessPoint.SIGNIN_PROMO
|| mSigninAccessPoint == SigninAccessPoint.START_PAGE
? R.string.no_thanks
: R.string.cancel;
if (mSyncConsentView != null) {
updateSyncConsentViewText(R.string.no_thanks);
} else {
final @StringRes int refuseButtonTextId =
mSigninAccessPoint == SigninAccessPoint.SIGNIN_PROMO
|| mSigninAccessPoint == SigninAccessPoint.START_PAGE
? R.string.no_thanks
: R.string.cancel;
updateSigninViewText(refuseButtonTextId);
}
}
Expand All @@ -528,23 +534,37 @@ private void updateConsentText() {
private static @StringRes int getSyncConsentViewTitleText() {
switch (getTangibleSyncGroup()) {
case TangibleSyncGroup.GROUP_A:
return R.string.history_sync_consent_title;
return R.string.history_sync_consent_title_a;
case TangibleSyncGroup.GROUP_B:
return R.string.history_sync_consent_title_b;
case TangibleSyncGroup.GROUP_C:
return R.string.history_sync_consent_title_c;
case TangibleSyncGroup.GROUP_D:
return R.string.history_sync_consent_title_d;
case TangibleSyncGroup.GROUP_E:
return R.string.history_sync_consent_title_e;
case TangibleSyncGroup.GROUP_F:
return R.string.signin_title;
default:
// TODO(https://crbug.com/1412453): Update when variation strings are known.
throw new IllegalStateException("Invalid group id");
}
}

private static @StringRes int getSyncConsentViewSubtitleText() {
switch (getTangibleSyncGroup()) {
// Groups A and B share the same subtitle.
case TangibleSyncGroup.GROUP_A:
return R.string.history_sync_consent_subtitle;
case TangibleSyncGroup.GROUP_B:
return R.string.history_sync_consent_subtitle_a;
case TangibleSyncGroup.GROUP_C:
return R.string.history_sync_consent_subtitle_c;
case TangibleSyncGroup.GROUP_D:
return R.string.history_sync_consent_subtitle_d;
case TangibleSyncGroup.GROUP_E:
return R.string.history_sync_consent_subtitle_e;
case TangibleSyncGroup.GROUP_F:
return R.string.signin_sync_title;
default:
// TODO(https://crbug.com/1412453): Update when variation strings are known.
throw new IllegalStateException("Invalid group id");
}
}
Expand Down

0 comments on commit a50b40b

Please sign in to comment.