Commit ae20f65a authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][Test] Clean check collapsed account picker method

This CL cleans the checkCollapsedAccountList() method used in
AccountPickerBottomSheetTest.

Bug: 1121536
Change-Id: I1bf45237bb7a29d1a53baf82629bfaa805c0de81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377498Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803038}
parent 1c8be55e
...@@ -180,8 +180,6 @@ public class AccountPickerBottomSheetTest { ...@@ -180,8 +180,6 @@ public class AccountPickerBottomSheetTest {
public void testCollapsedSheetShowsWhenBackpressingOnExpandedSheet() { public void testCollapsedSheetShowsWhenBackpressingOnExpandedSheet() {
buildAndShowExpandedBottomSheet(); buildAndShowExpandedBottomSheet();
onView(isRoot()).perform(pressBack()); onView(isRoot()).perform(pressBack());
CriteriaHelper.pollUiThread(mCoordinator.getBottomSheetViewForTesting().findViewById(
R.id.account_picker_continue_as_button)::isShown);
checkCollapsedAccountList(PROFILE_DATA1); checkCollapsedAccountList(PROFILE_DATA1);
} }
...@@ -214,7 +212,6 @@ public class AccountPickerBottomSheetTest { ...@@ -214,7 +212,6 @@ public class AccountPickerBottomSheetTest {
checkZeroAccountBottomSheet(); checkZeroAccountBottomSheet();
mAccountManagerTestRule.addAccount(PROFILE_DATA1.getAccountName()); mAccountManagerTestRule.addAccount(PROFILE_DATA1.getAccountName());
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
checkCollapsedAccountList(PROFILE_DATA1); checkCollapsedAccountList(PROFILE_DATA1);
} }
...@@ -224,7 +221,6 @@ public class AccountPickerBottomSheetTest { ...@@ -224,7 +221,6 @@ public class AccountPickerBottomSheetTest {
buildAndShowCollapsedBottomSheet(); buildAndShowCollapsedBottomSheet();
checkCollapsedAccountList(PROFILE_DATA1); checkCollapsedAccountList(PROFILE_DATA1);
mAccountManagerTestRule.removeAccountAndWaitForSeeding(PROFILE_DATA2.getAccountName()); mAccountManagerTestRule.removeAccountAndWaitForSeeding(PROFILE_DATA2.getAccountName());
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
checkCollapsedAccountList(PROFILE_DATA1); checkCollapsedAccountList(PROFILE_DATA1);
} }
...@@ -233,7 +229,6 @@ public class AccountPickerBottomSheetTest { ...@@ -233,7 +229,6 @@ public class AccountPickerBottomSheetTest {
public void testSelectedAccountChangeOnCollapsedSheet() { public void testSelectedAccountChangeOnCollapsedSheet() {
buildAndShowCollapsedBottomSheet(); buildAndShowCollapsedBottomSheet();
mAccountManagerTestRule.removeAccountAndWaitForSeeding(PROFILE_DATA1.getAccountName()); mAccountManagerTestRule.removeAccountAndWaitForSeeding(PROFILE_DATA1.getAccountName());
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
checkCollapsedAccountList(PROFILE_DATA2); checkCollapsedAccountList(PROFILE_DATA2);
} }
...@@ -382,8 +377,6 @@ public class AccountPickerBottomSheetTest { ...@@ -382,8 +377,6 @@ public class AccountPickerBottomSheetTest {
Callback<String> callback = callbackArgumentCaptor.getValue(); Callback<String> callback = callbackArgumentCaptor.getValue();
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> callback.onResult(profileDataAdded.getAccountName())); () -> callback.onResult(profileDataAdded.getAccountName()));
CriteriaHelper.pollUiThread(mCoordinator.getBottomSheetViewForTesting().findViewById(
R.id.account_picker_selected_account)::isShown);
checkCollapsedAccountList(profileDataAdded); checkCollapsedAccountList(profileDataAdded);
} }
...@@ -469,6 +462,8 @@ public class AccountPickerBottomSheetTest { ...@@ -469,6 +462,8 @@ public class AccountPickerBottomSheetTest {
} }
private void checkCollapsedAccountList(ProfileDataSource.ProfileData profileData) { private void checkCollapsedAccountList(ProfileDataSource.ProfileData profileData) {
CriteriaHelper.pollUiThread(mCoordinator.getBottomSheetViewForTesting().findViewById(
R.id.account_picker_selected_account)::isShown);
onView(withText(R.string.signin_account_picker_dialog_title)).check(matches(isDisplayed())); onView(withText(R.string.signin_account_picker_dialog_title)).check(matches(isDisplayed()));
onView(allOf(withText(profileData.getAccountName()), withEffectiveVisibility(VISIBLE))) onView(allOf(withText(profileData.getAccountName()), withEffectiveVisibility(VISIBLE)))
.check(matches(isDisplayed())); .check(matches(isDisplayed()));
......
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