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

Side by Side Diff: trunk/src/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc

Issue 130833002: Revert 243777 "Moves CandidateWindow model to ui/base/ime." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/input_method/candidate_window_view.h" 5 #include "chrome/browser/chromeos/input_method/candidate_window_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 21 matching lines...) Expand all
32 "Sample Description Title 2", 32 "Sample Description Title 2",
33 "Sample Description Title 3", 33 "Sample Description Title 3",
34 }; 34 };
35 const char* kSampleDescriptionBody[] = { 35 const char* kSampleDescriptionBody[] = {
36 "Sample Description Body 1", 36 "Sample Description Body 1",
37 "Sample Description Body 2", 37 "Sample Description Body 2",
38 "Sample Description Body 3", 38 "Sample Description Body 3",
39 }; 39 };
40 40
41 void InitCandidateWindow(size_t page_size, 41 void InitCandidateWindow(size_t page_size,
42 ui::CandidateWindow* candidate_window) { 42 CandidateWindow* candidate_window) {
43 candidate_window->set_cursor_position(0); 43 candidate_window->set_cursor_position(0);
44 candidate_window->set_page_size(page_size); 44 candidate_window->set_page_size(page_size);
45 candidate_window->mutable_candidates()->clear(); 45 candidate_window->mutable_candidates()->clear();
46 candidate_window->set_orientation(ui::CandidateWindow::VERTICAL); 46 candidate_window->set_orientation(CandidateWindow::VERTICAL);
47 } 47 }
48 48
49 void InitCandidateWindowWithCandidatesFilled( 49 void InitCandidateWindowWithCandidatesFilled(
50 size_t page_size, 50 size_t page_size,
51 ui::CandidateWindow* candidate_window) { 51 CandidateWindow* candidate_window) {
52 InitCandidateWindow(page_size, candidate_window); 52 InitCandidateWindow(page_size, candidate_window);
53 for (size_t i = 0; i < page_size; ++i) { 53 for (size_t i = 0; i < page_size; ++i) {
54 ui::CandidateWindow::Entry entry; 54 CandidateWindow::Entry entry;
55 entry.value = base::StringPrintf("value %lld", 55 entry.value = base::StringPrintf("value %lld",
56 static_cast<unsigned long long>(i)); 56 static_cast<unsigned long long>(i));
57 entry.label = base::StringPrintf("%lld", 57 entry.label = base::StringPrintf("%lld",
58 static_cast<unsigned long long>(i)); 58 static_cast<unsigned long long>(i));
59 candidate_window->mutable_candidates()->push_back(entry); 59 candidate_window->mutable_candidates()->push_back(entry);
60 } 60 }
61 } 61 }
62 62
63 } // namespace 63 } // namespace
64 64
(...skipping 22 matching lines...) Expand all
87 } 87 }
88 88
89 CandidateView* GetCandidateAt(size_t i) { 89 CandidateView* GetCandidateAt(size_t i) {
90 return candidate_window_view_->candidate_views_[i]; 90 return candidate_window_view_->candidate_views_[i];
91 } 91 }
92 92
93 void SelectCandidateAt(int index_in_page) { 93 void SelectCandidateAt(int index_in_page) {
94 candidate_window_view_->SelectCandidateAt(index_in_page); 94 candidate_window_view_->SelectCandidateAt(index_in_page);
95 } 95 }
96 96
97 void MaybeInitializeCandidateViews( 97 void MaybeInitializeCandidateViews(const CandidateWindow& candidate_window) {
98 const ui::CandidateWindow& candidate_window) {
99 candidate_window_view_->MaybeInitializeCandidateViews(candidate_window); 98 candidate_window_view_->MaybeInitializeCandidateViews(candidate_window);
100 } 99 }
101 100
102 void ExpectLabels(const std::string& shortcut, 101 void ExpectLabels(const std::string& shortcut,
103 const std::string& candidate, 102 const std::string& candidate,
104 const std::string& annotation, 103 const std::string& annotation,
105 const CandidateView* row) { 104 const CandidateView* row) {
106 EXPECT_EQ(shortcut, base::UTF16ToUTF8(row->shortcut_label_->text())); 105 EXPECT_EQ(shortcut, base::UTF16ToUTF8(row->shortcut_label_->text()));
107 EXPECT_EQ(candidate, base::UTF16ToUTF8(row->candidate_label_->text())); 106 EXPECT_EQ(candidate, base::UTF16ToUTF8(row->candidate_label_->text()));
108 EXPECT_EQ(annotation, base::UTF16ToUTF8(row->annotation_label_->text())); 107 EXPECT_EQ(annotation, base::UTF16ToUTF8(row->annotation_label_->text()));
109 } 108 }
110 109
111 private: 110 private:
112 // owned by |parent_|. 111 // owned by |parent_|.
113 CandidateWindowView* candidate_window_view_; 112 CandidateWindowView* candidate_window_view_;
114 113
115 DISALLOW_COPY_AND_ASSIGN(CandidateWindowViewTest); 114 DISALLOW_COPY_AND_ASSIGN(CandidateWindowViewTest);
116 }; 115 };
117 116
118 TEST_F(CandidateWindowViewTest, UpdateCandidatesTest_CursorVisibility) { 117 TEST_F(CandidateWindowViewTest, UpdateCandidatesTest_CursorVisibility) {
119 // Visible (by default) cursor. 118 // Visible (by default) cursor.
120 ui::CandidateWindow candidate_window; 119 CandidateWindow candidate_window;
121 const int candidate_window_size = 9; 120 const int candidate_window_size = 9;
122 InitCandidateWindowWithCandidatesFilled(candidate_window_size, 121 InitCandidateWindowWithCandidatesFilled(candidate_window_size,
123 &candidate_window); 122 &candidate_window);
124 candidate_window_view()->UpdateCandidates(candidate_window); 123 candidate_window_view()->UpdateCandidates(candidate_window);
125 EXPECT_EQ(0, selected_candidate_index_in_page()); 124 EXPECT_EQ(0, selected_candidate_index_in_page());
126 125
127 // Invisible cursor. 126 // Invisible cursor.
128 candidate_window.set_is_cursor_visible(false); 127 candidate_window.set_is_cursor_visible(false);
129 candidate_window_view()->UpdateCandidates(candidate_window); 128 candidate_window_view()->UpdateCandidates(candidate_window);
130 EXPECT_EQ(-1, selected_candidate_index_in_page()); 129 EXPECT_EQ(-1, selected_candidate_index_in_page());
131 130
132 // Move the cursor to the end. 131 // Move the cursor to the end.
133 candidate_window.set_cursor_position(candidate_window_size - 1); 132 candidate_window.set_cursor_position(candidate_window_size - 1);
134 candidate_window_view()->UpdateCandidates(candidate_window); 133 candidate_window_view()->UpdateCandidates(candidate_window);
135 EXPECT_EQ(-1, selected_candidate_index_in_page()); 134 EXPECT_EQ(-1, selected_candidate_index_in_page());
136 135
137 // Change the cursor to visible. The cursor must be at the end. 136 // Change the cursor to visible. The cursor must be at the end.
138 candidate_window.set_is_cursor_visible(true); 137 candidate_window.set_is_cursor_visible(true);
139 candidate_window_view()->UpdateCandidates(candidate_window); 138 candidate_window_view()->UpdateCandidates(candidate_window);
140 EXPECT_EQ(candidate_window_size - 1, selected_candidate_index_in_page()); 139 EXPECT_EQ(candidate_window_size - 1, selected_candidate_index_in_page());
141 } 140 }
142 141
143 TEST_F(CandidateWindowViewTest, SelectCandidateAtTest) { 142 TEST_F(CandidateWindowViewTest, SelectCandidateAtTest) {
144 // Set 9 candidates. 143 // Set 9 candidates.
145 ui::CandidateWindow candidate_window_large; 144 CandidateWindow candidate_window_large;
146 const int candidate_window_large_size = 9; 145 const int candidate_window_large_size = 9;
147 InitCandidateWindowWithCandidatesFilled(candidate_window_large_size, 146 InitCandidateWindowWithCandidatesFilled(candidate_window_large_size,
148 &candidate_window_large); 147 &candidate_window_large);
149 candidate_window_large.set_cursor_position(candidate_window_large_size - 1); 148 candidate_window_large.set_cursor_position(candidate_window_large_size - 1);
150 candidate_window_view()->UpdateCandidates(candidate_window_large); 149 candidate_window_view()->UpdateCandidates(candidate_window_large);
151 150
152 // Select the last candidate. 151 // Select the last candidate.
153 SelectCandidateAt(candidate_window_large_size - 1); 152 SelectCandidateAt(candidate_window_large_size - 1);
154 153
155 // Reduce the number of candidates to 3. 154 // Reduce the number of candidates to 3.
156 ui::CandidateWindow candidate_window_small; 155 CandidateWindow candidate_window_small;
157 const int candidate_window_small_size = 3; 156 const int candidate_window_small_size = 3;
158 InitCandidateWindowWithCandidatesFilled(candidate_window_small_size, 157 InitCandidateWindowWithCandidatesFilled(candidate_window_small_size,
159 &candidate_window_small); 158 &candidate_window_small);
160 candidate_window_small.set_cursor_position(candidate_window_small_size - 1); 159 candidate_window_small.set_cursor_position(candidate_window_small_size - 1);
161 // Make sure the test doesn't crash if the candidate window reduced 160 // Make sure the test doesn't crash if the candidate window reduced
162 // its size. (crbug.com/174163) 161 // its size. (crbug.com/174163)
163 candidate_window_view()->UpdateCandidates(candidate_window_small); 162 candidate_window_view()->UpdateCandidates(candidate_window_small);
164 SelectCandidateAt(candidate_window_small_size - 1); 163 SelectCandidateAt(candidate_window_small_size - 1);
165 } 164 }
166 165
167 TEST_F(CandidateWindowViewTest, ShortcutSettingTest) { 166 TEST_F(CandidateWindowViewTest, ShortcutSettingTest) {
168 const char* kEmptyLabel = ""; 167 const char* kEmptyLabel = "";
169 const char* kCustomizedLabel[] = { "a", "s", "d" }; 168 const char* kCustomizedLabel[] = { "a", "s", "d" };
170 const char* kExpectedHorizontalCustomizedLabel[] = { "a.", "s.", "d." }; 169 const char* kExpectedHorizontalCustomizedLabel[] = { "a.", "s.", "d." };
171 170
172 { 171 {
173 SCOPED_TRACE("candidate_views allocation test"); 172 SCOPED_TRACE("candidate_views allocation test");
174 const size_t kMaxPageSize = 16; 173 const size_t kMaxPageSize = 16;
175 for (size_t i = 1; i < kMaxPageSize; ++i) { 174 for (size_t i = 1; i < kMaxPageSize; ++i) {
176 ui::CandidateWindow candidate_window; 175 CandidateWindow candidate_window;
177 InitCandidateWindow(i, &candidate_window); 176 InitCandidateWindow(i, &candidate_window);
178 candidate_window_view()->UpdateCandidates(candidate_window); 177 candidate_window_view()->UpdateCandidates(candidate_window);
179 EXPECT_EQ(i, GetCandidatesSize()); 178 EXPECT_EQ(i, GetCandidatesSize());
180 } 179 }
181 } 180 }
182 { 181 {
183 SCOPED_TRACE("Empty string for each labels expects empty labels(vertical)"); 182 SCOPED_TRACE("Empty string for each labels expects empty labels(vertical)");
184 const size_t kPageSize = 3; 183 const size_t kPageSize = 3;
185 ui::CandidateWindow candidate_window; 184 CandidateWindow candidate_window;
186 InitCandidateWindow(kPageSize, &candidate_window); 185 InitCandidateWindow(kPageSize, &candidate_window);
187 186
188 candidate_window.set_orientation(ui::CandidateWindow::VERTICAL); 187 candidate_window.set_orientation(CandidateWindow::VERTICAL);
189 for (size_t i = 0; i < kPageSize; ++i) { 188 for (size_t i = 0; i < kPageSize; ++i) {
190 ui::CandidateWindow::Entry entry; 189 CandidateWindow::Entry entry;
191 entry.value = kSampleCandidate[i]; 190 entry.value = kSampleCandidate[i];
192 entry.annotation = kSampleAnnotation[i]; 191 entry.annotation = kSampleAnnotation[i];
193 entry.description_title = kSampleDescriptionTitle[i]; 192 entry.description_title = kSampleDescriptionTitle[i];
194 entry.description_body = kSampleDescriptionBody[i]; 193 entry.description_body = kSampleDescriptionBody[i];
195 entry.label = kEmptyLabel; 194 entry.label = kEmptyLabel;
196 candidate_window.mutable_candidates()->push_back(entry); 195 candidate_window.mutable_candidates()->push_back(entry);
197 } 196 }
198 197
199 candidate_window_view()->UpdateCandidates(candidate_window); 198 candidate_window_view()->UpdateCandidates(candidate_window);
200 199
201 ASSERT_EQ(kPageSize, GetCandidatesSize()); 200 ASSERT_EQ(kPageSize, GetCandidatesSize());
202 for (size_t i = 0; i < kPageSize; ++i) { 201 for (size_t i = 0; i < kPageSize; ++i) {
203 ExpectLabels(kEmptyLabel, kSampleCandidate[i], kSampleAnnotation[i], 202 ExpectLabels(kEmptyLabel, kSampleCandidate[i], kSampleAnnotation[i],
204 GetCandidateAt(i)); 203 GetCandidateAt(i));
205 } 204 }
206 } 205 }
207 { 206 {
208 SCOPED_TRACE( 207 SCOPED_TRACE(
209 "Empty string for each labels expect empty labels(horizontal)"); 208 "Empty string for each labels expect empty labels(horizontal)");
210 const size_t kPageSize = 3; 209 const size_t kPageSize = 3;
211 ui::CandidateWindow candidate_window; 210 CandidateWindow candidate_window;
212 InitCandidateWindow(kPageSize, &candidate_window); 211 InitCandidateWindow(kPageSize, &candidate_window);
213 212
214 candidate_window.set_orientation(ui::CandidateWindow::HORIZONTAL); 213 candidate_window.set_orientation(CandidateWindow::HORIZONTAL);
215 for (size_t i = 0; i < kPageSize; ++i) { 214 for (size_t i = 0; i < kPageSize; ++i) {
216 ui::CandidateWindow::Entry entry; 215 CandidateWindow::Entry entry;
217 entry.value = kSampleCandidate[i]; 216 entry.value = kSampleCandidate[i];
218 entry.annotation = kSampleAnnotation[i]; 217 entry.annotation = kSampleAnnotation[i];
219 entry.description_title = kSampleDescriptionTitle[i]; 218 entry.description_title = kSampleDescriptionTitle[i];
220 entry.description_body = kSampleDescriptionBody[i]; 219 entry.description_body = kSampleDescriptionBody[i];
221 entry.label = kEmptyLabel; 220 entry.label = kEmptyLabel;
222 candidate_window.mutable_candidates()->push_back(entry); 221 candidate_window.mutable_candidates()->push_back(entry);
223 } 222 }
224 223
225 candidate_window_view()->UpdateCandidates(candidate_window); 224 candidate_window_view()->UpdateCandidates(candidate_window);
226 225
227 ASSERT_EQ(kPageSize, GetCandidatesSize()); 226 ASSERT_EQ(kPageSize, GetCandidatesSize());
228 // Confirm actual labels not containing ".". 227 // Confirm actual labels not containing ".".
229 for (size_t i = 0; i < kPageSize; ++i) { 228 for (size_t i = 0; i < kPageSize; ++i) {
230 ExpectLabels(kEmptyLabel, kSampleCandidate[i], kSampleAnnotation[i], 229 ExpectLabels(kEmptyLabel, kSampleCandidate[i], kSampleAnnotation[i],
231 GetCandidateAt(i)); 230 GetCandidateAt(i));
232 } 231 }
233 } 232 }
234 { 233 {
235 SCOPED_TRACE("Vertical customized label case"); 234 SCOPED_TRACE("Vertical customized label case");
236 const size_t kPageSize = 3; 235 const size_t kPageSize = 3;
237 ui::CandidateWindow candidate_window; 236 CandidateWindow candidate_window;
238 InitCandidateWindow(kPageSize, &candidate_window); 237 InitCandidateWindow(kPageSize, &candidate_window);
239 238
240 candidate_window.set_orientation(ui::CandidateWindow::VERTICAL); 239 candidate_window.set_orientation(CandidateWindow::VERTICAL);
241 for (size_t i = 0; i < kPageSize; ++i) { 240 for (size_t i = 0; i < kPageSize; ++i) {
242 ui::CandidateWindow::Entry entry; 241 CandidateWindow::Entry entry;
243 entry.value = kSampleCandidate[i]; 242 entry.value = kSampleCandidate[i];
244 entry.annotation = kSampleAnnotation[i]; 243 entry.annotation = kSampleAnnotation[i];
245 entry.description_title = kSampleDescriptionTitle[i]; 244 entry.description_title = kSampleDescriptionTitle[i];
246 entry.description_body = kSampleDescriptionBody[i]; 245 entry.description_body = kSampleDescriptionBody[i];
247 entry.label = kCustomizedLabel[i]; 246 entry.label = kCustomizedLabel[i];
248 candidate_window.mutable_candidates()->push_back(entry); 247 candidate_window.mutable_candidates()->push_back(entry);
249 } 248 }
250 249
251 candidate_window_view()->UpdateCandidates(candidate_window); 250 candidate_window_view()->UpdateCandidates(candidate_window);
252 251
253 ASSERT_EQ(kPageSize, GetCandidatesSize()); 252 ASSERT_EQ(kPageSize, GetCandidatesSize());
254 // Confirm actual labels not containing ".". 253 // Confirm actual labels not containing ".".
255 for (size_t i = 0; i < kPageSize; ++i) { 254 for (size_t i = 0; i < kPageSize; ++i) {
256 ExpectLabels(kCustomizedLabel[i], 255 ExpectLabels(kCustomizedLabel[i],
257 kSampleCandidate[i], 256 kSampleCandidate[i],
258 kSampleAnnotation[i], 257 kSampleAnnotation[i],
259 GetCandidateAt(i)); 258 GetCandidateAt(i));
260 } 259 }
261 } 260 }
262 { 261 {
263 SCOPED_TRACE("Horizontal customized label case"); 262 SCOPED_TRACE("Horizontal customized label case");
264 const size_t kPageSize = 3; 263 const size_t kPageSize = 3;
265 ui::CandidateWindow candidate_window; 264 CandidateWindow candidate_window;
266 InitCandidateWindow(kPageSize, &candidate_window); 265 InitCandidateWindow(kPageSize, &candidate_window);
267 266
268 candidate_window.set_orientation(ui::CandidateWindow::HORIZONTAL); 267 candidate_window.set_orientation(CandidateWindow::HORIZONTAL);
269 for (size_t i = 0; i < kPageSize; ++i) { 268 for (size_t i = 0; i < kPageSize; ++i) {
270 ui::CandidateWindow::Entry entry; 269 CandidateWindow::Entry entry;
271 entry.value = kSampleCandidate[i]; 270 entry.value = kSampleCandidate[i];
272 entry.annotation = kSampleAnnotation[i]; 271 entry.annotation = kSampleAnnotation[i];
273 entry.description_title = kSampleDescriptionTitle[i]; 272 entry.description_title = kSampleDescriptionTitle[i];
274 entry.description_body = kSampleDescriptionBody[i]; 273 entry.description_body = kSampleDescriptionBody[i];
275 entry.label = kCustomizedLabel[i]; 274 entry.label = kCustomizedLabel[i];
276 candidate_window.mutable_candidates()->push_back(entry); 275 candidate_window.mutable_candidates()->push_back(entry);
277 } 276 }
278 277
279 candidate_window_view()->UpdateCandidates(candidate_window); 278 candidate_window_view()->UpdateCandidates(candidate_window);
280 279
281 ASSERT_EQ(kPageSize, GetCandidatesSize()); 280 ASSERT_EQ(kPageSize, GetCandidatesSize());
282 // Confirm actual labels not containing ".". 281 // Confirm actual labels not containing ".".
283 for (size_t i = 0; i < kPageSize; ++i) { 282 for (size_t i = 0; i < kPageSize; ++i) {
284 ExpectLabels(kExpectedHorizontalCustomizedLabel[i], 283 ExpectLabels(kExpectedHorizontalCustomizedLabel[i],
285 kSampleCandidate[i], 284 kSampleCandidate[i],
286 kSampleAnnotation[i], 285 kSampleAnnotation[i],
287 GetCandidateAt(i)); 286 GetCandidateAt(i));
288 } 287 }
289 } 288 }
290 } 289 }
291 290
292 TEST_F(CandidateWindowViewTest, DoNotChangeRowHeightWithLabelSwitchTest) { 291 TEST_F(CandidateWindowViewTest, DoNotChangeRowHeightWithLabelSwitchTest) {
293 const size_t kPageSize = 10; 292 const size_t kPageSize = 10;
294 ui::CandidateWindow candidate_window; 293 CandidateWindow candidate_window;
295 ui::CandidateWindow no_shortcut_candidate_window; 294 CandidateWindow no_shortcut_candidate_window;
296 295
297 const char kSampleCandidate1[] = "Sample String 1"; 296 const char kSampleCandidate1[] = "Sample String 1";
298 const char kSampleCandidate2[] = "\xE3\x81\x82"; // multi byte string. 297 const char kSampleCandidate2[] = "\xE3\x81\x82"; // multi byte string.
299 const char kSampleCandidate3[] = "....."; 298 const char kSampleCandidate3[] = ".....";
300 299
301 const char kSampleShortcut1[] = "1"; 300 const char kSampleShortcut1[] = "1";
302 const char kSampleShortcut2[] = "b"; 301 const char kSampleShortcut2[] = "b";
303 const char kSampleShortcut3[] = "C"; 302 const char kSampleShortcut3[] = "C";
304 303
305 const char kSampleAnnotation1[] = "Sample Annotation 1"; 304 const char kSampleAnnotation1[] = "Sample Annotation 1";
306 const char kSampleAnnotation2[] = "\xE3\x81\x82"; // multi byte string. 305 const char kSampleAnnotation2[] = "\xE3\x81\x82"; // multi byte string.
307 const char kSampleAnnotation3[] = "......"; 306 const char kSampleAnnotation3[] = "......";
308 307
309 // Create CandidateWindow object. 308 // Create CandidateWindow object.
310 InitCandidateWindow(kPageSize, &candidate_window); 309 InitCandidateWindow(kPageSize, &candidate_window);
311 310
312 candidate_window.set_cursor_position(0); 311 candidate_window.set_cursor_position(0);
313 candidate_window.set_page_size(3); 312 candidate_window.set_page_size(3);
314 candidate_window.mutable_candidates()->clear(); 313 candidate_window.mutable_candidates()->clear();
315 candidate_window.set_orientation(ui::CandidateWindow::VERTICAL); 314 candidate_window.set_orientation(CandidateWindow::VERTICAL);
316 no_shortcut_candidate_window.CopyFrom(candidate_window); 315 no_shortcut_candidate_window.CopyFrom(candidate_window);
317 316
318 ui::CandidateWindow::Entry entry; 317 CandidateWindow::Entry entry;
319 entry.value = kSampleCandidate1; 318 entry.value = kSampleCandidate1;
320 entry.annotation = kSampleAnnotation1; 319 entry.annotation = kSampleAnnotation1;
321 candidate_window.mutable_candidates()->push_back(entry); 320 candidate_window.mutable_candidates()->push_back(entry);
322 entry.label = kSampleShortcut1; 321 entry.label = kSampleShortcut1;
323 no_shortcut_candidate_window.mutable_candidates()->push_back(entry); 322 no_shortcut_candidate_window.mutable_candidates()->push_back(entry);
324 323
325 entry.value = kSampleCandidate2; 324 entry.value = kSampleCandidate2;
326 entry.annotation = kSampleAnnotation2; 325 entry.annotation = kSampleAnnotation2;
327 candidate_window.mutable_candidates()->push_back(entry); 326 candidate_window.mutable_candidates()->push_back(entry);
328 entry.label = kSampleShortcut2; 327 entry.label = kSampleShortcut2;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 ASSERT_EQ(3UL, GetCandidatesSize()); 373 ASSERT_EQ(3UL, GetCandidatesSize());
375 // Check the selected index is invalidated. 374 // Check the selected index is invalidated.
376 EXPECT_EQ(-1, selected_candidate_index_in_page()); 375 EXPECT_EQ(-1, selected_candidate_index_in_page());
377 EXPECT_EQ(before_height, GetCandidateAt(0)->GetContentsBounds().height()); 376 EXPECT_EQ(before_height, GetCandidateAt(0)->GetContentsBounds().height());
378 // Checks all entry have same row height. 377 // Checks all entry have same row height.
379 for (size_t i = 1; i < GetCandidatesSize(); ++i) 378 for (size_t i = 1; i < GetCandidatesSize(); ++i)
380 EXPECT_EQ(before_height, GetCandidateAt(i)->GetContentsBounds().height()); 379 EXPECT_EQ(before_height, GetCandidateAt(i)->GetContentsBounds().height());
381 } 380 }
382 } // namespace input_method 381 } // namespace input_method
383 } // namespace chromeos 382 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698