#include "third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate.h"
#include <memory>
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "services/device/public/mojom/screen_orientation.mojom-blink.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/scripted_animation_controller.h"
#include "third_party/blink/renderer/core/frame/frame_view.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/fullscreen/fullscreen.h"
#include "third_party/blink/renderer/core/html/media/html_audio_element.h"
#include "third_party/blink/renderer/core/html/media/html_video_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/page/page_animator.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/modules/device_orientation/device_orientation_controller.h"
#include "third_party/blink/renderer/modules/device_orientation/device_orientation_data.h"
#include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
#include "third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.h"
#include "third_party/blink/renderer/modules/screen_orientation/web_lock_orientation_callback.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_associated_receiver.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/web_test_support.h"
#include "third_party/blink/renderer/platform/wtf/gc_plugin.h"
#include "ui/display/mojom/screen_orientation.mojom-blink.h"
#include "ui/gfx/geometry/rect.h"
_;
namespace blink {
namespace {
class DummyScreenOrientationCallback final : public WebLockOrientationCallback { … };
class MockWebMediaPlayerForOrientationLockDelegate final
: public EmptyWebMediaPlayer { … };
class MockScreenOrientation final
: public GarbageCollected<MockScreenOrientation>,
public device::mojom::blink::ScreenOrientation { … };
void DidEnterFullscreen(Document* document) { … }
void DidExitFullscreen(Document* document) { … }
class MockChromeClientForOrientationLockDelegate final
: public EmptyChromeClient { … };
class StubLocalFrameClientForOrientationLockDelegate final
: public EmptyLocalFrameClient { … };
}
class MediaControlsOrientationLockDelegateTest
: public PageTestBase,
private ScopedVideoFullscreenOrientationLockForTest,
private ScopedVideoRotateToFullscreenForTest { … };
class MediaControlsOrientationLockAndRotateToFullscreenDelegateTest
: public MediaControlsOrientationLockDelegateTest,
private ScopedOrientationEventForTest { … };
TEST_F(MediaControlsOrientationLockDelegateTest, DelegateRequiresFlag) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, DelegateRequiresVideo) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, InitialState) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, EnterFullscreenNoMetadata) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, LeaveFullscreenNoMetadata) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, EnterFullscreenWithMetadata) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, LeaveFullscreenWithMetadata) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, EnterFullscreenAfterPageLock) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, LeaveFullscreenAfterPageLock) { … }
TEST_F(MediaControlsOrientationLockDelegateTest,
ReceivedMetadataAfterExitingFullscreen) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, ReceivedMetadataLater) { … }
TEST_F(MediaControlsOrientationLockDelegateTest, ComputeOrientationLock) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
ComputeDeviceOrientation) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitInlineRotateToLandscapeFullscreen) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitInlineButtonToPortraitLockedLandscapeFullscreen) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitLockedLandscapeFullscreenRotateToLandscapeFullscreen) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitLockedLandscapeFullscreenBackToPortraitInline) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeInlineRotateToPortraitInline) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeInlineButtonToLandscapeFullscreen) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeFullscreenRotateToPortraitInline) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeFullscreenBackToLandscapeInline) { … }
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledPortraitInlineButtonToPortraitLockedLandscapeFullscreen) { … }
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledPortraitLockedLandscapeFullscreenRotateToLandscapeLockedLandscapeFullscreen) { … }
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledPortraitLockedLandscapeFullscreenBackToPortraitInline) { … }
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledLandscapeLockedLandscapeFullscreenRotateToPortraitLockedLandscapeFullscreen) { … }
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledLandscapeLockedLandscapeFullscreenBackToPortraitInline) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitVideoRotateEnterExit) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeDeviceRotateEnterExit) { … }
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
ScreenOrientationRaceCondition) { … }
}