| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ |
| 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/views/controls/textfield/textfield.h" | 9 #include "ui/views/controls/textfield/textfield.h" |
| 10 | 10 |
| 11 namespace views { | 11 namespace views { |
| 12 | 12 |
| 13 // Helper class to access internal state of Textfield in tests. | 13 // Helper class to access internal state of Textfield in tests. |
| 14 class TextfieldTestApi { | 14 class TextfieldTestApi { |
| 15 public: | 15 public: |
| 16 explicit TextfieldTestApi(Textfield* textfield); | 16 explicit TextfieldTestApi(Textfield* textfield); |
| 17 | 17 |
| 18 void UpdateContextMenu(); | 18 void UpdateContextMenu(); |
| 19 | 19 |
| 20 gfx::RenderText* GetRenderText() const; | 20 gfx::RenderText* GetRenderText() const; |
| 21 | 21 |
| 22 void CreateTouchSelectionControllerAndNotifyIt(); | 22 void CreateTouchSelectionControllerAndNotifyIt(); |
| 23 | 23 |
| 24 void ResetTouchSelectionController(); | 24 void ResetTouchSelectionController(); |
| 25 | 25 |
| 26 TextfieldModel* model() const { return textfield_->model_.get(); } | 26 TextfieldModel* model() const { return textfield_->model_.get(); } |
| 27 | 27 |
| 28 void ExecuteTextEditCommand(ui::TextEditCommand command) { |
| 29 textfield_->ExecuteTextEditCommand(command); |
| 30 } |
| 31 |
| 28 ui::MenuModel* context_menu_contents() const { | 32 ui::MenuModel* context_menu_contents() const { |
| 29 return textfield_->context_menu_contents_.get(); | 33 return textfield_->context_menu_contents_.get(); |
| 30 } | 34 } |
| 31 | 35 |
| 32 ui::TouchEditingControllerDeprecated* touch_selection_controller() const { | 36 ui::TouchEditingControllerDeprecated* touch_selection_controller() const { |
| 33 return textfield_->touch_selection_controller_.get(); | 37 return textfield_->touch_selection_controller_.get(); |
| 34 } | 38 } |
| 35 | 39 |
| 36 private: | 40 private: |
| 37 Textfield* textfield_; | 41 Textfield* textfield_; |
| 38 | 42 |
| 39 DISALLOW_COPY_AND_ASSIGN(TextfieldTestApi); | 43 DISALLOW_COPY_AND_ASSIGN(TextfieldTestApi); |
| 40 }; | 44 }; |
| 41 | 45 |
| 42 } // namespace views | 46 } // namespace views |
| 43 | 47 |
| 44 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ | 48 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ |
| OLD | NEW |