0

Revert "[WebOTP] Fix flaky test SameSiteNavigationResetsDocumentUsedWebOTP"

This reverts commit f1458788a3.

Reason for revert: Still flaky on mac: https://ci.chromium.org/p/chromium/builders/ci/Mac10.10%20Tests/58334

Original change's description:
> [WebOTP] Fix flaky test SameSiteNavigationResetsDocumentUsedWebOTP
> 
> Gives more time to propagate the WebOTP bit.
> 
> Bug: 1120305
> Change-Id: Id350a03de42d3ea5895f01f47cdb5fff7ce801e5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2405374
> Reviewed-by: Ken Buchanan <kenrb@chromium.org>
> Commit-Queue: Yi Gu <yigu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#807065}

TBR=kenrb@chromium.org,yigu@chromium.org

Change-Id: I00eaf5dad7403127a62af0d8c6e67c580846df9d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1120305
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2409466
Reviewed-by: Yoichi Osato <yoichio@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807343}
This commit is contained in:
Yoichi Osato
2020-09-16 05:25:53 +00:00
committed by Commit Bot
parent 4f9ea463c9
commit 555b19b234
2 changed files with 15 additions and 15 deletions

@ -3717,26 +3717,17 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest,
// Check that same site navigation correctly resets document_used_web_otp_.
IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest,
SameSiteNavigationResetsDocumentUsedWebOTP) {
const GURL first_url(embedded_test_server()->GetURL("/title1.html"));
ASSERT_TRUE(NavigateToURL(shell(), first_url));
const GURL first_url(
embedded_test_server()->GetURL("/page_with_webotp.html"));
const GURL second_url(embedded_test_server()->GetURL("/empty.html"));
std::string script = R"(
var element = document.createElement('div');
document.body.appendChild(element);
navigator.credentials.get({
otp: {transport:['sms']}
})
.then(content => element.value = content.code);
)";
EXPECT_TRUE(ExecuteScript(web_contents(), script));
EXPECT_TRUE(WaitForLoadStop(web_contents()));
// Load a URL that maps to the same SiteInstance as the second URL, to make
// sure the second navigation will not be cross-process.
ASSERT_TRUE(NavigateToURL(shell(), first_url));
RenderFrameHostImpl* main_rfh = web_contents()->GetMainFrame();
EXPECT_TRUE(main_rfh->DocumentUsedWebOTP());
// Loads a URL that maps to the same SiteInstance as the first URL, to make
// sure the navigation will not be cross-process.
const GURL second_url(embedded_test_server()->GetURL("/title2.html"));
ASSERT_TRUE(NavigateToURL(shell(), second_url));
EXPECT_FALSE(main_rfh->DocumentUsedWebOTP());
}

@ -0,0 +1,9 @@
<input autocomplete="one-time-code">
<script>
const ac = document.querySelector('input[autocomplete="one-time-code"]');
navigator.credentials.get({
otp: {transport:['sms']}
})
.then(content => ac.value = content.code);
</script>