Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Side by Side Diff: ui/views/test/widget_test.h

Issue 322893005: MacViews: Add WidgetEventGenerator to abstract platform-specific event generation for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cull orthogonal stuff, add WidgetTest.MouseEventTypesViaGenerator Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_TEST_WIDGET_TEST_H_ 5 #ifndef UI_VIEWS_TEST_WIDGET_TEST_H_
6 #define UI_VIEWS_TEST_WIDGET_TEST_H_ 6 #define UI_VIEWS_TEST_WIDGET_TEST_H_
7 7
8 #include "ui/gfx/native_widget_types.h" 8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/views/test/views_test_base.h" 9 #include "ui/views/test/views_test_base.h"
10
11 #if defined(USE_AURA)
10 #include "ui/views/widget/native_widget_aura.h" 12 #include "ui/views/widget/native_widget_aura.h"
13 # if !defined(OS_CHROMEOS)
14 # include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
15 # endif
16 #elif defined(OS_MACOSX)
17 #include "ui/views/widget/native_widget_mac.h"
18 #endif
19
20 namespace ui {
21 class EventProcessor;
22 }
11 23
12 namespace views { 24 namespace views {
13 25
14 class NativeWidget; 26 class NativeWidget;
15 class Widget; 27 class Widget;
16 28
29 #if defined(USE_AURA)
30 typedef NativeWidgetAura PlatformNativeWidget;
31 # if !defined(OS_CHROMEOS)
32 typedef DesktopNativeWidgetAura PlatformDesktopNativeWidget;
33 # endif
34 #elif defined(OS_MACOSX)
35 typedef NativeWidgetMac PlatformNativeWidget;
36 typedef NativeWidgetMac PlatformDesktopNativeWidget;
37 #endif
38
17 namespace internal { 39 namespace internal {
18 40
19 class RootView; 41 class RootView;
20 42
21 } // namespace internal 43 } // namespace internal
22 44
23 namespace test { 45 namespace test {
24 46
25 // A widget that assumes mouse capture always works. It won't on Aura in 47 // A widget that assumes mouse capture always works. It won't on Aura in
26 // testing, so we mock it. 48 // testing, so we mock it.
27 class NativeWidgetCapture : public NativeWidgetAura { 49 class NativeWidgetCapture : public PlatformNativeWidget {
28 public: 50 public:
29 explicit NativeWidgetCapture(internal::NativeWidgetDelegate* delegate); 51 explicit NativeWidgetCapture(internal::NativeWidgetDelegate* delegate);
30 virtual ~NativeWidgetCapture(); 52 virtual ~NativeWidgetCapture();
31 53
32 virtual void SetCapture() OVERRIDE; 54 virtual void SetCapture() OVERRIDE;
33 virtual void ReleaseCapture() OVERRIDE; 55 virtual void ReleaseCapture() OVERRIDE;
34 virtual bool HasCapture() const OVERRIDE; 56 virtual bool HasCapture() const OVERRIDE;
35 57
36 private: 58 private:
37 bool mouse_capture_; 59 bool mouse_capture_;
(...skipping 20 matching lines...) Expand all
58 Widget* CreateChildNativeWidgetWithParent(Widget* parent); 80 Widget* CreateChildNativeWidgetWithParent(Widget* parent);
59 81
60 Widget* CreateChildNativeWidget(); 82 Widget* CreateChildNativeWidget();
61 83
62 View* GetMousePressedHandler(internal::RootView* root_view); 84 View* GetMousePressedHandler(internal::RootView* root_view);
63 85
64 View* GetMouseMoveHandler(internal::RootView* root_view); 86 View* GetMouseMoveHandler(internal::RootView* root_view);
65 87
66 View* GetGestureHandler(internal::RootView* root_view); 88 View* GetGestureHandler(internal::RootView* root_view);
67 89
90 // Return true if |window| is visible according to the native platform.
91 static bool IsNativeWindowVisible(gfx::NativeWindow window);
92
93 // Return the event processor for |widget|. On aura platforms, this is an
94 // aura::WindowEventDispatcher. Otherwise, it is a bridge to the OS event
95 // processor.
96 static ui::EventProcessor* GetEventProcessor(Widget* widget);
97
68 private: 98 private:
69 DISALLOW_COPY_AND_ASSIGN(WidgetTest); 99 DISALLOW_COPY_AND_ASSIGN(WidgetTest);
70 }; 100 };
71 101
72 } // namespace test 102 } // namespace test
73 } // namespace views 103 } // namespace views
74 104
75 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_ 105 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698