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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
9 #include "ui/base/touch/touch_editing_controller.h" | 9 #include "ui/base/touch/touch_editing_controller.h" |
10 #include "ui/base/ui_base_switches.h" | 10 #include "ui/base/ui_base_switches.h" |
11 #include "ui/gfx/point.h" | 11 #include "ui/gfx/point.h" |
12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
13 #include "ui/gfx/render_text.h" | 13 #include "ui/gfx/render_text.h" |
14 #include "ui/views/controls/textfield/native_textfield_views.h" | 14 #include "ui/views/controls/textfield/native_textfield_views.h" |
15 #include "ui/views/controls/textfield/textfield.h" | 15 #include "ui/views/controls/textfield/textfield.h" |
16 #include "ui/views/test/views_test_base.h" | 16 #include "ui/views/test/views_test_base.h" |
17 #include "ui/views/touchui/touch_selection_controller_impl.h" | 17 #include "ui/views/touchui/touch_selection_controller_impl.h" |
18 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
19 | 19 |
20 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
21 #include "ui/aura/test/event_generator.h" | 21 #include "ui/aura/test/event_generator.h" |
22 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
23 #endif | 23 #endif |
24 | 24 |
25 using base::ASCIIToUTF16; | 25 using base::ASCIIToUTF16; |
26 using base::UTF16ToUTF8; | 26 using base::UTF16ToUTF8; |
| 27 using base::WideToUTF16; |
27 | 28 |
28 namespace { | 29 namespace { |
29 // Should match kSelectionHandlePadding in touch_selection_controller. | 30 // Should match kSelectionHandlePadding in touch_selection_controller. |
30 const int kPadding = 10; | 31 const int kPadding = 10; |
31 | 32 |
32 gfx::Image* GetHandleImage() { | 33 gfx::Image* GetHandleImage() { |
33 static gfx::Image* handle_image = NULL; | 34 static gfx::Image* handle_image = NULL; |
34 if (!handle_image) { | 35 if (!handle_image) { |
35 handle_image = &ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 36 handle_image = &ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
36 IDR_TEXT_SELECTION_HANDLE); | 37 IDR_TEXT_SELECTION_HANDLE); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 gfx::Point cursor_pos = GetCursorHandlePosition(); | 491 gfx::Point cursor_pos = GetCursorHandlePosition(); |
491 cursor_pos.Offset(GetHandleImageSize().width() / 2 + kPadding, 0); | 492 cursor_pos.Offset(GetHandleImageSize().width() / 2 + kPadding, 0); |
492 generator.GestureTapAt(cursor_pos); | 493 generator.GestureTapAt(cursor_pos); |
493 generator.GestureTapAt(cursor_pos); | 494 generator.GestureTapAt(cursor_pos); |
494 EXPECT_TRUE(textfield_->HasSelection()); | 495 EXPECT_TRUE(textfield_->HasSelection()); |
495 VERIFY_HANDLE_POSITIONS(false); | 496 VERIFY_HANDLE_POSITIONS(false); |
496 } | 497 } |
497 #endif | 498 #endif |
498 | 499 |
499 } // namespace views | 500 } // namespace views |
OLD | NEW |