Chromium Code Reviews| OLD | NEW |
|---|---|
| 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) | |
|
sky
2014/06/18 17:12:48
no indentation of nested ifdefs.
tapted
2014/06/19 02:00:13
Done.
| |
| 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 Loading... | |
| 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 // Simulate a OS-level destruction of the native widget held by |widget|. | |
| 91 static void SimulateNativeDestroy(Widget* widget); | |
| 92 | |
| 93 // Return true if |window| is visible according to the native platform. | |
| 94 static bool IsNativeWindowVisible(gfx::NativeWindow window); | |
| 95 | |
| 96 // Return the event processor for |widget|. On aura platforms, this is an | |
| 97 // aura::WindowEventDispatcher. Otherwise, it is a bridge to the OS event | |
| 98 // processor. | |
| 99 static ui::EventProcessor* GetEventProcessor(Widget* widget); | |
| 100 | |
| 68 private: | 101 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(WidgetTest); | 102 DISALLOW_COPY_AND_ASSIGN(WidgetTest); |
| 70 }; | 103 }; |
| 71 | 104 |
| 72 } // namespace test | 105 } // namespace test |
| 73 } // namespace views | 106 } // namespace views |
| 74 | 107 |
| 75 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_ | 108 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_ |
| OLD | NEW |