Commit 4acbf30b authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Commit Bot

[Autofill Assistant] Directly select T&C links when clicked.

Change-Id: Ie5a2015ec45f2ba19055776b70e91fe7a47b1227
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1728884
Auto-Submit: Jordan Demeulenaere <jdemeulenaere@chromium.org>
Reviewed-by: default avatarClemens Arbesser <arbesser@google.com>
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Cr-Commit-Position: refs/heads/master@{#682706}
parent 7aa9ce99
...@@ -47,6 +47,7 @@ public class AssistantPaymentRequestTermsSection { ...@@ -47,6 +47,7 @@ public class AssistantPaymentRequestTermsSection {
@Nullable @Nullable
private final TextView mTermsRequiresReview; private final TextView mTermsRequiresReview;
private final TextView mThirdPartyPrivacyNotice; private final TextView mThirdPartyPrivacyNotice;
@Nullable
private Delegate mDelegate; private Delegate mDelegate;
private final SpanInfo mBoldSpanInfo = private final SpanInfo mBoldSpanInfo =
...@@ -143,10 +144,9 @@ public class AssistantPaymentRequestTermsSection { ...@@ -143,10 +144,9 @@ public class AssistantPaymentRequestTermsSection {
} }
private void onTermsAndConditionsLinkClicked(int link) { private void onTermsAndConditionsLinkClicked(int link) {
// Ignore first click if the option is not selected yet. if (mDelegate != null) {
if (!mTermsList.isChecked(mTermsAgree) || mDelegate == null) return; mDelegate.onLinkClicked(link);
}
mDelegate.onLinkClicked(link);
} }
public void setTermsStatus(@AssistantTermsAndConditionsState int status) { public void setTermsStatus(@AssistantTermsAndConditionsState int status) {
......
...@@ -590,14 +590,7 @@ public class AutofillAssistantPaymentRequestUiTest { ...@@ -590,14 +590,7 @@ public class AutofillAssistantPaymentRequestUiTest {
acceptTermsText2)); acceptTermsText2));
acceptMatcher = allOf(withText(acceptTermsText), isDisplayed()); acceptMatcher = allOf(withText(acceptTermsText), isDisplayed());
assertThat(delegate.mLastLinkClicked, nullValue()); // Clicking the text will trigger the link.
// First click marks the terms as accepted and ignores the link.
onView(acceptMatcher).perform(click());
assertThat(delegate.mTermsStatus, is(AssistantTermsAndConditionsState.ACCEPTED));
assertThat(delegate.mLastLinkClicked, nullValue());
// Second click will trigger the link.
onView(acceptMatcher).perform(click()); onView(acceptMatcher).perform(click());
assertThat(delegate.mLastLinkClicked, is(42)); assertThat(delegate.mLastLinkClicked, is(42));
} }
......
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