Commit 2a48d057 authored by W. James MacLean's avatar W. James MacLean Committed by Commit Bot

Add a retry in the JS code for initial focus.

Since the test fails even when the embedder WebContents and the iframe
for the text area both have focus (in the browser process), then next
theory is that focus hasn't had time to propagate to the DOM in some
cases.

This CL adds a retry mechanism in the JS code that tests for initial
focus in the iframe containing the text area.

TBR=alexmos@chromium.org

Bug: 1024672
Change-Id: I4a35a6e1c7858b207b65d41d954b3e5a618a2af8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1935023Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719155}
parent b49b8838
......@@ -1292,7 +1292,15 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractivePDFTest,
"new Promise((resolve) => {"
" iframe1doc = "
" document.getElementById('iframe1').contentDocument;"
" resolve(iframe1doc.hasFocus());"
" function timeoutFcn(n) {"
" if (n == 0 || iframe1doc.hasFocus()) {"
" resolve(iframe1doc.hasFocus());"
" return;"
" }"
" window.console.log('Recursing: n = ' + n);"
" setTimeout(() => { timeoutFcn(n-1); }, 1000);"
" };"
" timeoutFcn(5);"
"});")
.ExtractBool();
if (!starts_focused) {
......
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