Skip to content

Commit

Permalink
Hide PiP play/pause button upon destroying video player
Browse files Browse the repository at this point in the history
When the video player is destroyed, closing the Picture-in-Picture
window is the only interaction possible. Thus the play/pause/replay
button should be hidden.

Bug: 1100937
Change-Id: I0c0a9f6e37082871ba388b8d5e0a6acced3eb0a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2323046
Commit-Queue: Wojciech Dzierżanowski <wdzierzanowski@opera.com>
Reviewed-by: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#892054}
  • Loading branch information
wdzierzanowski authored and Chromium LUCI CQ committed Jun 14, 2021
1 parent 7534ec2 commit 57e80b9
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/scoped_observation.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
Expand Down Expand Up @@ -2242,28 +2241,6 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
WaitForTitle(active_web_contents, u"leavepictureinpicture");
}

// Tests that when closing the window after the player was reset, the <video>
// element is still notified.
IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
ResetPlayerCloseWindowNotifiesElement) {
LoadTabAndEnterPictureInPicture(
browser(), base::FilePath(kPictureInPictureWindowSizePage));
content::WebContents* active_web_contents =
browser()->tab_strip_model()->GetActiveWebContents();

// Video should be in Picture-in-Picture.
EXPECT_EQ(true, EvalJs(active_web_contents, "isInPictureInPicture();"));

// Reset video source and wait for the notification.
ASSERT_TRUE(ExecJs(active_web_contents, "resetVideo();"));
WaitForTitle(active_web_contents, u"emptied");

window_controller()->Close(true /* should_pause_video */);

// Video should no longer be in Picture-in-Picture.
ExpectLeavePictureInPicture(active_web_contents);
}

// Tests that play/pause video playback is toggled if there are no focus
// afforfances on the Picture-in-Picture window buttons when user hits space
// keyboard key.
Expand Down
7 changes: 0 additions & 7 deletions chrome/test/data/media/picture-in-picture/window-size.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,5 @@
.catch(e => { document.title = 'failed to enter Picture-in-Picture after leaving'; });
});
}

function resetVideo() {
video.addEventListener('emptied', () => {
document.title = 'emptied';
}, { once: true });
video.src = '';
}
</script>
</html>

0 comments on commit 57e80b9

Please sign in to comment.