[Autofill Assistant] Fix possible ordering problem in WebController test
The devtools backend receives and will handle protocol messages in order, but there is no guarantee of ordering with other non-protocol things. This is true for content::ExecJs. This test sent a Runtime.Evaluate message over the devtools protocol and then called ExecJs. Due to the way scheduling is handled in the devtools backend, it's possible that the ExecJs code runs before the protocol message is handled by the backend. Callers can get around this by waiting for the first Runtime.Evaluate call to finish and then only continuing in the callback provided. In this case, the first JS evaluation sets up a promise that will only resolve once the second JS evaluation happens, so that won't work. The solution here is to use a second Runtime.Evaluate call, which does have an ordering guarantee with the first. Upcoming changes to the scheduling uncovered this as a flake on the trybots. Change-Id: I643539d094407a43b4ffff17dd052e5f49e3e44e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1939409Reviewed-by:Clemens Arbesser <arbesser@google.com> Commit-Queue: Peter Marshall <petermarshall@chromium.org> Cr-Commit-Position: refs/heads/master@{#719538}
Showing
Please register or sign in to comment