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

Re-enable SitePerProcessAutoplayBrowserTest.PropagateUserGestureFlag.

It's not clear what the cause of flakiness was in this test, as the
available logs are stale.  The test currently fails on a
WaitForLoadStop() in one of the test's custom navigation helpers, when
used on an initial navigation.  These helpers seem unnecessary, and
the first navigation simulates something that can't normally happen
(renderer-initiated OpenURL() request from an initial blank tab).
Rewrite the test to use existing navigation helpers, and re-enable the
test to see if it's healed itself and to gather more data if it
hasn't.

Bug: 1014175
Change-Id: I6f48a2ff25d7fff23002611fe3e4f67c82d09cd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518494Reviewed-by: default avatarŁukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824208}
parent 9c7cdbb3
...@@ -523,22 +523,6 @@ bool ConvertJSONToPoint(const std::string& str, gfx::PointF* point) { ...@@ -523,22 +523,6 @@ bool ConvertJSONToPoint(const std::string& str, gfx::PointF* point) {
return true; return true;
} }
void OpenURLBlockUntilNavigationComplete(Shell* shell, const GURL& url) {
EXPECT_TRUE(WaitForLoadStop(shell->web_contents()));
TestNavigationObserver same_tab_observer(shell->web_contents(), 1);
OpenURLParams params(
url,
content::Referrer(shell->web_contents()->GetLastCommittedURL(),
network::mojom::ReferrerPolicy::kAlways),
WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_LINK,
true /* is_renderer_initiated */);
params.initiator_origin = url::Origin::Create(url);
shell->OpenURLFromTab(shell->web_contents(), params);
same_tab_observer.Wait();
}
// Helper function to generate a feature policy for a single feature and a list // Helper function to generate a feature policy for a single feature and a list
// of origins. // of origins.
// (Equivalent to the declared policy "feature origin1 origin2 ...".) // (Equivalent to the declared policy "feature origin1 origin2 ...".)
...@@ -812,8 +796,6 @@ class SitePerProcessAutoplayBrowserTest : public SitePerProcessBrowserTest { ...@@ -812,8 +796,6 @@ class SitePerProcessAutoplayBrowserTest : public SitePerProcessBrowserTest {
command_line->AppendSwitchASCII( command_line->AppendSwitchASCII(
switches::kAutoplayPolicy, switches::kAutoplayPolicy,
switches::autoplay::kDocumentUserActivationRequiredPolicy); switches::autoplay::kDocumentUserActivationRequiredPolicy);
command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures,
"FeaturePolicyAutoplayFeature");
} }
bool AutoplayAllowed(const ToRenderFrameHost& adapter, bool AutoplayAllowed(const ToRenderFrameHost& adapter,
...@@ -829,12 +811,6 @@ class SitePerProcessAutoplayBrowserTest : public SitePerProcessBrowserTest { ...@@ -829,12 +811,6 @@ class SitePerProcessAutoplayBrowserTest : public SitePerProcessBrowserTest {
} }
return worked; return worked;
} }
void NavigateFrameAndWait(FrameTreeNode* node, const GURL& url) {
NavigateFrameToURL(node, url);
EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
EXPECT_EQ(url, node->current_url());
}
}; };
class SitePerProcessScrollAnchorTest : public SitePerProcessBrowserTest { class SitePerProcessScrollAnchorTest : public SitePerProcessBrowserTest {
...@@ -4262,9 +4238,8 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, OriginReplication) { ...@@ -4262,9 +4238,8 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, OriginReplication) {
// Test that HasReceivedUserGesture and HasReceivedUserGestureBeforeNavigation // Test that HasReceivedUserGesture and HasReceivedUserGestureBeforeNavigation
// are propagated correctly across origins. // are propagated correctly across origins.
// Flaky. https://crbug.com/1014175
IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest, IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest,
DISABLED_PropagateUserGestureFlag) { PropagateUserGestureFlag) {
GURL main_url(embedded_test_server()->GetURL( GURL main_url(embedded_test_server()->GetURL(
"example.com", "/media/autoplay/autoplay-enabled.html")); "example.com", "/media/autoplay/autoplay-enabled.html"));
GURL foo_url(embedded_test_server()->GetURL( GURL foo_url(embedded_test_server()->GetURL(
...@@ -4277,12 +4252,12 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest, ...@@ -4277,12 +4252,12 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest,
"test.example.com", "/media/autoplay/autoplay-disabled.html")); "test.example.com", "/media/autoplay/autoplay-disabled.html"));
// Load a page with an iframe that has autoplay. // Load a page with an iframe that has autoplay.
OpenURLBlockUntilNavigationComplete(shell(), main_url); EXPECT_TRUE(NavigateToURL(shell(), main_url));
FrameTreeNode* root = web_contents()->GetFrameTree()->root(); FrameTreeNode* root = web_contents()->GetFrameTree()->root();
// Navigate the subframes to cross-origin pages. // Navigate the subframes to cross-origin pages.
NavigateFrameAndWait(root->child_at(0), foo_url); EXPECT_TRUE(NavigateFrameToURL(root->child_at(0), foo_url));
NavigateFrameAndWait(root->child_at(0)->child_at(0), bar_url); EXPECT_TRUE(NavigateFrameToURL(root->child_at(0)->child_at(0), bar_url));
// Test that all frames can autoplay if there has been a gesture in the top // Test that all frames can autoplay if there has been a gesture in the top
// frame. // frame.
...@@ -4291,12 +4266,12 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest, ...@@ -4291,12 +4266,12 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest,
EXPECT_TRUE(AutoplayAllowed(root->child_at(0)->child_at(0), false)); EXPECT_TRUE(AutoplayAllowed(root->child_at(0)->child_at(0), false));
// Navigate to a new page on the same origin. // Navigate to a new page on the same origin.
OpenURLBlockUntilNavigationComplete(shell(), secondary_url); EXPECT_TRUE(NavigateToURLFromRenderer(shell(), secondary_url));
root = web_contents()->GetFrameTree()->root(); root = web_contents()->GetFrameTree()->root();
// Navigate the subframes to cross-origin pages. // Navigate the subframes to cross-origin pages.
NavigateFrameAndWait(root->child_at(0), foo_url); EXPECT_TRUE(NavigateFrameToURL(root->child_at(0), foo_url));
NavigateFrameAndWait(root->child_at(0)->child_at(0), bar_url); EXPECT_TRUE(NavigateFrameToURL(root->child_at(0)->child_at(0), bar_url));
// Test that all frames can autoplay because the gesture bit has been passed // Test that all frames can autoplay because the gesture bit has been passed
// through the navigation. // through the navigation.
...@@ -4305,16 +4280,16 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest, ...@@ -4305,16 +4280,16 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest,
EXPECT_TRUE(AutoplayAllowed(root->child_at(0)->child_at(0), false)); EXPECT_TRUE(AutoplayAllowed(root->child_at(0)->child_at(0), false));
// Navigate to a page with autoplay disabled. // Navigate to a page with autoplay disabled.
OpenURLBlockUntilNavigationComplete(shell(), disabled_url); EXPECT_TRUE(NavigateToURLFromRenderer(shell(), disabled_url));
NavigateFrameAndWait(root->child_at(0), foo_url); EXPECT_TRUE(NavigateFrameToURL(root->child_at(0), foo_url));
// Test that autoplay is no longer allowed. // Test that autoplay is no longer allowed.
EXPECT_TRUE(AutoplayAllowed(shell(), false)); EXPECT_TRUE(AutoplayAllowed(shell(), false));
EXPECT_FALSE(AutoplayAllowed(root->child_at(0), false)); EXPECT_FALSE(AutoplayAllowed(root->child_at(0), false));
// Navigate to another origin and make sure autoplay is disabled. // Navigate to another origin and make sure autoplay is disabled.
OpenURLBlockUntilNavigationComplete(shell(), foo_url); EXPECT_TRUE(NavigateToURLFromRenderer(shell(), foo_url));
NavigateFrameAndWait(root->child_at(0), bar_url); EXPECT_TRUE(NavigateFrameToURL(root->child_at(0), bar_url));
EXPECT_FALSE(AutoplayAllowed(shell(), false)); EXPECT_FALSE(AutoplayAllowed(shell(), false));
EXPECT_FALSE(AutoplayAllowed(shell(), false)); EXPECT_FALSE(AutoplayAllowed(shell(), false));
} }
......
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