OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 void SendKeyEvent(ui::KeyboardCode key_code) { | 213 void SendKeyEvent(ui::KeyboardCode key_code) { |
214 SendKeyEvent(key_code, false, false); | 214 SendKeyEvent(key_code, false, false); |
215 } | 215 } |
216 | 216 |
217 View* GetFocusedView() { | 217 View* GetFocusedView() { |
218 return widget_->GetFocusManager()->GetFocusedView(); | 218 return widget_->GetFocusManager()->GetFocusedView(); |
219 } | 219 } |
220 | 220 |
221 int GetCursorPositionX(int cursor_pos) { | 221 int GetCursorPositionX(int cursor_pos) { |
222 gfx::RenderText* render_text = textfield_view_->GetRenderText(); | 222 gfx::RenderText* render_text = textfield_view_->GetRenderText(); |
223 return render_text->GetCursorBounds(cursor_pos, false).x(); | 223 return render_text->GetCursorBounds( |
| 224 gfx::SelectionModel(cursor_pos), false).x(); |
224 } | 225 } |
225 | 226 |
226 // We need widget to populate wrapper class. | 227 // We need widget to populate wrapper class. |
227 Widget* widget_; | 228 Widget* widget_; |
228 | 229 |
229 TestTextfield* textfield_; | 230 TestTextfield* textfield_; |
230 NativeTextfieldViews* textfield_view_; | 231 NativeTextfieldViews* textfield_view_; |
231 TextfieldViewsModel* model_; | 232 TextfieldViewsModel* model_; |
232 | 233 |
233 // The string from Controller::ContentsChanged callback. | 234 // The string from Controller::ContentsChanged callback. |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 EXPECT_STR_EQ("a23", textfield_->text()); | 1078 EXPECT_STR_EQ("a23", textfield_->text()); |
1078 SendKeyEvent(ui::VKEY_B); | 1079 SendKeyEvent(ui::VKEY_B); |
1079 EXPECT_STR_EQ("ab3", textfield_->text()); | 1080 EXPECT_STR_EQ("ab3", textfield_->text()); |
1080 SendKeyEvent(ui::VKEY_Z, false, true); | 1081 SendKeyEvent(ui::VKEY_Z, false, true); |
1081 EXPECT_STR_EQ("123", textfield_->text()); | 1082 EXPECT_STR_EQ("123", textfield_->text()); |
1082 SendKeyEvent(ui::VKEY_Y, false, true); | 1083 SendKeyEvent(ui::VKEY_Y, false, true); |
1083 EXPECT_STR_EQ("ab3", textfield_->text()); | 1084 EXPECT_STR_EQ("ab3", textfield_->text()); |
1084 } | 1085 } |
1085 | 1086 |
1086 } // namespace views | 1087 } // namespace views |
OLD | NEW |