Commit 5f133a02 authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Signin][Android] Setup sign-in in progress state view

This CL sets up the sign-in in progress state view once the user clicks
on the |Continue as ...| button.

Bug: 1102784
Change-Id: I811f195dc11fbd3ad0c2685baa67040ea0120f9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339351Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795898}
parent 4bee1389
......@@ -161,6 +161,8 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste
if (mSelectedAccountName == null) {
addAccount();
} else {
mModel.set(AccountPickerBottomSheetProperties.ACCOUNT_PICKER_BOTTOM_SHEET_STATE,
AccountPickerBottomSheetState.SIGNIN_IN_PROGRESS);
mAccountPickerDelegate.signIn(mSelectedAccountName);
}
}
......
......@@ -109,6 +109,19 @@ class AccountPickerBottomSheetView implements BottomSheetContent {
mContinueAsButton.setText(continueAsButtonText);
}
/**
* Sets up the sign-in in progress view.
*/
void setUpSignInInProgressView() {
// TODO(https://crbug.com/1102784):
// - Setup the sign-in string |Signing in...|
// - Add signing in progress spinner
mContentView.findViewById(R.id.account_picker_bottom_sheet_subtitle)
.setVisibility(View.GONE);
mSelectedAccountView.setVisibility(View.GONE);
mContinueAsButton.setVisibility(View.GONE);
}
@Override
public View getContentView() {
return mContentView;
......
......@@ -54,7 +54,7 @@ class AccountPickerBottomSheetViewBinder {
view.expandAccountList();
break;
case AccountPickerBottomSheetState.SIGNIN_IN_PROGRESS:
// TODO(https://crbug.com/1102784): Implement UI update when sign-in in progress
view.setUpSignInInProgressView();
break;
default:
throw new IllegalArgumentException(
......
......@@ -23,6 +23,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.MockitoAnnotations.initMocks;
import android.support.test.InstrumentationRegistry;
import android.view.View;
import androidx.test.filters.MediumTest;
......@@ -37,6 +38,7 @@ import org.mockito.Captor;
import org.mockito.Mock;
import org.chromium.base.Callback;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.R;
......@@ -287,10 +289,18 @@ public class AccountPickerBottomSheetTest {
@MediumTest
public void testSignInDefaultAccountOnCollapsedSheet() {
buildAndShowCollapsedBottomSheet();
String continueAsText = mActivityTestRule.getActivity().getString(
R.string.signin_promo_continue_as, PROFILE_DATA1.getGivenName());
onView(withText(continueAsText)).perform(click());
View bottomSheetView = mCoordinator.getBottomSheetViewForTesting();
ThreadUtils.runOnUiThread(
bottomSheetView.findViewById(R.id.account_picker_continue_as_button)::performClick);
CriteriaHelper.pollUiThread(() -> {
return !bottomSheetView.findViewById(R.id.account_picker_continue_as_button).isShown();
});
verify(mAccountPickerDelegateMock).signIn(PROFILE_DATA1.getAccountName());
onView(withId(R.id.account_picker_bottom_sheet_subtitle))
.check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_account_list)).check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_selected_account)).check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_continue_as_button)).check(matches(not(isDisplayed())));
}
@Test
......
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