OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 }; | 120 }; |
121 | 121 |
122 // A view that does a capture on gesture-begin events. | 122 // A view that does a capture on gesture-begin events. |
123 class GestureCaptureView : public View { | 123 class GestureCaptureView : public View { |
124 public: | 124 public: |
125 GestureCaptureView() {} | 125 GestureCaptureView() {} |
126 virtual ~GestureCaptureView() {} | 126 virtual ~GestureCaptureView() {} |
127 | 127 |
128 private: | 128 private: |
129 // Overridden from View: | 129 // Overridden from View: |
130 virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE { | 130 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { |
131 if (event->type() == ui::ET_GESTURE_BEGIN) { | 131 if (event->type() == ui::ET_GESTURE_BEGIN) { |
132 GetWidget()->SetCapture(this); | 132 GetWidget()->SetCapture(this); |
133 return ui::ER_CONSUMED; | 133 event->StopPropagation(); |
134 } | 134 } |
135 return ui::ER_UNHANDLED; | |
136 } | 135 } |
137 | 136 |
138 DISALLOW_COPY_AND_ASSIGN(GestureCaptureView); | 137 DISALLOW_COPY_AND_ASSIGN(GestureCaptureView); |
139 }; | 138 }; |
140 | 139 |
141 typedef ViewsTestBase WidgetTest; | 140 typedef ViewsTestBase WidgetTest; |
142 | 141 |
143 NativeWidget* CreatePlatformNativeWidget( | 142 NativeWidget* CreatePlatformNativeWidget( |
144 internal::NativeWidgetDelegate* delegate) { | 143 internal::NativeWidgetDelegate* delegate) { |
145 return new NativeWidgetPlatformForTest(delegate); | 144 return new NativeWidgetPlatformForTest(delegate); |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 EXPECT_TRUE(toplevel->OnKeyEvent(backspace_p)); | 996 EXPECT_TRUE(toplevel->OnKeyEvent(backspace_p)); |
998 ui::KeyEvent backspace_r(ui::ET_KEY_RELEASED, ui::VKEY_DELETE, 0, false); | 997 ui::KeyEvent backspace_r(ui::ET_KEY_RELEASED, ui::VKEY_DELETE, 0, false); |
999 EXPECT_FALSE(toplevel->OnKeyEvent(backspace_r)); | 998 EXPECT_FALSE(toplevel->OnKeyEvent(backspace_r)); |
1000 | 999 |
1001 toplevel->Close(); | 1000 toplevel->Close(); |
1002 } | 1001 } |
1003 #endif // defined(USE_AURA) | 1002 #endif // defined(USE_AURA) |
1004 | 1003 |
1005 } // namespace | 1004 } // namespace |
1006 } // namespace views | 1005 } // namespace views |
OLD | NEW |