chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_platform_impl_interactive_uitest.cc

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

#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "build/build_config.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/window_tree_host_platform.h"
#include "ui/base/hit_test.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/test/ui_controls.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/wm/wm_move_resize_handler.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/test/widget_activation_waiter.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h"
#include "ui/views/widget/widget_delegate.h"
#include "ui/views/window/native_frame_view.h"

#if BUILDFLAG(IS_LINUX)
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
#include "ui/views/widget/desktop_aura/window_event_filter_linux.h"
DesktopWindowTreeHostPlatformImpl;
#else
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_lacros.h"
#include "ui/views/widget/desktop_aura/window_event_filter_lacros.h"
using DesktopWindowTreeHostPlatformImpl = views::DesktopWindowTreeHostLacros;
#endif

namespace views {

namespace {

bool IsNonClientComponent(int hittest) {}

std::unique_ptr<Widget> CreateWidget(const gfx::Rect& bounds) {}

// Dispatches a motion event targeted to |point_in_screen|.
void DispatchMouseMotionEventSync(const gfx::Point& point_in_screen) {}

// An event handler which counts the number of mouse moves it has seen.
class MouseMoveCounterHandler : public ui::EventHandler {};

// A fake handler, which just stores the hittest and pointer location values.
class FakeWmMoveResizeHandler : public ui::WmMoveResizeHandler {};

void SetExpectationBasedOnHittestValue(
    int hittest,
    const FakeWmMoveResizeHandler& handler,
    const gfx::Point& pointer_location_in_px) {}

// This is used to return a customized result to NonClientHitTest.
class HitTestNonClientFrameView : public NativeFrameView {};

// This is used to return HitTestNonClientFrameView on create call.
class HitTestWidgetDelegate : public WidgetDelegate {};

// Test host that can intercept calls to the real host.
class TestDesktopWindowTreeHostPlatformImpl
    : public DesktopWindowTreeHostPlatformImpl {};

}  // namespace

class DesktopWindowTreeHostPlatformImplTest
    : public test::DesktopWidgetTestInteractive,
      public views::WidgetObserver {};

// These tests are run using either click or touch events.
class DesktopWindowTreeHostPlatformImplTestWithTouch
    : public DesktopWindowTreeHostPlatformImplTest,
      public testing::WithParamInterface<bool> {};

// On Lacros, the resize and drag operations are handled by compositor,
// so this test does not make much sense.
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_HitTest
#else
#define MAYBE_HitTest
#endif
TEST_P(DesktopWindowTreeHostPlatformImplTestWithTouch, MAYBE_HitTest) {}

// Tests that the window is maximized in response to a double click event.
TEST_P(DesktopWindowTreeHostPlatformImplTestWithTouch,
       DoubleClickHeaderMaximizes) {}

// Tests that the window does not maximize in response to a double click event,
// if the first click was to a different target component than that of the
// second click.
TEST_P(DesktopWindowTreeHostPlatformImplTestWithTouch,
       DoubleClickTwoDifferentTargetsDoesntMaximizes) {}

// Tests that the window does not maximize in response to a double click event,
// if the double click was interrupted by a right click.
TEST_F(DesktopWindowTreeHostPlatformImplTest,
       RightClickDuringDoubleClickDoesntMaximize) {}

// Test that calling Widget::Deactivate() sets the widget as inactive wrt to
// Chrome even if it not possible to deactivate the window wrt to the x server.
// This behavior is required by several interactive_ui_tests.
TEST_F(DesktopWindowTreeHostPlatformImplTest, Deactivate) {}

// Chrome attempts to make mouse capture look synchronous on Linux. Test that
// Chrome synchronously switches the window that mouse events are forwarded to
// when capture is changed.
TEST_F(DesktopWindowTreeHostPlatformImplTest, CaptureEventForwarding) {}

TEST_F(DesktopWindowTreeHostPlatformImplTest, InputMethodFocus) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace views