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

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

Issue 11801027: More work to make ash_unittests pass when we require context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TableViewTest by making it a ViewsTestBase. Created 7 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/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/input_method/candidate_view.h" 10 #include "chrome/browser/chromeos/input_method/candidate_view.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 211
212 TEST_F(CandidateWindowViewTest, ShortcutSettingTest) { 212 TEST_F(CandidateWindowViewTest, ShortcutSettingTest) {
213 const char* kEmptyLabel = ""; 213 const char* kEmptyLabel = "";
214 const char* kDefaultVerticalLabel[] = { "1", "2", "3" }; 214 const char* kDefaultVerticalLabel[] = { "1", "2", "3" };
215 const char* kDefaultHorizontalLabel[] = { "1.", "2.", "3." }; 215 const char* kDefaultHorizontalLabel[] = { "1.", "2.", "3." };
216 const char* kCustomizedLabel[] = { "a", "s", "d" }; 216 const char* kCustomizedLabel[] = { "a", "s", "d" };
217 const char* kExpectedHorizontalCustomizedLabel[] = { "a.", "s.", "d." }; 217 const char* kExpectedHorizontalCustomizedLabel[] = { "a.", "s.", "d." };
218 218
219 views::Widget* widget = new views::Widget; 219 views::Widget* widget = new views::Widget;
220 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 220 views::Widget::InitParams params =
221 CreateParams(views::Widget::InitParams::TYPE_WINDOW);
221 widget->Init(params); 222 widget->Init(params);
222 223
223 CandidateWindowView candidate_window_view(widget); 224 CandidateWindowView candidate_window_view(widget);
224 candidate_window_view.Init(); 225 candidate_window_view.Init();
225 226
226 { 227 {
227 SCOPED_TRACE("candidate_views allocation test"); 228 SCOPED_TRACE("candidate_views allocation test");
228 const size_t kMaxPageSize = 16; 229 const size_t kMaxPageSize = 16;
229 for (size_t i = 1; i < kMaxPageSize; ++i) { 230 for (size_t i = 1; i < kMaxPageSize; ++i) {
230 InputMethodLookupTable table; 231 InputMethodLookupTable table;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 const char kSampleShortcut3[] = "C"; 417 const char kSampleShortcut3[] = "C";
417 418
418 const char kSampleAnnotation1[] = "Sample Annotation 1"; 419 const char kSampleAnnotation1[] = "Sample Annotation 1";
419 const char kSampleAnnotation2[] = "\xE3\x81\x82"; // multi byte string. 420 const char kSampleAnnotation2[] = "\xE3\x81\x82"; // multi byte string.
420 const char kSampleAnnotation3[] = "......"; 421 const char kSampleAnnotation3[] = "......";
421 422
422 // For testing, we have to prepare empty widget. 423 // For testing, we have to prepare empty widget.
423 // We should NOT manually free widget by default, otherwise double free will 424 // We should NOT manually free widget by default, otherwise double free will
424 // be occurred. So, we should instantiate widget class with "new" operation. 425 // be occurred. So, we should instantiate widget class with "new" operation.
425 views::Widget* widget = new views::Widget; 426 views::Widget* widget = new views::Widget;
426 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 427 views::Widget::InitParams params =
428 CreateParams(views::Widget::InitParams::TYPE_WINDOW);
427 widget->Init(params); 429 widget->Init(params);
428 430
429 CandidateWindowView candidate_window_view(widget); 431 CandidateWindowView candidate_window_view(widget);
430 candidate_window_view.Init(); 432 candidate_window_view.Init();
431 433
432 // Create LookupTable object. 434 // Create LookupTable object.
433 ClearInputMethodLookupTable(kPageSize, &table); 435 ClearInputMethodLookupTable(kPageSize, &table);
434 table.visible = true; 436 table.visible = true;
435 table.cursor_absolute_index = 0; 437 table.cursor_absolute_index = 0;
436 table.page_size = 3; 438 table.page_size = 3;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 for (size_t i = 1; i < candidate_window_view.candidate_views_.size(); ++i) { 504 for (size_t i = 1; i < candidate_window_view.candidate_views_.size(); ++i) {
503 const CandidateView* view = candidate_window_view.candidate_views_[i]; 505 const CandidateView* view = candidate_window_view.candidate_views_[i];
504 EXPECT_EQ(before_height, view->GetContentsBounds().height()); 506 EXPECT_EQ(before_height, view->GetContentsBounds().height());
505 } 507 }
506 508
507 // We should call CloseNow method, otherwise this test will leak memory. 509 // We should call CloseNow method, otherwise this test will leak memory.
508 widget->CloseNow(); 510 widget->CloseNow();
509 } 511 }
510 } // namespace input_method 512 } // namespace input_method
511 } // namespace chromeos 513 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/shell/window_type_launcher.cc ('k') | chrome/browser/ui/views/extensions/native_app_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698