1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_TEST_WIDGET_TEST_H_
6 #define UI_VIEWS_TEST_WIDGET_TEST_H_
8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/views/test/views_test_base.h"
12 #include "ui/views/widget/native_widget_aura.h"
14 #include "ui/views/widget/native_widget_win.h"
26 } // namespace internal
31 // A typedef that inserts our mock-capture NativeWidget implementation for
32 // relevant platforms.
33 typedef NativeWidgetAura NativeWidgetPlatform;
35 // A widget that assumes mouse capture always works. It won't on Aura in
36 // testing, so we mock it.
37 class NativeWidgetCapture : public NativeWidgetPlatform {
39 explicit NativeWidgetCapture(internal::NativeWidgetDelegate* delegate);
40 virtual ~NativeWidgetCapture();
42 virtual void SetCapture() OVERRIDE;
43 virtual void ReleaseCapture() OVERRIDE;
44 virtual bool HasCapture() const OVERRIDE;
49 DISALLOW_COPY_AND_ASSIGN(NativeWidgetCapture);
52 // A generic typedef to pick up relevant NativeWidget implementations.
53 typedef NativeWidgetCapture NativeWidgetPlatformForTest;
55 typedef NativeWidgetWin NativeWidgetPlatform;
56 typedef NativeWidgetWin NativeWidgetPlatformForTest;
59 class WidgetTest : public ViewsTestBase {
62 virtual ~WidgetTest();
64 NativeWidget* CreatePlatformNativeWidget(
65 internal::NativeWidgetDelegate* delegate);
67 Widget* CreateTopLevelPlatformWidget();
69 Widget* CreateTopLevelFramelessPlatformWidget();
71 Widget* CreateChildPlatformWidget(gfx::NativeView parent_native_view);
73 #if defined(OS_WIN) && !defined(USE_AURA)
74 // On Windows, it is possible for us to have a child window that is
76 Widget* CreateChildPopupPlatformWidget(gfx::NativeView parent_native_view);
79 Widget* CreateTopLevelNativeWidget();
81 Widget* CreateChildNativeWidgetWithParent(Widget* parent);
83 Widget* CreateChildNativeWidget();
85 View* GetMousePressedHandler(internal::RootView* root_view);
87 View* GetMouseMoveHandler(internal::RootView* root_view);
89 View* GetGestureHandler(internal::RootView* root_view);
92 DISALLOW_COPY_AND_ASSIGN(WidgetTest);
98 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_