chromium/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc

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

#include <memory>
#include <optional>
#include <utility>

#include "base/containers/flat_set.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/fullscreen_control/fullscreen_control_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/frame/fullscreen.mojom.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/gfx/animation/animation_test_api.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/test/button_test_api.h"
#include "ui/views/view.h"
#include "url/gurl.h"

#if defined(USE_AURA)
#include "ui/aura/test/test_cursor_client.h"
#include "ui/aura/window.h"
#endif

namespace {

constexpr base::TimeDelta kPopupEventTimeout =;

}  // namespace

class FullscreenControlViewTest : public InProcessBrowserTest {};

// Creating the popup on Mac increases the memory use by ~2MB so it should be
// lazily loaded only when necessary. This test verifies that the popup is not
// immediately created when FullscreenControlHost is created.
// Disabled on Lacros due to flaky. crbug.com/1254453
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_NoFullscreenPopupOnBrowserFullscreen
#else
#define MAYBE_NoFullscreenPopupOnBrowserFullscreen
#endif
IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest,
                       MAYBE_NoFullscreenPopupOnBrowserFullscreen) {}

// These four tests which cover the mouse/touch fullscreen UI are covering
// behavior that doesn't exist on Mac - Mac has its own native fullscreen exit
// UI. See IsExitUiEnabled() in FullscreenControlHost.
#if !BUILDFLAG(IS_MAC)

// Disabled on Lacros due to flaky. crbug.com/1254453
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_MouseExitFullscreen
#else
#define MAYBE_MouseExitFullscreen
#endif
IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, MAYBE_MouseExitFullscreen) {}

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_MouseExitFullscreen_TimeoutAndRetrigger
#else
#define MAYBE_MouseExitFullscreen_TimeoutAndRetrigger
#endif
// Flaky on lacros: https://crbug.com/1254453
IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest,
                       MAYBE_MouseExitFullscreen_TimeoutAndRetrigger) {}

// Disabled on Lacros due to flaky. crbug.com/1254453
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_MouseOnTopWhenPromptIsShowing_ButtonNotShownUntilMouseLeavesBufferArea
#else
#define MAYBE_MouseOnTopWhenPromptIsShowing_ButtonNotShownUntilMouseLeavesBufferArea
#endif
IN_PROC_BROWSER_TEST_F(
    FullscreenControlViewTest,
    MAYBE_MouseOnTopWhenPromptIsShowing_ButtonNotShownUntilMouseLeavesBufferArea) {}

// Disabled on Lacros due to flaky. crbug.com/1254453
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_TouchPopupInteraction
#else
#define MAYBE_TouchPopupInteraction
#endif
IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, MAYBE_TouchPopupInteraction) {}

// Disabled on Lacros due to flaky. crbug.com/1254453
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_MouseAndTouchInteraction_NoInterference
#else
#define MAYBE_MouseAndTouchInteraction_NoInterference
#endif
IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest,
                       MAYBE_MouseAndTouchInteraction_NoInterference) {}
#endif

// Disabled on Lacros due to flaky. crbug.com/1254453
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_KeyboardPopupInteraction
#else
#define MAYBE_KeyboardPopupInteraction
#endif
IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest,
                       MAYBE_KeyboardPopupInteraction) {}