Commit f1fa51af authored by Alex Moshchuk's avatar Alex Moshchuk Committed by Commit Bot

Fix flaky test: ReloadHiddenTabWithCrashedSubframeOutOfView

The suspected cause of flakiness here is that the page used in the
test scrolls an OOPIF, but doesn't properly wait for layout to finish
and for visibility/viewport intersection changes to be propagated to
the corresponding CrossProcessFrameConnector.  This was verified by
inserting an artificial delay into
RemoteFrameView::VisibilityChanged().

Fix this by inserting a EvalJsAfterLifecycleUpdate, which will trigger
requestAnimationFrame and should wait for layout to finish.  This
usage is similar to a few other uses of EvalJsAfterLifecycleUpdate for
syncing viewport intersection changes in other tests in this file.

Bug: 1135072
Change-Id: I49434044a617b1530ce121c24d97aa7071760c9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2503316Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821438}
parent 8573b69e
......@@ -14094,9 +14094,8 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithSadFrameTabReload,
// reload. This avoids showing crashed subframes if a hidden tab is eventually
// shown. Similar to the test above, except that the crashed subframe is
// scrolled out of view.
// Disabled for being flaky: https://crbug.com/1135072.
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithSadFrameTabReload,
DISABLED_ReloadHiddenTabWithCrashedSubframeOutOfView) {
ReloadHiddenTabWithCrashedSubframeOutOfView) {
// Set WebContents to VISIBLE to avoid hitting the |!did_first_set_visible_|
// case when we hide it later.
web_contents()->UpdateWebContentsVisibility(Visibility::VISIBLE);
......@@ -14109,8 +14108,13 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithSadFrameTabReload,
NavigateIframeToURL(web_contents(), "test_iframe",
embedded_test_server()->GetURL("b.com", "/title1.html"));
// Verify the OOPIF isn't visible at the moment.
// This will ensure that the layout has completed and visibility of the OOPIF
// has been updated in the browser process.
FrameTreeNode* root = web_contents()->GetFrameTree()->root();
EXPECT_EQ(true,
EvalJsAfterLifecycleUpdate(root->current_frame_host(), "", "true"));
// Verify the OOPIF isn't visible at the moment.
RenderFrameProxyHost* proxy_to_parent =
root->child_at(0)->render_manager()->GetProxyToParent();
CrossProcessFrameConnector* connector =
......
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