OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "ui/events/event_processor.h" | 23 #include "ui/events/event_processor.h" |
24 #include "ui/events/event_utils.h" | 24 #include "ui/events/event_utils.h" |
25 #include "ui/events/test/event_generator.h" | 25 #include "ui/events/test/event_generator.h" |
26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
27 #include "ui/gl/test/gl_surface_test_support.h" | 27 #include "ui/gl/test/gl_surface_test_support.h" |
28 #include "ui/views/controls/textfield/textfield.h" | 28 #include "ui/views/controls/textfield/textfield.h" |
29 #include "ui/views/controls/textfield/textfield_test_api.h" | 29 #include "ui/views/controls/textfield/textfield_test_api.h" |
30 #include "ui/views/focus/focus_manager.h" | 30 #include "ui/views/focus/focus_manager.h" |
31 #include "ui/views/test/focus_manager_test.h" | 31 #include "ui/views/test/focus_manager_test.h" |
32 #include "ui/views/test/native_widget_factory.h" | 32 #include "ui/views/test/native_widget_factory.h" |
| 33 #include "ui/views/test/views_interactive_ui_test_base.h" |
33 #include "ui/views/test/widget_test.h" | 34 #include "ui/views/test/widget_test.h" |
34 #include "ui/views/touchui/touch_selection_controller_impl.h" | 35 #include "ui/views/touchui/touch_selection_controller_impl.h" |
35 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
36 #include "ui/views/window/dialog_delegate.h" | 37 #include "ui/views/window/dialog_delegate.h" |
37 #include "ui/wm/public/activation_client.h" | 38 #include "ui/wm/public/activation_client.h" |
38 | 39 |
39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
40 #include "ui/aura/window.h" | 41 #include "ui/aura/window.h" |
41 #include "ui/aura/window_tree_host.h" | 42 #include "ui/aura/window_tree_host.h" |
42 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 43 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 | 1256 |
1256 private: | 1257 private: |
1257 // Weak. Stores whether OnMouseCaptureLost has been invoked for this widget. | 1258 // Weak. Stores whether OnMouseCaptureLost has been invoked for this widget. |
1258 CaptureLostState* capture_lost_state_; | 1259 CaptureLostState* capture_lost_state_; |
1259 | 1260 |
1260 DISALLOW_COPY_AND_ASSIGN(CaptureLostTrackingWidget); | 1261 DISALLOW_COPY_AND_ASSIGN(CaptureLostTrackingWidget); |
1261 }; | 1262 }; |
1262 | 1263 |
1263 } // namespace | 1264 } // namespace |
1264 | 1265 |
1265 class WidgetCaptureTest : public ViewsTestBase { | 1266 class WidgetCaptureTest : public ViewsInteractiveUITestBase { |
1266 public: | 1267 public: |
1267 WidgetCaptureTest() { | 1268 WidgetCaptureTest() { |
1268 } | 1269 } |
1269 | 1270 |
1270 ~WidgetCaptureTest() override {} | 1271 ~WidgetCaptureTest() override {} |
1271 | 1272 |
1272 void SetUp() override { | 1273 void SetUp() override { |
1273 // On mus these tests run as part of views::ViewsTestSuite which already | 1274 // On mus these tests run as part of views::ViewsTestSuite which already |
1274 // does this initialization. | 1275 // does this initialization. |
1275 if (!IsMus()) { | 1276 if (!IsMus()) |
1276 gl::GLSurfaceTestSupport::InitializeOneOff(); | 1277 ViewsInteractiveUITestBase::SetUp(); |
1277 ui::RegisterPathProvider(); | 1278 else |
1278 base::FilePath ui_test_pak_path; | 1279 ViewsTestBase::SetUp(); |
1279 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | |
1280 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | |
1281 } | |
1282 ViewsTestBase::SetUp(); | |
1283 } | 1280 } |
1284 | 1281 |
1285 // Verifies Widget::SetCapture() results in updating native capture along with | 1282 // Verifies Widget::SetCapture() results in updating native capture along with |
1286 // invoking the right Widget function. | 1283 // invoking the right Widget function. |
1287 void TestCapture(bool use_desktop_native_widget) { | 1284 void TestCapture(bool use_desktop_native_widget) { |
1288 CaptureLostState capture_state1; | 1285 CaptureLostState capture_state1; |
1289 CaptureLostTrackingWidget widget1(&capture_state1); | 1286 CaptureLostTrackingWidget widget1(&capture_state1); |
1290 Widget::InitParams params1 = | 1287 Widget::InitParams params1 = |
1291 CreateParams(views::Widget::InitParams::TYPE_WINDOW); | 1288 CreateParams(views::Widget::InitParams::TYPE_WINDOW); |
1292 params1.native_widget = | 1289 params1.native_widget = |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 | 1813 |
1817 ui::KeyEvent key_event2(key_event); | 1814 ui::KeyEvent key_event2(key_event); |
1818 widget->OnKeyEvent(&key_event2); | 1815 widget->OnKeyEvent(&key_event2); |
1819 EXPECT_FALSE(key_event2.stopped_propagation()); | 1816 EXPECT_FALSE(key_event2.stopped_propagation()); |
1820 | 1817 |
1821 widget->CloseNow(); | 1818 widget->CloseNow(); |
1822 } | 1819 } |
1823 | 1820 |
1824 } // namespace test | 1821 } // namespace test |
1825 } // namespace views | 1822 } // namespace views |
OLD | NEW |