Commit 4f3b6063 authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

Fix flaky <webview> tests.

The two tests following tests are potentially flaky:
 * WebViewTests/WebViewTest.Shim_TestNestedSubframes/*
 * WebViewTests/WebViewTest.Shim_TestNestedCrossOriginSubframes/*

Why are they flaky?

webview.onloadstop event handler is defined. Once called, it causes a
new navigation to happens in the webview. The navigation causes the
handler to be called again. This is a loop. It wasn't expected to behave
that way.

If the nested iframe navigation happens quickly enough, the two time
nested iframe navigation might not complete quickly enough and the
postMessage() may not happens.

The race condition may be unfavourable several time in a row and causes
a test timeout.

FYI:
    1) This test was disabled on Mac. Maybe this CL fixes the issue? It
       should be verified on a device with this OS.
    2) This test is flakier after enabling NavigationMojoResponse and
       applying this CL:
       https://chromium-review.googlesource.com/c/chromium/src/+/951243/6
       That's understandable, this patch allows navigation to commit
       faster.

Bug: 674904, 705744
Change-Id: Icf2debd095519221ff085cb3bacbc058c1806e86
Reviewed-on: https://chromium-review.googlesource.com/955585Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542064}
parent 5dfbc861
......@@ -1477,6 +1477,10 @@ function testNestedCrossOriginSubframes() {
window.console.log('guest.consolemessage ' + e.message);
};
webview.onloadstop = function() {
// Only consider the first load stop, not the following one due to the
// iframe navigation.
webview.onloadstop = undefined;
window.onmessage = function(e) {
if (e.data == 'frames-loaded') {
embedder.test.succeed();
......@@ -1501,6 +1505,10 @@ function testNestedSubframes() {
window.console.log('guest.consolemessage ' + e.message);
};
webview.onloadstop = function() {
// Only consider the first load stop, not the following one due to the
// iframe navigation.
webview.onloadstop = undefined;
window.onmessage = function(e) {
if (e.data == 'frames-loaded') {
embedder.test.succeed();
......
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