Commit 888b7759 authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][Test] Wait for selected account instead of continue button

This CL changes the waited view from continue button to selected
account for the collapsed screen of web sign-in bottom sheet.
This is needed for the refactoring of account picker view states later.

Bug: 1138824
Change-Id: I9122253daffd1da06910c52042f5e53efc00d9b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2487084Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819295}
parent 9c308334
...@@ -352,7 +352,7 @@ public class AccountPickerBottomSheetRenderTest { ...@@ -352,7 +352,7 @@ public class AccountPickerBottomSheetRenderTest {
mIncognitoInterstitialDelegateMock); mIncognitoInterstitialDelegateMock);
}); });
CriteriaHelper.pollUiThread(mCoordinator.getBottomSheetViewForTesting().findViewById( CriteriaHelper.pollUiThread(mCoordinator.getBottomSheetViewForTesting().findViewById(
R.id.account_picker_continue_as_button)::isShown); R.id.account_picker_selected_account)::isShown);
} }
private BottomSheetController getBottomSheetController() { private BottomSheetController getBottomSheetController() {
......
...@@ -192,7 +192,11 @@ public class AccountPickerBottomSheetTest { ...@@ -192,7 +192,11 @@ public class AccountPickerBottomSheetTest {
// torn down in the end of the test in AccountManagerTestRule. // torn down in the end of the test in AccountManagerTestRule.
AccountManagerFacadeProvider.setInstanceForTests( AccountManagerFacadeProvider.setInstanceForTests(
new FakeAccountManagerFacade(mFakeProfileDataSource)); new FakeAccountManagerFacade(mFakeProfileDataSource));
buildAndShowCollapsedBottomSheet(); TestThreadUtils.runOnUiThreadBlocking(() -> {
mCoordinator = new AccountPickerBottomSheetCoordinator(sActivityTestRule.getActivity(),
getBottomSheetController(), mAccountPickerDelegateMock,
mIncognitoInterstitialDelegateMock);
});
checkZeroAccountBottomSheet(); checkZeroAccountBottomSheet();
} }
...@@ -285,7 +289,11 @@ public class AccountPickerBottomSheetTest { ...@@ -285,7 +289,11 @@ public class AccountPickerBottomSheetTest {
public void testAccountReappearedOnCollapsedSheet() { public void testAccountReappearedOnCollapsedSheet() {
mAccountManagerTestRule.removeAccountAndWaitForSeeding(PROFILE_DATA1.getAccountName()); mAccountManagerTestRule.removeAccountAndWaitForSeeding(PROFILE_DATA1.getAccountName());
mAccountManagerTestRule.removeAccountAndWaitForSeeding(PROFILE_DATA2.getAccountName()); mAccountManagerTestRule.removeAccountAndWaitForSeeding(PROFILE_DATA2.getAccountName());
buildAndShowCollapsedBottomSheet(); TestThreadUtils.runOnUiThreadBlocking(() -> {
mCoordinator = new AccountPickerBottomSheetCoordinator(sActivityTestRule.getActivity(),
getBottomSheetController(), mAccountPickerDelegateMock,
mIncognitoInterstitialDelegateMock);
});
checkZeroAccountBottomSheet(); checkZeroAccountBottomSheet();
mAccountManagerTestRule.addAccount(PROFILE_DATA1.getAccountName()); mAccountManagerTestRule.addAccount(PROFILE_DATA1.getAccountName());
...@@ -651,7 +659,7 @@ public class AccountPickerBottomSheetTest { ...@@ -651,7 +659,7 @@ public class AccountPickerBottomSheetTest {
mIncognitoInterstitialDelegateMock); mIncognitoInterstitialDelegateMock);
}); });
CriteriaHelper.pollUiThread(mCoordinator.getBottomSheetViewForTesting().findViewById( CriteriaHelper.pollUiThread(mCoordinator.getBottomSheetViewForTesting().findViewById(
R.id.account_picker_continue_as_button)::isShown); R.id.account_picker_selected_account)::isShown);
} }
private void buildAndShowExpandedBottomSheet() { private void buildAndShowExpandedBottomSheet() {
......
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