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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
11 #include "ui/aura/test/test_cursor_client.h" | 11 #include "ui/aura/test/test_cursor_client.h" |
12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_event_dispatcher.h" |
| 14 #include "ui/aura/window_tree_host.h" |
13 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/base/touch/touch_editing_controller.h" | 16 #include "ui/base/touch/touch_editing_controller.h" |
15 #include "ui/base/ui_base_switches.h" | 17 #include "ui/base/ui_base_switches.h" |
16 #include "ui/events/event_utils.h" | 18 #include "ui/events/event_utils.h" |
17 #include "ui/events/test/event_generator.h" | 19 #include "ui/events/test/event_generator.h" |
18 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
19 #include "ui/gfx/geometry/point.h" | 21 #include "ui/gfx/geometry/point.h" |
20 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
21 #include "ui/gfx/render_text.h" | 23 #include "ui/gfx/render_text.h" |
22 #include "ui/resources/grit/ui_resources.h" | 24 #include "ui/resources/grit/ui_resources.h" |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 EXPECT_FALSE(IsCursorHandleVisibleFor(touch_selection_controller.get())); | 789 EXPECT_FALSE(IsCursorHandleVisibleFor(touch_selection_controller.get())); |
788 | 790 |
789 touch_selection_controller.reset(); | 791 touch_selection_controller.reset(); |
790 } | 792 } |
791 | 793 |
792 TEST_F(TouchSelectionControllerImplTest, HandlesStackAboveParent) { | 794 TEST_F(TouchSelectionControllerImplTest, HandlesStackAboveParent) { |
793 // TODO: see comment in SetUp(). | 795 // TODO: see comment in SetUp(). |
794 if (IsMus()) | 796 if (IsMus()) |
795 return; | 797 return; |
796 | 798 |
797 ui::EventTarget* root = GetContext(); | 799 aura::Window* root = GetContext(); |
798 ui::EventTargeter* targeter = root->GetEventTargeter(); | 800 ui::EventTargeter* targeter = |
| 801 root->GetHost()->dispatcher()->GetDefaultEventTargeter(); |
799 | 802 |
800 // Create the first window containing a Views::Textfield. | 803 // Create the first window containing a Views::Textfield. |
801 CreateTextfield(); | 804 CreateTextfield(); |
802 aura::Window* window1 = textfield_widget_->GetNativeView(); | 805 aura::Window* window1 = textfield_widget_->GetNativeView(); |
803 | 806 |
804 // Start touch editing, check that the handle is above the first window, and | 807 // Start touch editing, check that the handle is above the first window, and |
805 // end touch editing. | 808 // end touch editing. |
806 StartTouchEditing(); | 809 StartTouchEditing(); |
807 gfx::Point test_point = GetCursorHandleDragPoint(); | 810 gfx::Point test_point = GetCursorHandleDragPoint(); |
808 ui::MouseEvent test_event1(ui::ET_MOUSE_MOVED, test_point, test_point, | 811 ui::MouseEvent test_event1(ui::ET_MOUSE_MOVED, test_point, test_point, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 // Start touch editing; then press a key and ensure it deactivates touch | 918 // Start touch editing; then press a key and ensure it deactivates touch |
916 // selection. | 919 // selection. |
917 StartTouchEditing(); | 920 StartTouchEditing(); |
918 EXPECT_TRUE(GetSelectionController()); | 921 EXPECT_TRUE(GetSelectionController()); |
919 generator.PressKey(ui::VKEY_A, 0); | 922 generator.PressKey(ui::VKEY_A, 0); |
920 RunPendingMessages(); | 923 RunPendingMessages(); |
921 EXPECT_FALSE(GetSelectionController()); | 924 EXPECT_FALSE(GetSelectionController()); |
922 } | 925 } |
923 | 926 |
924 } // namespace views | 927 } // namespace views |
OLD | NEW |