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

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

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 #include "ash/shell.h" 5 #include "ash/shell.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chromeos/input_method/textinput_test_helper.h" 9 #include "chrome/browser/chromeos/input_method/textinput_test_helper.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 15 matching lines...) Expand all
26 return input_method; 26 return input_method;
27 } 27 }
28 } // namespace 28 } // namespace
29 29
30 void TextInputTestBase::SetUpInProcessBrowserTestFixture() { 30 void TextInputTestBase::SetUpInProcessBrowserTestFixture() {
31 ui::SetUpInputMethodFactoryForTesting(); 31 ui::SetUpInputMethodFactoryForTesting();
32 } 32 }
33 33
34 TextInputTestHelper::TextInputTestHelper() 34 TextInputTestHelper::TextInputTestHelper()
35 : waiting_type_(NO_WAIT), 35 : waiting_type_(NO_WAIT),
36 selection_range_(ui::Range::InvalidRange()), 36 selection_range_(gfx::Range::InvalidRange()),
37 focus_state_(false), 37 focus_state_(false),
38 latest_text_input_type_(ui::TEXT_INPUT_TYPE_NONE) { 38 latest_text_input_type_(ui::TEXT_INPUT_TYPE_NONE) {
39 GetInputMethod()->AddObserver(this); 39 GetInputMethod()->AddObserver(this);
40 } 40 }
41 41
42 TextInputTestHelper::~TextInputTestHelper() { 42 TextInputTestHelper::~TextInputTestHelper() {
43 GetInputMethod()->RemoveObserver(this); 43 GetInputMethod()->RemoveObserver(this);
44 } 44 }
45 45
46 string16 TextInputTestHelper::GetSurroundingText() const { 46 string16 TextInputTestHelper::GetSurroundingText() const {
47 return surrounding_text_; 47 return surrounding_text_;
48 } 48 }
49 49
50 gfx::Rect TextInputTestHelper::GetCaretRect() const { 50 gfx::Rect TextInputTestHelper::GetCaretRect() const {
51 return caret_rect_; 51 return caret_rect_;
52 } 52 }
53 53
54 gfx::Rect TextInputTestHelper::GetCompositionHead() const { 54 gfx::Rect TextInputTestHelper::GetCompositionHead() const {
55 return composition_head_; 55 return composition_head_;
56 } 56 }
57 57
58 ui::Range TextInputTestHelper::GetSelectionRange() const { 58 gfx::Range TextInputTestHelper::GetSelectionRange() const {
59 return selection_range_; 59 return selection_range_;
60 } 60 }
61 61
62 bool TextInputTestHelper::GetFocusState() const { 62 bool TextInputTestHelper::GetFocusState() const {
63 return focus_state_; 63 return focus_state_;
64 } 64 }
65 65
66 ui::TextInputType TextInputTestHelper::GetTextInputType() const { 66 ui::TextInputType TextInputTestHelper::GetTextInputType() const {
67 return latest_text_input_type_; 67 return latest_text_input_type_;
68 } 68 }
(...skipping 24 matching lines...) Expand all
93 if (waiting_type_ == WAIT_ON_BLUR) 93 if (waiting_type_ == WAIT_ON_BLUR)
94 base::MessageLoop::current()->Quit(); 94 base::MessageLoop::current()->Quit();
95 } 95 }
96 96
97 void TextInputTestHelper::OnUntranslatedIMEMessage( 97 void TextInputTestHelper::OnUntranslatedIMEMessage(
98 const base::NativeEvent& event) { 98 const base::NativeEvent& event) {
99 } 99 }
100 100
101 void TextInputTestHelper::OnCaretBoundsChanged( 101 void TextInputTestHelper::OnCaretBoundsChanged(
102 const ui::TextInputClient* client) { 102 const ui::TextInputClient* client) {
103 ui::Range text_range; 103 gfx::Range text_range;
104 if (!GetTextInputClient()->GetTextRange(&text_range) || 104 if (!GetTextInputClient()->GetTextRange(&text_range) ||
105 !GetTextInputClient()->GetTextFromRange(text_range, &surrounding_text_) || 105 !GetTextInputClient()->GetTextFromRange(text_range, &surrounding_text_) ||
106 !GetTextInputClient()->GetSelectionRange(&selection_range_)) 106 !GetTextInputClient()->GetSelectionRange(&selection_range_))
107 return; 107 return;
108 if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED) 108 if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED)
109 base::MessageLoop::current()->Quit(); 109 base::MessageLoop::current()->Quit();
110 } 110 }
111 111
112 void TextInputTestHelper::OnInputLocaleChanged() { 112 void TextInputTestHelper::OnInputLocaleChanged() {
113 } 113 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 const gfx::Rect& expected_composition_head) { 146 const gfx::Rect& expected_composition_head) {
147 waiting_type_ = WAIT_ON_CARET_BOUNDS_CHANGED; 147 waiting_type_ = WAIT_ON_CARET_BOUNDS_CHANGED;
148 while (expected_caret_rect != caret_rect_ || 148 while (expected_caret_rect != caret_rect_ ||
149 expected_composition_head != composition_head_) 149 expected_composition_head != composition_head_)
150 content::RunMessageLoop(); 150 content::RunMessageLoop();
151 waiting_type_ = NO_WAIT; 151 waiting_type_ = NO_WAIT;
152 } 152 }
153 153
154 void TextInputTestHelper::WaitForSurroundingTextChanged( 154 void TextInputTestHelper::WaitForSurroundingTextChanged(
155 const string16& expected_text, 155 const string16& expected_text,
156 const ui::Range& expected_selection) { 156 const gfx::Range& expected_selection) {
157 waiting_type_ = WAIT_ON_CARET_BOUNDS_CHANGED; 157 waiting_type_ = WAIT_ON_CARET_BOUNDS_CHANGED;
158 while (expected_text != surrounding_text_ || 158 while (expected_text != surrounding_text_ ||
159 expected_selection != selection_range_) 159 expected_selection != selection_range_)
160 content::RunMessageLoop(); 160 content::RunMessageLoop();
161 waiting_type_ = NO_WAIT; 161 waiting_type_ = NO_WAIT;
162 } 162 }
163 163
164 // static 164 // static
165 bool TextInputTestHelper::ConvertRectFromString(const std::string& str, 165 bool TextInputTestHelper::ConvertRectFromString(const std::string& str,
166 gfx::Rect* rect) { 166 gfx::Rect* rect) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 mouse_event.y = rect.CenterPoint().y(); 201 mouse_event.y = rect.CenterPoint().y();
202 mouse_event.clickCount = 1; 202 mouse_event.clickCount = 1;
203 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 203 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
204 204
205 mouse_event.type = WebKit::WebInputEvent::MouseUp; 205 mouse_event.type = WebKit::WebInputEvent::MouseUp;
206 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 206 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
207 return true; 207 return true;
208 } 208 }
209 209
210 } // namespace chromeos 210 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/textinput_test_helper.h ('k') | chrome/browser/chromeos/ui/echo_dialog_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698