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,
// keep Picture-in-Picture window opened.
IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
ResetVideoSrcKeepsPictureInPictureWindowOpened) {
LoadTabAndEnterPictureInPicture(browser());
EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible());
EXPECT_TRUE(
window_controller()->GetWindowForTesting()->GetVideoLayer()->visible());
GURL test_page_url = ui_test_utils::GetTestUrl(
base::FilePath(base::FilePath::kCurrentDirectory),
base::FilePath(
FILE_PATH_LITERAL("media/picture-in-picture/window-size.html")));
ui_test_utils::NavigateToURL(browser(), test_page_url);
content::WebContents* active_web_contents =
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;
EXPECT_TRUE(ExecuteScriptAndExtractBool(
......@@ -490,43 +500,15 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
EXPECT_TRUE(in_picture_in_picture);
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 =
browser()->tab_strip_model()->GetActiveWebContents();
bool result = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
active_web_contents, "changeVideoSrc();", &result));
EXPECT_TRUE(result);
EXPECT_TRUE(content::ExecuteScript(active_web_contents, "video.src = null;"));
bool in_picture_in_picture = false;
in_picture_in_picture = false;
EXPECT_TRUE(ExecuteScriptAndExtractBool(
active_web_contents, "isInPictureInPicture();", &in_picture_in_picture));
EXPECT_TRUE(in_picture_in_picture);
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,
......
......@@ -71,12 +71,5 @@
document.title = 'fullscreen';
}, { once: true });
}
function changeVideoSrc() {
video.addEventListener('loadedmetadata', function() {
window.domAutomationController.send(true);
}, { once: true });
video.src = video.src;
}
</script>
</html>
......@@ -207,7 +207,7 @@ void MediaWebContentsObserver::OnMediaPaused(RenderFrameHost* render_frame_host,
UpdateVideoLock();
if (!web_contents()->IsBeingDestroyed() && pip_player_.has_value() &&
pip_player_->render_frame_host == render_frame_host) {
pip_player_ == player_id) {
content::PictureInPictureWindowController::GetOrCreateForWebContents(
web_contents())
->UpdatePlaybackState(false /* is not playing */,
......@@ -259,7 +259,7 @@ void MediaWebContentsObserver::OnMediaPlaying(
}
if (!web_contents()->IsBeingDestroyed() && pip_player_.has_value() &&
pip_player_->render_frame_host == render_frame_host) {
pip_player_ == id) {
content::PictureInPictureWindowController::GetOrCreateForWebContents(
web_contents())
->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