Commit 94b0138d authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Revert "[Picture-in-Picture] Update window playback when video src changes."

This reverts commit 93488940.

Reason for revert: PictureInPictureWindowControllerBrowserTest.UpdateVideoSrcKeepsPictureInPictureWindowOpened is very flaky: https://crbug.com/865410

Original change's description:
> [Picture-in-Picture] Update window playback when video src changes.
> 
> This CL make sure the Picture-in-Picture window playback state is
> reflected when video src changes. It is a follow-up to
> https://chromium-review.googlesource.com/1089331
> 
> Bug: 726619
> Change-Id: Ic756c03aa023d3e4e229c7495686ea8f322503e3
> Reviewed-on: https://chromium-review.googlesource.com/1133168
> Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
> Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
> Reviewed-by: Matthew Wolenetz <wolenetz@chromium.org>
> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#576428}

TBR=dalecurtis@chromium.org,wolenetz@chromium.org,beaufort.francois@gmail.com,mlamouri@chromium.org,jochen@chromium.org

Change-Id: I2b35b9ef8c119915b1c07f9f12321439c3242ab2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 726619, 865410
Reviewed-on: https://chromium-review.googlesource.com/1143324Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576454}
parent 9067baa1
...@@ -474,15 +474,25 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest, ...@@ -474,15 +474,25 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
// keep Picture-in-Picture window opened. // keep Picture-in-Picture window opened.
IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest, IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
ResetVideoSrcKeepsPictureInPictureWindowOpened) { ResetVideoSrcKeepsPictureInPictureWindowOpened) {
LoadTabAndEnterPictureInPicture(browser()); GURL test_page_url = ui_test_utils::GetTestUrl(
base::FilePath(base::FilePath::kCurrentDirectory),
EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible()); base::FilePath(
EXPECT_TRUE( FILE_PATH_LITERAL("media/picture-in-picture/window-size.html")));
window_controller()->GetWindowForTesting()->GetVideoLayer()->visible()); ui_test_utils::NavigateToURL(browser(), test_page_url);
content::WebContents* active_web_contents = content::WebContents* active_web_contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_TRUE(content::ExecuteScript(active_web_contents, "video.src = null;")); ASSERT_TRUE(active_web_contents);
SetUpWindowController(active_web_contents);
ASSERT_TRUE(window_controller());
EXPECT_TRUE(content::ExecuteScript(active_web_contents, "video.play();"));
bool result = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
active_web_contents, "enterPictureInPicture();", &result));
EXPECT_TRUE(result);
bool in_picture_in_picture = false; bool in_picture_in_picture = false;
EXPECT_TRUE(ExecuteScriptAndExtractBool( EXPECT_TRUE(ExecuteScriptAndExtractBool(
...@@ -490,43 +500,15 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest, ...@@ -490,43 +500,15 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
EXPECT_TRUE(in_picture_in_picture); EXPECT_TRUE(in_picture_in_picture);
EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible()); EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible());
EXPECT_FALSE(
window_controller()->GetWindowForTesting()->GetVideoLayer()->visible());
}
#if defined(OS_LINUX)
#define MAYBE_UpdateVideoSrcKeepsPictureInPictureWindowOpened \
DISABLED_UpdateVideoSrcKeepsPictureInPictureWindowOpened
#else
#define MAYBE_UpdateVideoSrcKeepsPictureInPictureWindowOpened \
UpdateVideoSrcKeepsPictureInPictureWindowOpened
#endif
// Tests that updating video src when video is in Picture-in-Picture session
// keep Picture-in-Picture window opened.
IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
MAYBE_UpdateVideoSrcKeepsPictureInPictureWindowOpened) {
LoadTabAndEnterPictureInPicture(browser());
EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible());
EXPECT_TRUE(
window_controller()->GetWindowForTesting()->GetVideoLayer()->visible());
content::WebContents* active_web_contents = EXPECT_TRUE(content::ExecuteScript(active_web_contents, "video.src = null;"));
browser()->tab_strip_model()->GetActiveWebContents();
bool result = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
active_web_contents, "changeVideoSrc();", &result));
EXPECT_TRUE(result);
bool in_picture_in_picture = false; in_picture_in_picture = false;
EXPECT_TRUE(ExecuteScriptAndExtractBool( EXPECT_TRUE(ExecuteScriptAndExtractBool(
active_web_contents, "isInPictureInPicture();", &in_picture_in_picture)); active_web_contents, "isInPictureInPicture();", &in_picture_in_picture));
EXPECT_TRUE(in_picture_in_picture); EXPECT_TRUE(in_picture_in_picture);
EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible()); EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible());
EXPECT_TRUE(
window_controller()->GetWindowForTesting()->GetVideoLayer()->visible());
} }
// Tests that we can enter Picture-in-Picture when a video is not preloaded, // Tests that we can enter Picture-in-Picture when a video is not preloaded,
......
...@@ -71,12 +71,5 @@ ...@@ -71,12 +71,5 @@
document.title = 'fullscreen'; document.title = 'fullscreen';
}, { once: true }); }, { once: true });
} }
function changeVideoSrc() {
video.addEventListener('loadedmetadata', function() {
window.domAutomationController.send(true);
}, { once: true });
video.src = video.src;
}
</script> </script>
</html> </html>
...@@ -207,7 +207,7 @@ void MediaWebContentsObserver::OnMediaPaused(RenderFrameHost* render_frame_host, ...@@ -207,7 +207,7 @@ void MediaWebContentsObserver::OnMediaPaused(RenderFrameHost* render_frame_host,
UpdateVideoLock(); UpdateVideoLock();
if (!web_contents()->IsBeingDestroyed() && pip_player_.has_value() && if (!web_contents()->IsBeingDestroyed() && pip_player_.has_value() &&
pip_player_->render_frame_host == render_frame_host) { pip_player_ == player_id) {
content::PictureInPictureWindowController::GetOrCreateForWebContents( content::PictureInPictureWindowController::GetOrCreateForWebContents(
web_contents()) web_contents())
->UpdatePlaybackState(false /* is not playing */, ->UpdatePlaybackState(false /* is not playing */,
...@@ -259,7 +259,7 @@ void MediaWebContentsObserver::OnMediaPlaying( ...@@ -259,7 +259,7 @@ void MediaWebContentsObserver::OnMediaPlaying(
} }
if (!web_contents()->IsBeingDestroyed() && pip_player_.has_value() && if (!web_contents()->IsBeingDestroyed() && pip_player_.has_value() &&
pip_player_->render_frame_host == render_frame_host) { pip_player_ == id) {
content::PictureInPictureWindowController::GetOrCreateForWebContents( content::PictureInPictureWindowController::GetOrCreateForWebContents(
web_contents()) web_contents())
->UpdatePlaybackState(true /* is playing */, ->UpdatePlaybackState(true /* is playing */,
......
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