1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file.
4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_
6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_
7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ui/views/controls/textfield/textfield.h"
9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace views {
11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Helper class to access internal state of Textfield in tests.
13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class TextfieldTestApi {
14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) public:
15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  explicit TextfieldTestApi(Textfield* textfield);
16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void UpdateContextMenu();
18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  gfx::RenderText* GetRenderText() const;
20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void CreateTouchSelectionControllerAndNotifyIt();
22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void ResetTouchSelectionController();
24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  TextfieldModel* model() const { return textfield_->model_.get(); }
26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  ui::MenuModel* context_menu_contents() const {
28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    return textfield_->context_menu_contents_.get();
29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  }
30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  ui::TouchSelectionController* touch_selection_controller() const {
32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    return textfield_->touch_selection_controller_.get();
33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  }
34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) private:
36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  Textfield* textfield_;
37cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
38cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(TextfieldTestApi);
39cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)};
40cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
41cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}  // namespace views
42cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
43cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#endif  // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_TEST_API_H_
44