#include "chrome/browser/ui/views/overlay/video_overlay_window_views.h"
#include <memory>
#include <utility>
#include "base/containers/contains.h"
#include "base/memory/raw_ptr.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/picture_in_picture/auto_pip_setting_overlay_view.h"
#include "chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h"
#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
#include "chrome/browser/ui/views/overlay/back_to_tab_button.h"
#include "chrome/browser/ui/views/overlay/close_image_button.h"
#include "chrome/browser/ui/views/overlay/minimize_button.h"
#include "chrome/browser/ui/views/overlay/simple_overlay_window_image_button.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "content/public/browser/overlay_window.h"
#include "content/public/browser/video_picture_in_picture_window_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_web_contents_factory.h"
#include "media/base/media_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/compositor/layer.h"
#include "ui/display/test/test_screen.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/test/event_generator.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/test/button_test_api.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/widget/widget_utils.h"
namespace {
constexpr gfx::Size kMinWindowSize(200, 100);
constexpr gfx::Size kBubbleSize(300, 200);
constexpr gfx::Size kSizeBigEnoughForBubble(400, 300);
}
_;
Return;
class MockOverlayView : public AutoPipSettingOverlayView { … };
class TestVideoPictureInPictureWindowController
: public content::VideoPictureInPictureWindowController { … };
class VideoOverlayWindowViewsTest : public ChromeViewsTestBase { … };
TEST_F(VideoOverlayWindowViewsTest, InitialWindowSize_Square) { … }
TEST_F(VideoOverlayWindowViewsTest, InitialWindowSize_Horizontal) { … }
TEST_F(VideoOverlayWindowViewsTest, InitialWindowSize_Vertical) { … }
TEST_F(VideoOverlayWindowViewsTest, Letterboxing) { … }
TEST_F(VideoOverlayWindowViewsTest, Pillarboxing) { … }
TEST_F(VideoOverlayWindowViewsTest, Pillarboxing_Square) { … }
TEST_F(VideoOverlayWindowViewsTest, ApproximateAspectRatio_Horizontal) { … }
TEST_F(VideoOverlayWindowViewsTest, ApproximateAspectRatio_Vertical) { … }
TEST_F(VideoOverlayWindowViewsTest, UpdateMaximumSize) { … }
TEST_F(VideoOverlayWindowViewsTest, IgnoreInvalidMaximumSize) { … }
TEST_F(VideoOverlayWindowViewsTest, NextTrackButtonAddedWhenControlsHidden) { … }
TEST_F(VideoOverlayWindowViewsTest,
PreviousTrackButtonAddedWhenControlsHidden) { … }
TEST_F(VideoOverlayWindowViewsTest, UpdateNaturalSizeDoesNotMoveWindow) { … }
TEST_F(VideoOverlayWindowViewsTest, HitTestFrameView) { … }
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
TEST_F(VideoOverlayWindowViewsTest, DISABLED_NoMouseExitWithinWindowBounds) { … }
#endif
TEST_F(VideoOverlayWindowViewsTest, ShowControlsOnFocus) { … }
TEST_F(VideoOverlayWindowViewsTest, OnlyPauseOnCloseWhenPauseIsAvailable) { … }
TEST_F(VideoOverlayWindowViewsTest, PauseOnWidgetCloseWhenPauseAvailable) { … }
TEST_F(VideoOverlayWindowViewsTest,
DontPauseOnWidgetCloseWhenPauseNotAvailable) { … }
TEST_F(VideoOverlayWindowViewsTest, SmallDisplayWorkAreaDoesNotCrash) { … }
TEST_F(VideoOverlayWindowViewsTest, DISABLED_ControlsAreHiddenDuringMove) { … }
TEST_F(VideoOverlayWindowViewsTest,
ControlsAreHiddenDuringMove_MultipleUpdates) { … }
TEST_F(VideoOverlayWindowViewsTest, OverlayViewIsSizedCorrectly) { … }
TEST_F(VideoOverlayWindowViewsTest, OverlayViewCanBeClicked) { … }
TEST_F(VideoOverlayWindowViewsTest, OverlayWindowBlocksInput) { … }
TEST_F(VideoOverlayWindowViewsTest, OverlayWindowFitsInMinimumSize) { … }
TEST_F(VideoOverlayWindowViewsTest, OverlayWindowStopsBlockingInput) { … }
TEST_F(VideoOverlayWindowViewsTest, IsTrackedByTheOcclusionObserver) { … }
class VideoOverlayWindowViewsWith2024UITest
: public VideoOverlayWindowViewsTest { … };
TEST_F(VideoOverlayWindowViewsWith2024UITest,
MinimizeButtonClosesWithoutPausing) { … }
TEST_F(VideoOverlayWindowViewsWith2024UITest, ShowsBackToTabImageButton) { … }