#include "ui/views/test/widget_test.h"
#include "base/rand_util.h"
#include "base/test/bind.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/test/native_widget_factory.h"
#include "ui/views/widget/root_view.h"
#if BUILDFLAG(IS_MAC)
#include "base/test/scoped_run_loop_timeout.h"
#include "base/test/test_timeouts.h"
#endif
#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || \
BUILDFLAG(IS_CHROMEOS_LACROS)
#include "ui/views/test/test_desktop_screen_ozone.h"
#elif BUILDFLAG(IS_WIN)
#include "ui/views/widget/desktop_aura/desktop_screen_win.h"
#endif
namespace views::test {
namespace {
View::Views ShuffledChildren(View* view) { … }
}
View* AnyViewMatchingPredicate(View* view, const ViewPredicate& predicate) { … }
View* AnyViewMatchingPredicate(Widget* widget, const ViewPredicate& predicate) { … }
View* AnyViewWithClassName(Widget* widget, const std::string& classname) { … }
WidgetTest::WidgetTest() = default;
WidgetTest::WidgetTest(
std::unique_ptr<base::test::TaskEnvironment> task_environment)
: … { … }
WidgetTest::~WidgetTest() = default;
Widget* WidgetTest::CreateTopLevelPlatformWidget(
Widget::InitParams::Ownership ownership) { … }
#if BUILDFLAG(ENABLE_DESKTOP_AURA)
Widget* WidgetTest::CreateTopLevelPlatformDesktopWidget(
Widget::InitParams::Ownership ownership) { … }
#endif
Widget* WidgetTest::CreateTopLevelFramelessPlatformWidget(
Widget::InitParams::Ownership ownership) { … }
Widget* WidgetTest::CreateChildPlatformWidget(
gfx::NativeView parent_native_view,
Widget::InitParams::Ownership ownership) { … }
Widget* WidgetTest::CreateTopLevelNativeWidget(
Widget::InitParams::Ownership ownership) { … }
Widget* WidgetTest::CreateChildNativeWidgetWithParent(
Widget* parent,
Widget::InitParams::Ownership ownership) { … }
View* WidgetTest::GetMousePressedHandler(views::internal::RootView* root_view) { … }
View* WidgetTest::GetMouseMoveHandler(views::internal::RootView* root_view) { … }
View* WidgetTest::GetGestureHandler(views::internal::RootView* root_view) { … }
DesktopWidgetTest::DesktopWidgetTest() = default;
DesktopWidgetTest::~DesktopWidgetTest() = default;
void DesktopWidgetTest::SetUp() { … }
DesktopWidgetTestInteractive::DesktopWidgetTestInteractive() = default;
DesktopWidgetTestInteractive::~DesktopWidgetTestInteractive() = default;
void DesktopWidgetTestInteractive::SetUp() { … }
#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || \
BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN)
void DesktopWidgetTestInteractive::TearDown() { … }
#endif
TestDesktopWidgetDelegate::TestDesktopWidgetDelegate()
: … { … }
TestDesktopWidgetDelegate::TestDesktopWidgetDelegate(Widget* widget)
: … { … }
TestDesktopWidgetDelegate::~TestDesktopWidgetDelegate() { … }
void TestDesktopWidgetDelegate::InitWidget(Widget::InitParams init_params) { … }
void TestDesktopWidgetDelegate::WindowClosing() { … }
Widget* TestDesktopWidgetDelegate::GetWidget() { … }
const Widget* TestDesktopWidgetDelegate::GetWidget() const { … }
View* TestDesktopWidgetDelegate::GetContentsView() { … }
bool TestDesktopWidgetDelegate::OnCloseRequested(
Widget::ClosedReason close_reason) { … }
TestInitialFocusWidgetDelegate::TestInitialFocusWidgetDelegate(
gfx::NativeWindow context)
: … { … }
TestInitialFocusWidgetDelegate::~TestInitialFocusWidgetDelegate() = default;
View* TestInitialFocusWidgetDelegate::GetInitiallyFocusedView() { … }
WidgetDestroyedWaiter::WidgetDestroyedWaiter(Widget* widget) { … }
WidgetDestroyedWaiter::~WidgetDestroyedWaiter() = default;
void WidgetDestroyedWaiter::Wait() { … }
void WidgetDestroyedWaiter::OnWidgetDestroyed(Widget* widget) { … }
WidgetVisibleWaiter::WidgetVisibleWaiter(Widget* widget) { … }
WidgetVisibleWaiter::~WidgetVisibleWaiter() = default;
void WidgetVisibleWaiter::Wait() { … }
void WidgetVisibleWaiter::OnWidgetVisibilityChanged(Widget* widget,
bool visible) { … }
void WidgetVisibleWaiter::OnWidgetDestroying(Widget* widget) { … }
}