Skip to content

Commit

Permalink
[Android][Signin] Cleanup bookmark signin promo helper method
Browse files Browse the repository at this point in the history
This CL removes the helper method used for test debugging in
BookmarkPersonalizedSigninPromoDismissTest. As the all the tests of
this class are enabled since February and are not flaky. We can safely
remove the helper method now.

Bug: 1045480
Change-Id: I4758cc717af3e8ff0d3f23f76786877b3f251484
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2159219
Reviewed-by: Boris Sazonov <bsazonov@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761963}
  • Loading branch information
Alice Wang authored and Commit Bot committed Apr 23, 2020
1 parent f8c6db9 commit ed35f41
Showing 1 changed file with 0 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import static android.support.test.espresso.matcher.ViewMatchers.withId;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
Expand All @@ -29,15 +27,11 @@
import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.signin.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.SigninPromoController;
import org.chromium.chrome.browser.sync.SyncTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.util.BookmarkTestUtil;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.components.signin.ChromeSigninController;
import org.chromium.components.signin.metrics.SigninAccessPoint;
import org.chromium.components.sync.AndroidSyncSettings;
import org.chromium.content_public.browser.test.util.TestThreadUtils;

/**
Expand Down Expand Up @@ -74,7 +68,6 @@ public void tearDown() {
@MediumTest
public void testPromoNotShownAfterBeingDismissed() {
BookmarkTestUtil.showBookmarkManager(mSyncTestRule.getActivity());
checkPrePromoStatus();
onView(withId(R.id.signin_promo_view_container)).check(matches(isDisplayed()));
onView(withId(R.id.signin_promo_close_button)).perform(click());
onView(withId(R.id.signin_promo_view_container)).check(doesNotExist());
Expand Down Expand Up @@ -108,29 +101,8 @@ public void testPromoNotExistWhenImpressionLimitReached() {
@MediumTest
public void testPromoImpressionCountIncrementAfterDisplayingSigninPromo() {
assertEquals(0, SigninPromoController.getSigninPromoImpressionsCountBookmarks());
checkPrePromoStatus();
BookmarkTestUtil.showBookmarkManager(mSyncTestRule.getActivity());
onView(withId(R.id.signin_promo_view_container)).check(matches(isDisplayed()));
assertEquals(1, SigninPromoController.getSigninPromoImpressionsCountBookmarks());
}

/**
* TODO(https://crbug.com/1045480): The promo dismiss tests are flaky
* This method is for temporary investigation of the problem.
* It should be removed after we fix the flakiness.
*/
private void checkPrePromoStatus() {
assertTrue("Android master sync should be enabled!",
AndroidSyncSettings.get().isMasterSyncEnabled());
assertFalse("The user should not be signed in!", ChromeSigninController.get().isSignedIn());
TestThreadUtils.runOnUiThreadBlocking(() -> {
assertTrue("Signin should be allowed!",
IdentityServicesProvider.get().getSigninManager().isSignInAllowed());
});
assertTrue("Impression limit should not be reached!",
SigninPromoController.hasNotReachedImpressionLimit(
SigninAccessPoint.BOOKMARK_MANAGER));
assertFalse("Signin promo should not be declined!",
BookmarkPromoHeader.wasPersonalizedSigninPromoDeclined());
}
}

0 comments on commit ed35f41

Please sign in to comment.