Commit 9535f7a0 authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][Test] Test error metrics in web sign-in flow

This CL tests the error metrics recording in the web sign-in flow.

Bug: 1139244
Change-Id: I2c5254afafb71388eeb86d1759e8c808331124e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2484652Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818405}
parent a4c2a76e
...@@ -386,6 +386,9 @@ public class AccountPickerBottomSheetTest { ...@@ -386,6 +386,9 @@ public class AccountPickerBottomSheetTest {
@Test @Test
@MediumTest @MediumTest
public void testSignInGeneralError() { public void testSignInGeneralError() {
MetricsUtils.HistogramDelta accountConsistencyHistogram =
new HistogramDelta("Signin.AccountConsistencyPromoAction",
AccountConsistencyPromoAction.GENERIC_ERROR_SHOWN);
// Throws a connection error during the sign-in action // Throws a connection error during the sign-in action
doAnswer(invocation -> { doAnswer(invocation -> {
Callback<GoogleServiceAuthError> onSignInErrorCallback = invocation.getArgument(1); Callback<GoogleServiceAuthError> onSignInErrorCallback = invocation.getArgument(1);
...@@ -409,11 +412,15 @@ public class AccountPickerBottomSheetTest { ...@@ -409,11 +412,15 @@ public class AccountPickerBottomSheetTest {
onView(withId(R.id.account_picker_selected_account)).check(matches(not(isDisplayed()))); onView(withId(R.id.account_picker_selected_account)).check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_signin_spinner_view)).check(matches(not(isDisplayed()))); onView(withId(R.id.account_picker_signin_spinner_view)).check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_dismiss_button)).check(matches(not(isDisplayed()))); onView(withId(R.id.account_picker_dismiss_button)).check(matches(not(isDisplayed())));
Assert.assertEquals(1, accountConsistencyHistogram.getDelta());
} }
@Test @Test
@MediumTest @MediumTest
public void testSignInAuthError() { public void testSignInAuthError() {
MetricsUtils.HistogramDelta accountConsistencyHistogram =
new HistogramDelta("Signin.AccountConsistencyPromoAction",
AccountConsistencyPromoAction.AUTH_ERROR_SHOWN);
CoreAccountInfo coreAccountInfo = CoreAccountInfo coreAccountInfo =
mAccountManagerTestRule.toCoreAccountInfo(PROFILE_DATA1.getAccountName()); mAccountManagerTestRule.toCoreAccountInfo(PROFILE_DATA1.getAccountName());
// Throws an auth error during the sign-in action // Throws an auth error during the sign-in action
...@@ -437,6 +444,7 @@ public class AccountPickerBottomSheetTest { ...@@ -437,6 +444,7 @@ public class AccountPickerBottomSheetTest {
onView(withId(R.id.account_picker_selected_account)).check(matches(not(isDisplayed()))); onView(withId(R.id.account_picker_selected_account)).check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_signin_spinner_view)).check(matches(not(isDisplayed()))); onView(withId(R.id.account_picker_signin_spinner_view)).check(matches(not(isDisplayed())));
onView(withId(R.id.account_picker_dismiss_button)).check(matches(not(isDisplayed()))); onView(withId(R.id.account_picker_dismiss_button)).check(matches(not(isDisplayed())));
Assert.assertEquals(1, accountConsistencyHistogram.getDelta());
} }
@Test @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