summaryrefslogtreecommitdiffstats
path: root/ui/views/touchui/touch_selection_controller_impl_unittest.cc
diff options
context:
space:
mode:
authormohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-23 18:49:47 +0000
committermohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-23 18:49:47 +0000
commita78f5aaee502b6f0622a5a2b61b5cfadce9d05f0 (patch)
tree4ec40595b5d42aaeb4f0c103e748cdf8435bed9b /ui/views/touchui/touch_selection_controller_impl_unittest.cc
parente303a98e12dfb03b3eb0a54d00c8ab8093bf023d (diff)
downloadchromium_src-a78f5aaee502b6f0622a5a2b61b5cfadce9d05f0.zip
chromium_src-a78f5aaee502b6f0622a5a2b61b5cfadce9d05f0.tar.gz
chromium_src-a78f5aaee502b6f0622a5a2b61b5cfadce9d05f0.tar.bz2
Deactivate omnibox touch editing on command execution
A Views textfield hides touch text selection handles on command execution. Omnibox overrides command execution for some commands without calling textfield's implementation; so, it needs to hide the handles for those commands. Also, introduced TextfieldTestApi class for accessing private members of Textfield class in tests. BUG=373532 Review URL: https://codereview.chromium.org/297733002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272569 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/touchui/touch_selection_controller_impl_unittest.cc')
-rw-r--r--ui/views/touchui/touch_selection_controller_impl_unittest.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
index 07d78c4..83ff9cd 100644
--- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc
+++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
@@ -16,6 +16,7 @@
#include "ui/gfx/rect.h"
#include "ui/gfx/render_text.h"
#include "ui/views/controls/textfield/textfield.h"
+#include "ui/views/controls/textfield/textfield_test_api.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/touchui/touch_selection_controller_impl.h"
#include "ui/views/views_touch_selection_controller_factory.h"
@@ -97,6 +98,8 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
textfield_widget_->Show();
textfield_->RequestFocus();
+
+ textfield_test_api_.reset(new TextfieldTestApi(textfield_));
}
void CreateWidget() {
@@ -116,7 +119,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
}
gfx::Rect GetCursorRect(const gfx::SelectionModel& sel) {
- return textfield_->GetRenderText()->GetCursorBounds(sel, true);
+ return textfield_test_api_->GetRenderText()->GetCursorBounds(sel, true);
}
gfx::Point GetCursorPosition(const gfx::SelectionModel& sel) {
@@ -126,15 +129,15 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
TouchSelectionControllerImpl* GetSelectionController() {
return static_cast<TouchSelectionControllerImpl*>(
- textfield_->touch_selection_controller_.get());
+ textfield_test_api_->touch_selection_controller());
}
void StartTouchEditing() {
- textfield_->CreateTouchSelectionControllerAndNotifyIt();
+ textfield_test_api_->CreateTouchSelectionControllerAndNotifyIt();
}
void EndTouchEditing() {
- textfield_->touch_selection_controller_.reset();
+ textfield_test_api_->ResetTouchSelectionController();
}
void SimulateSelectionHandleDrag(gfx::Point p, int selection_handle) {
@@ -183,7 +186,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
}
gfx::RenderText* GetRenderText() {
- return textfield_->GetRenderText();
+ return textfield_test_api_->GetRenderText();
}
gfx::Point GetCursorHandleDragPoint() {
@@ -199,6 +202,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
Widget* widget_;
Textfield* textfield_;
+ scoped_ptr<TextfieldTestApi> textfield_test_api_;
scoped_ptr<ViewsTouchSelectionControllerFactory> views_tsc_factory_;
private: