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 3 // found in the LICENSE file. 4 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ 7 8 #include "ui/views/controls/textfield/textfield.h" 9 10 namespace views { 11 12 // Helper class to access internal state of Textfield in tests. 13 class TextfieldTestApi { 14 public: 15 explicit TextfieldTestApi(Textfield* textfield); 16 17 void UpdateContextMenu(); 18 19 gfx::RenderText* GetRenderText() const; 20 21 void CreateTouchSelectionControllerAndNotifyIt(); 22 23 void ResetTouchSelectionController(); 24 25 TextfieldModel* model() const { return textfield_->model_.get(); } 26 27 ui::MenuModel* context_menu_contents() const { 28 return textfield_->context_menu_contents_.get(); 29 } 30 31 ui::TouchSelectionController* touch_selection_controller() const { 32 return textfield_->touch_selection_controller_.get(); 33 } 34 35 private: 36 Textfield* textfield_; 37 38 DISALLOW_COPY_AND_ASSIGN(TextfieldTestApi); 39 }; 40 41 } // namespace views 42 43 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_ 44