Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/chromeos/input_method/textinput_test_helper.h

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_TEXTINPUT_TEST_HELPER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_TEXTINPUT_TEST_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_TEXTINPUT_TEST_HELPER_H_ 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_TEXTINPUT_TEST_HELPER_H_
7 7
8 #include "chrome/test/base/in_process_browser_test.h" 8 #include "chrome/test/base/in_process_browser_test.h"
9 #include "ui/base/ime/mock_input_method.h" 9 #include "ui/base/ime/mock_input_method.h"
10 #include "ui/base/ime/text_input_client.h" 10 #include "ui/base/ime/text_input_client.h"
11 #include "ui/base/range/range.h" 11 #include "ui/gfx/range/range.h"
12 #include "ui/gfx/rect.h" 12 #include "ui/gfx/rect.h"
13 13
14 namespace content { 14 namespace content {
15 class WebContents; 15 class WebContents;
16 } // namespace content 16 } // namespace content
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 // The base class of text input testing. 20 // The base class of text input testing.
21 class TextInputTestBase : public InProcessBrowserTest { 21 class TextInputTestBase : public InProcessBrowserTest {
22 public: 22 public:
23 TextInputTestBase() {} 23 TextInputTestBase() {}
24 virtual ~TextInputTestBase() {} 24 virtual ~TextInputTestBase() {}
25 25
26 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; 26 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
27 private: 27 private:
28 DISALLOW_COPY_AND_ASSIGN(TextInputTestBase); 28 DISALLOW_COPY_AND_ASSIGN(TextInputTestBase);
29 }; 29 };
30 30
31 // Provides text input test utilities. 31 // Provides text input test utilities.
32 class TextInputTestHelper : public ui::MockInputMethod::Observer { 32 class TextInputTestHelper : public ui::MockInputMethod::Observer {
33 public: 33 public:
34 TextInputTestHelper(); 34 TextInputTestHelper();
35 virtual ~TextInputTestHelper(); 35 virtual ~TextInputTestHelper();
36 36
37 // Returns the latest status notified to ui::InputMethod 37 // Returns the latest status notified to ui::InputMethod
38 string16 GetSurroundingText() const; 38 string16 GetSurroundingText() const;
39 gfx::Rect GetCaretRect() const; 39 gfx::Rect GetCaretRect() const;
40 gfx::Rect GetCompositionHead() const; 40 gfx::Rect GetCompositionHead() const;
41 ui::Range GetSelectionRange() const; 41 gfx::Range GetSelectionRange() const;
42 bool GetFocusState() const; 42 bool GetFocusState() const;
43 ui::TextInputType GetTextInputType() const; 43 ui::TextInputType GetTextInputType() const;
44 44
45 ui::TextInputClient* GetTextInputClient() const; 45 ui::TextInputClient* GetTextInputClient() const;
46 46
47 // Waiting function for each input method events. These functions runs message 47 // Waiting function for each input method events. These functions runs message
48 // loop until the expected event comes. 48 // loop until the expected event comes.
49 void WaitForTextInputStateChanged(ui::TextInputType expected_type); 49 void WaitForTextInputStateChanged(ui::TextInputType expected_type);
50 void WaitForFocus(); 50 void WaitForFocus();
51 void WaitForBlur(); 51 void WaitForBlur();
52 void WaitForCaretBoundsChanged(const gfx::Rect& expected_caret_rect, 52 void WaitForCaretBoundsChanged(const gfx::Rect& expected_caret_rect,
53 const gfx::Rect& expected_composition_head); 53 const gfx::Rect& expected_composition_head);
54 void WaitForSurroundingTextChanged(const string16& expected_text, 54 void WaitForSurroundingTextChanged(const string16& expected_text,
55 const ui::Range& expected_selection); 55 const gfx::Range& expected_selection);
56 56
57 // Converts from string to gfx::Rect. The string should be "x,y,width,height". 57 // Converts from string to gfx::Rect. The string should be "x,y,width,height".
58 // Returns false if the conversion failed. 58 // Returns false if the conversion failed.
59 static bool ConvertRectFromString(const std::string& str, gfx::Rect* rect); 59 static bool ConvertRectFromString(const std::string& str, gfx::Rect* rect);
60 60
61 // Sends mouse clicking event to DOM element which has |id| id. 61 // Sends mouse clicking event to DOM element which has |id| id.
62 static bool ClickElement(const std::string& id, content::WebContents* tab); 62 static bool ClickElement(const std::string& id, content::WebContents* tab);
63 63
64 private: 64 private:
65 enum WaitImeEventType { 65 enum WaitImeEventType {
(...skipping 17 matching lines...) Expand all
83 const ui::TextInputClient* client) OVERRIDE; 83 const ui::TextInputClient* client) OVERRIDE;
84 virtual void OnInputMethodDestroyed( 84 virtual void OnInputMethodDestroyed(
85 const ui::InputMethod* input_method) OVERRIDE; 85 const ui::InputMethod* input_method) OVERRIDE;
86 86
87 // Represents waiting type of text input event. 87 // Represents waiting type of text input event.
88 WaitImeEventType waiting_type_; 88 WaitImeEventType waiting_type_;
89 89
90 string16 surrounding_text_; 90 string16 surrounding_text_;
91 gfx::Rect caret_rect_; 91 gfx::Rect caret_rect_;
92 gfx::Rect composition_head_; 92 gfx::Rect composition_head_;
93 ui::Range selection_range_; 93 gfx::Range selection_range_;
94 bool focus_state_; 94 bool focus_state_;
95 ui::TextInputType latest_text_input_type_; 95 ui::TextInputType latest_text_input_type_;
96 96
97 DISALLOW_COPY_AND_ASSIGN(TextInputTestHelper); 97 DISALLOW_COPY_AND_ASSIGN(TextInputTestHelper);
98 }; 98 };
99 99
100 } // namespace chromeos 100 } // namespace chromeos
101 101
102 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_TEXTINPUT_TEST_HELPER_H_ 102 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_TEXTINPUT_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698