Skip to content

Commit

Permalink
Local web approval test for 2 parallel requests
Browse files Browse the repository at this point in the history
The flow of local web approval terminates early (cancels)
parallel approval requests. This is captured in a new test.

Bug: 1403235
Change-Id: I082b1d27ff3da00cb5711d7990920b7e99a3da21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4270995
Commit-Queue: Anthi Orfanou <anthie@google.com>
Reviewed-by: James Lee <ljjlee@google.com>
Cr-Commit-Position: refs/heads/main@{#1107672}
  • Loading branch information
anthie@google.com authored and Chromium LUCI CQ committed Feb 21, 2023
1 parent 0cce481 commit d3901ef
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,27 @@ public void parentAuthorizationFailure() {
mHistogramTester.getHistogramValueCount(
"FamilyLinkUser.LocalWebApprovalResult", /*Cancelled=*/2));
}

@Test
@MediumTest
public void cancelApprovalRequestIfOneAlreadyInProgress() {
mockParentAuthDelegateRequestLocalAuthResponse(true);
mTabbedActivityTestRule.loadUrl(mBlockedUrl);

WebsiteParentApprovalTestUtils.clickAskInPerson(mWebContents);
WebsiteParentApprovalTestUtils.clickAskInPerson(mWebContents);

WebsiteParentApprovalTestUtils.clickApprove(mBottomSheetTestSupport);

// Delay to ensure the asynchronous code that records the histograms is executed.
verify(mParentAuthDelegateMock, timeout(CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL).times(1))
.requestLocalAuth(any(WindowAndroid.class), any(GURL.class), any(Callback.class));

Assert.assertEquals(1,
mHistogramTester.getHistogramValueCount(
"FamilyLinkUser.LocalWebApprovalResult", /*Approved=*/0));
Assert.assertEquals(1,
mHistogramTester.getHistogramValueCount(
"FamilyLinkUser.LocalWebApprovalResult", /*Cancelled=*/2));
}
}

0 comments on commit d3901ef

Please sign in to comment.