chromium/content/browser/picture_in_picture/video_picture_in_picture_content_browsertest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <optional>

#include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "content/browser/picture_in_picture/picture_in_picture_service_impl.h"
#include "content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/overlay_window.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_content_browser_client.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "net/dns/mock_host_resolver.h"
#include "services/media_session/public/cpp/features.h"
#include "third_party/blink/public/mojom/picture_in_picture/picture_in_picture.mojom.h"

namespace content {

namespace {

class TestVideoOverlayWindow : public VideoOverlayWindow {};

class TestContentBrowserClient : public ContentBrowserTestContentBrowserClient {};

class TestWebContentsDelegate : public WebContentsDelegate {};

class VideoPictureInPictureContentBrowserTest : public ContentBrowserTest {};

}  // namespace

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       RequestSecondVideoInSameRFHDoesNotCloseWindow) {}

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       RequestSecondVideoInDifferentRFHDoesNotCloseWindow) {}

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       EnterPictureInPictureThenFullscreen) {}

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       EnterFullscreenThenPictureInPicture) {}

// Check that the playback state in the Picture-in-Picture window follows the
// state of the media player.
IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       EnterPictureInPictureForPausedPlayer) {}

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       CanvasCaptureRespondsToUserAction) {}

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       PlayerRespondsToUserActionsAfterSrcUpdate) {}

// Tests that when closing the window after the player was reset, the <video>
// element is still notified.
IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       ClosingWindowWithPlayerResetNotifiesElement) {}

// When the player object associated with a video element is destroyed, closing
// the Picture-in-Picture window is the only interaction possible. Thus the
// play/pause/replay button should be hidden.
IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       ResettingPlayerHidesPlayPause) {}

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       PlaybackStateWhenReopenedAfterEndOfStream) {}

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       PlaybackStateWhenSeekingWhilePausedAfterEndOfStream) {}

// Tests that the pip window bounds are accordingly updated when the window size
// is updated.
IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       CheckWindowBounds) {}

class MediaSessionPictureInPictureContentBrowserTest
    : public VideoPictureInPictureContentBrowserTest {};

// Check that the playback state in the Picture-in-Picture window follows the
// state of the media player.
IN_PROC_BROWSER_TEST_F(MediaSessionPictureInPictureContentBrowserTest,
                       EnterPictureInPictureForPausedPlayer) {}

// Tests that an audio player and a canvas-capture player in Picture-in-Picture
// running in one frame coexist peacefully: Media Session actions should work.
IN_PROC_BROWSER_TEST_F(MediaSessionPictureInPictureContentBrowserTest,
                       AudioPlayerWithPictureInPictureCanvasPlayer) {}

// Tests Media Session action availability upon reaching the end of stream by
// verifying that the "nexttrack" action can be invoked after playing through
// to the end of media.
IN_PROC_BROWSER_TEST_F(MediaSessionPictureInPictureContentBrowserTest,
                       ActionAvailableAfterEndOfStreamAndSrcUpdate) {}

IN_PROC_BROWSER_TEST_F(VideoPictureInPictureContentBrowserTest,
                       EnterPictureInPictureHasNoChildWebContents) {}

}  // namespace content