Commit 77545697 authored by Rohit Agarwal's avatar Rohit Agarwal Committed by Commit Bot

Add integration tests to incognito interstitial from account picker.

This CL adds integration tests to verify the incognito interstitial
methods are invoked correctly when navigating from the account picker
dialog to the Incognito interstitial.

Bug: 1125979
Change-Id: Ieb41f23e8ca79a7006e20ce8ae7d16acb60f2231
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424255
Commit-Queue: Rohit Agarwal <roagarwal@chromium.org>
Reviewed-by: default avatarAlice Wang <aliceywang@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810131}
parent b9cd56c1
...@@ -22,7 +22,8 @@ import org.chromium.chrome.browser.tabmodel.TabModelUtils; ...@@ -22,7 +22,8 @@ import org.chromium.chrome.browser.tabmodel.TabModelUtils;
/** /**
* This class is responsible for the providing the functionality to the "Learn More" and "Continue" * This class is responsible for the providing the functionality to the "Learn More" and "Continue"
* button in the Incognito interstitial. * button in the Incognito interstitial. This should be used in conjunction with the incognito
* interstitial MVC.
*/ */
public class IncognitoInterstitialDelegate { public class IncognitoInterstitialDelegate {
private final Activity mActivity; private final Activity mActivity;
...@@ -53,7 +54,7 @@ public class IncognitoInterstitialDelegate { ...@@ -53,7 +54,7 @@ public class IncognitoInterstitialDelegate {
* Open the help centre article regarding Incognito usage. * Open the help centre article regarding Incognito usage.
*/ */
@MainThread @MainThread
void openLearnMorePage() { public void openLearnMorePage() {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
mHelpAndFeedbackLauncher.show(mActivity, mHelpAndFeedbackLauncher.show(mActivity,
mActivity.getString(R.string.help_context_incognito_learn_more), mActivity.getString(R.string.help_context_incognito_learn_more),
...@@ -65,7 +66,7 @@ public class IncognitoInterstitialDelegate { ...@@ -65,7 +66,7 @@ public class IncognitoInterstitialDelegate {
* the current regular tab. * the current regular tab.
*/ */
@MainThread @MainThread
void openCurrentUrlInIncognitoTab() { public void openCurrentUrlInIncognitoTab() {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
AccountPickerDelegate.recordAccountConsistencyPromoAction( AccountPickerDelegate.recordAccountConsistencyPromoAction(
AccountConsistencyPromoAction.STARTED_INCOGNITO_SESSION); AccountConsistencyPromoAction.STARTED_INCOGNITO_SESSION);
......
...@@ -438,6 +438,24 @@ public class AccountPickerBottomSheetTest { ...@@ -438,6 +438,24 @@ public class AccountPickerBottomSheetTest {
checkIncognitoInterstitialSheet(); checkIncognitoInterstitialSheet();
} }
@Test
@MediumTest
public void testLearnMoreButtonOnIncognitoInterstitial() {
buildAndShowExpandedBottomSheet();
onView(withText(R.string.signin_go_incognito)).perform(click());
onView(withId(R.id.incognito_interstitial_learn_more)).perform(click());
verify(mIncognitoInterstitialDelegateMock).openLearnMorePage();
}
@Test
@MediumTest
public void testContinueButtonOnIncognitoInterstitial() {
buildAndShowExpandedBottomSheet();
onView(withText(R.string.signin_go_incognito)).perform(click());
onView(withId(R.id.incognito_interstitial_continue_button)).perform(click());
verify(mIncognitoInterstitialDelegateMock).openCurrentUrlInIncognitoTab();
}
private void checkIncognitoInterstitialSheet() { private void checkIncognitoInterstitialSheet() {
onView(withId(R.id.account_picker_bottom_sheet_logo)).check(matches(isDisplayed())); onView(withId(R.id.account_picker_bottom_sheet_logo)).check(matches(isDisplayed()));
onView(withId(R.id.account_picker_bottom_sheet_title)) onView(withId(R.id.account_picker_bottom_sheet_title))
...@@ -448,6 +466,9 @@ public class AccountPickerBottomSheetTest { ...@@ -448,6 +466,9 @@ public class AccountPickerBottomSheetTest {
onView(withId(R.id.account_picker_horizontal_divider)).check(matches(not(isDisplayed()))); onView(withId(R.id.account_picker_horizontal_divider)).check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_account_list)).check(matches(not(isDisplayed()))); onView(withId(R.id.account_picker_account_list)).check(matches(not(isDisplayed())));
onView(withId(R.id.incognito_interstitial_bottom_sheet_view)).check(matches(isDisplayed())); onView(withId(R.id.incognito_interstitial_bottom_sheet_view)).check(matches(isDisplayed()));
onView(withText(R.string.incognito_interstitial_message)).check(matches(isDisplayed()));
onView(withId(R.id.incognito_interstitial_learn_more)).check(matches(isDisplayed()));
onView(withId(R.id.incognito_interstitial_continue_button)).check(matches(isDisplayed()));
} }
private void clickContinueButtonAndWaitForErrorSheet() { private void clickContinueButtonAndWaitForErrorSheet() {
......
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