#include <memory>
#include <utility>
#include "base/containers/contains.h"
#include "base/memory/raw_ptr.h"
#include "media/mojo/mojom/media_player.mojom-blink.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_dom_exception.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/html/media/html_media_test_helper.h"
#include "third_party/blink/renderer/core/html/media/html_video_element.h"
#include "third_party/blink/renderer/core/layout/layout_image.h"
#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/loader/resource/image_resource_content.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/wait_for_event.h"
#include "third_party/blink/renderer/modules/document_picture_in_picture/document_picture_in_picture.h"
#include "third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.h"
#include "third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_component.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_descriptor.h"
#include "third_party/blink/renderer/platform/testing/empty_web_media_player.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#if !BUILDFLAG(TARGET_OS_IS_ANDROID)
#include "third_party/blink/renderer/bindings/modules/v8/v8_document_picture_in_picture_options.h"
#endif
_;
namespace blink {
namespace {
#if !BUILDFLAG(TARGET_OS_IS_ANDROID)
KURL GetOpenerURL() { … }
LocalDOMWindow* OpenDocumentPictureInPictureWindow(
V8TestingScope& v8_scope,
Document& document,
KURL opener_url = GetOpenerURL()) { … }
#endif
}
viz::SurfaceId TestSurfaceId() { … }
class MockPictureInPictureSession
: public mojom::blink::PictureInPictureSession { … };
class MockPictureInPictureService
: public mojom::blink::PictureInPictureService { … };
class PictureInPictureControllerFrameClient
: public test::MediaStubLocalFrameClient { … };
class PictureInPictureControllerPlayer final : public EmptyWebMediaPlayer { … };
class PictureInPictureTestWebFrameClient
: public frame_test_helpers::TestWebFrameClient { … };
class PictureInPictureControllerTestWithWidget : public RenderingTest { … };
TEST_F(PictureInPictureControllerTestWithWidget,
EnterPictureInPictureFiresEvent) { … }
TEST_F(PictureInPictureControllerTestWithWidget,
FrameThrottlingIsSetProperlyWithoutSetup) { … }
TEST_F(PictureInPictureControllerTestWithWidget,
ExitPictureInPictureFiresEvent) { … }
TEST_F(PictureInPictureControllerTestWithWidget, StartObserving) { … }
TEST_F(PictureInPictureControllerTestWithWidget, StopObserving) { … }
TEST_F(PictureInPictureControllerTestWithWidget,
PlayPauseButton_InfiniteDuration) { … }
TEST_F(PictureInPictureControllerTestWithWidget, PlayPauseButton_MediaSource) { … }
TEST_F(PictureInPictureControllerTestWithWidget, PerformMediaPlayerAction) { … }
TEST_F(PictureInPictureControllerTestWithWidget,
EnterPictureInPictureAfterResettingWMP) { … }
TEST_F(PictureInPictureControllerTestWithWidget,
EnterPictureInPictureProvideSourceBoundsSetToBoundsInWidget) { … }
TEST_F(PictureInPictureControllerTestWithWidget,
EnterPictureInPictureProvideSourceBoundsSetToReplacedContentRect) { … }
TEST_F(PictureInPictureControllerTestWithWidget, VideoIsNotAllowedIfAutoPip) { … }
#if !BUILDFLAG(TARGET_OS_IS_ANDROID)
TEST_F(PictureInPictureControllerTestWithWidget,
DocumentPiPDoesNotAllowVizThrottling) { … }
TEST_F(PictureInPictureControllerTestWithWidget,
DocumentPiPDoesOpenWithFileUrl) { … }
class PictureInPictureControllerChromeClient
: public RenderingTestChromeClient { … };
class PictureInPictureControllerTestWithChromeClient : public RenderingTest { … };
TEST_F(PictureInPictureControllerTestWithChromeClient,
CreateDocumentPictureInPictureWindow) { … }
TEST_F(PictureInPictureControllerTestWithChromeClient,
CreateDocumentPictureInPictureWindowThrowsExceptionWhenDomWindowNull) { … }
TEST_F(PictureInPictureControllerTestWithChromeClient, RequiresUserGesture) { … }
TEST_F(PictureInPictureControllerTestWithChromeClient,
OpenDocumentPiPTwiceSynchronouslyDoesNotCrash) { … }
TEST_F(PictureInPictureControllerTestWithChromeClient, CopiesAutoplayFlags) { … }
#endif
}