Commit 48cc206b authored by Findit's avatar Findit

Revert "[Android] Show signed in account in sync promo"

This reverts commit adc862b0.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 810545 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2FkYzg2MmIwOTRjMmQ5MTg5YjE3NWFiM2Q1ZjlkNmJiNDQ1NzNiMTgM

Sample Failed Build: https://ci.chromium.org/b/8868191608621476032

Sample Failed Step: compile

Original change's description:
> [Android] Show signed in account in sync promo
> 
> Sync promo always shows the first account returned by AccountManagerFacade
> which might not be signed in. This cl makes sure that the account that
> is shown is the first signed in account.
> 
> This cl also refactors some of the tests regrading sync promos. The
> behavior of the tests are not changed.
> 
> Bug: 1131465
> Change-Id: I46f2e607494c68d3b0608543095da4b22471f710
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2426485
> Commit-Queue: Tanmoy Mollik <triploblastic@chromium.org>
> Reviewed-by: Alice Wang <aliceywang@chromium.org>
> Reviewed-by: Marc Treib <treib@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#810545}


Change-Id: I5fc911e9f5175b65d10ff045dfd48103ed08b099
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1131465
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2430974
Cr-Commit-Position: refs/heads/master@{#810554}
parent 8c7f5c3e
......@@ -19,8 +19,6 @@ import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.components.signin.AccountManagerFacadeProvider;
import org.chromium.components.signin.AccountUtils;
import org.chromium.components.signin.base.CoreAccountInfo;
import org.chromium.components.signin.identitymanager.ConsentLevel;
import org.chromium.components.signin.metrics.SigninAccessPoint;
import org.chromium.components.user_prefs.UserPrefs;
import org.chromium.ui.base.WindowAndroid;
......@@ -132,17 +130,7 @@ public class SigninPromoUtil {
public static void setupSyncPromoViewFromCache(SigninPromoController signinPromoController,
ProfileDataCache profileDataCache, PersonalizedSigninPromoView view,
SigninPromoController.OnDismissListener listener) {
String signedInAccount = CoreAccountInfo.getEmailFrom(
IdentityServicesProvider.get()
.getIdentityManager(Profile.getLastUsedRegularProfile())
.getPrimaryAccountInfo(ConsentLevel.NOT_REQUIRED));
assert signedInAccount != null : "Sync promo should only be shown for a signed in account";
profileDataCache.update(Collections.singletonList(signedInAccount));
DisplayableProfileData profileData =
profileDataCache.getProfileDataOrDefault(signedInAccount);
signinPromoController.detach();
signinPromoController.setupPromoView(view.getContext(), view, profileData, listener);
setupSigninPromoViewFromCache(signinPromoController, profileDataCache, view, listener);
view.getPrimaryButton().setText(R.string.sync_promo_turn_on_sync);
view.getSecondaryButton().setVisibility(View.GONE);
}
......
......@@ -4,7 +4,6 @@
package org.chromium.chrome.browser.bookmarks;
import android.accounts.Account;
import android.view.View;
import androidx.test.filters.MediumTest;
......@@ -35,7 +34,6 @@ import org.chromium.chrome.test.util.ChromeRenderTestRule;
import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule;
import org.chromium.components.signin.ProfileDataSource;
import org.chromium.components.signin.test.util.FakeProfileDataSource;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.ui.test.util.NightModeTestUtils;
import org.chromium.ui.test.util.UiDisableIf;
......@@ -49,10 +47,8 @@ import org.chromium.ui.test.util.UiDisableIf;
public class BookmarkPersonalizedPromoRenderTest {
// FakeProfileDataSource is required to create the ProfileDataCache entry with sync_off badge
// for Sync promo.
private final FakeProfileDataSource mFakeProfileDataSource = new FakeProfileDataSource();
private final AccountManagerTestRule mAccountManagerTestRule =
new AccountManagerTestRule(mFakeProfileDataSource);
new AccountManagerTestRule(new FakeProfileDataSource());
private final ChromeActivityTestRule<ChromeActivity> mActivityTestRule =
new ChromeActivityTestRule<>(ChromeActivity.class);
......@@ -82,14 +78,9 @@ public class BookmarkPersonalizedPromoRenderTest {
@Before
public void setUp() {
// Native side needs to loaded before signing in test account.
mAccountManagerTestRule.addAccount(new ProfileDataSource.ProfileData(
"test@gmail.com", null, "Full Name", "Given Name"));
mActivityTestRule.startMainActivityOnBlankPage();
Account account = mAccountManagerTestRule.addAndSignInTestAccount();
TestThreadUtils.runOnUiThreadBlocking(
()
-> mFakeProfileDataSource.setProfileData(account.name,
new ProfileDataSource.ProfileData(
account.name, null, "Full Name", "Given Name")));
}
@After
......
......@@ -4,7 +4,6 @@
package org.chromium.chrome.browser.ntp;
import android.accounts.Account;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
......@@ -54,11 +53,9 @@ import java.util.concurrent.ExecutionException;
public class RecentTabsPageTest {
// FakeProfileDataSource is required to create the ProfileDataCache entry with sync_off badge
// for Sync promo.
private final FakeProfileDataSource mFakeProfileDataSource = new FakeProfileDataSource();
@Rule
public final AccountManagerTestRule mAccountManagerTestRule =
new AccountManagerTestRule(mFakeProfileDataSource);
new AccountManagerTestRule(new FakeProfileDataSource());
@Rule
public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule();
......@@ -108,12 +105,8 @@ public class RecentTabsPageTest {
@LargeTest
@Feature("RenderTest")
public void testPersonalizedSigninPromoInRecentTabsPage() throws Exception {
Account account = mAccountManagerTestRule.addAndSignInTestAccount();
TestThreadUtils.runOnUiThreadBlocking(
()
-> mFakeProfileDataSource.setProfileData(account.name,
new ProfileDataSource.ProfileData(
account.name, createAvatar(), "Full Name", "Given Name")));
mAccountManagerTestRule.addAccount(new ProfileDataSource.ProfileData(
"test@gmail.com", createAvatar(), "Full Name", "Given Name"));
RecentTabsManager.forcePromoStateForTests(
RecentTabsManager.PromoState.PROMO_SIGNIN_PERSONALIZED);
mPage = loadRecentTabsPage();
......@@ -124,12 +117,8 @@ public class RecentTabsPageTest {
@LargeTest
@Feature("RenderTest")
public void testPersonalizedSyncPromoInRecentTabsPage() throws Exception {
Account account = mAccountManagerTestRule.addAndSignInTestAccount();
TestThreadUtils.runOnUiThreadBlocking(
()
-> mFakeProfileDataSource.setProfileData(account.name,
new ProfileDataSource.ProfileData(
account.name, createAvatar(), "Full Name", "Given Name")));
mAccountManagerTestRule.addAccount(new ProfileDataSource.ProfileData(
"test@gmail.com", createAvatar(), "Full Name", "Given Name"));
RecentTabsManager.forcePromoStateForTests(
RecentTabsManager.PromoState.PROMO_SYNC_PERSONALIZED);
mPage = loadRecentTabsPage();
......
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