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

[Signin][Android] Add sign-in in progress spinner for web sign-in

This CL adds a spinner for sign-in in progress page of web sign-in and
makes the horizontal divider disappear on the same page according to
the UI mock.

Screenshot: https://crbug.com/1102784#3
Bug: 1102784
Change-Id: I95cbc474a161c58ba235ddede70405c55e7db3b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2345147Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796818}
parent 24dafa0b
......@@ -47,6 +47,7 @@
app:leading="@dimen/text_size_medium_leading" />
<View
android:id="@+id/account_picker_horizontal_divider"
style="@style/HorizontalDivider" />
<androidx.recyclerview.widget.RecyclerView
......@@ -81,4 +82,13 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/signin_promo_continue_as" />
<ProgressBar
android:id="@+id/account_picker_signin_spinner_view"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:layout_marginBottom="132dp"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
......@@ -119,8 +119,11 @@ class AccountPickerBottomSheetView implements BottomSheetContent {
mAccountPickerTitle.setText(R.string.signin_account_picker_bottom_sheet_signin_title);
mContentView.findViewById(R.id.account_picker_bottom_sheet_subtitle)
.setVisibility(View.GONE);
mContentView.findViewById(R.id.account_picker_horizontal_divider).setVisibility(View.GONE);
mSelectedAccountView.setVisibility(View.GONE);
mContinueAsButton.setVisibility(View.GONE);
mContentView.findViewById(R.id.account_picker_signin_spinner_view)
.setVisibility(View.VISIBLE);
}
@Override
......
......@@ -29,6 +29,7 @@ import androidx.test.filters.MediumTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
......@@ -59,6 +60,7 @@ import org.chromium.components.signin.test.util.FakeAccountManagerFacade;
import org.chromium.components.signin.test.util.FakeProfileDataSource;
import org.chromium.content_public.browser.test.util.CriteriaHelper;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.ui.test.util.DisableAnimationsTestRule;
import java.io.IOException;
......@@ -84,6 +86,11 @@ public class AccountPickerBottomSheetTest {
/* accountName= */ "test.account2@gmail.com", /* avatar= */ null,
/* fullName= */ null, /* givenName= */ null);
// Disable animations to reduce flakiness.
@ClassRule
public static final DisableAnimationsTestRule sNoAnimationsRule =
new DisableAnimationsTestRule();
@Rule
public final ChromeRenderTestRule mRenderTestRule =
ChromeRenderTestRule.Builder.withPublicCorpus().setRevision(0).build();
......@@ -293,10 +300,22 @@ public class AccountPickerBottomSheetTest {
return !bottomSheetView.findViewById(R.id.account_picker_continue_as_button).isShown();
});
verify(mAccountPickerDelegateMock).signIn(PROFILE_DATA1.getAccountName());
Assert.assertTrue(
bottomSheetView.findViewById(R.id.account_picker_signin_spinner_view).isShown());
// Currently the ProgressBar animation cannot be disabled on android-marshmallow-arm64-rel
// bot with DisableAnimationsTestRule, we hide the ProgressBar manually here to enable
// checks of other elements on the screen.
// TODO(https://crbug.com/1115067): Delete this line once DisableAnimationsTestRule is
// fixed.
ThreadUtils.runOnUiThread(() -> {
bottomSheetView.findViewById(R.id.account_picker_signin_spinner_view)
.setVisibility(View.GONE);
});
onView(withText(R.string.signin_account_picker_bottom_sheet_signin_title))
.check(matches(isDisplayed()));
onView(withId(R.id.account_picker_bottom_sheet_subtitle))
.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_selected_account)).check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_continue_as_button)).check(matches(not(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