OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "ui/base/keycodes/keyboard_codes.h" | 6 #include "ui/base/keycodes/keyboard_codes.h" |
7 #include "ui/base/models/combobox_model.h" | 7 #include "ui/base/models/combobox_model.h" |
8 #include "views/controls/combobox/combobox.h" | 8 #include "views/controls/combobox/combobox.h" |
9 #include "views/controls/combobox/native_combobox_views.h" | 9 #include "views/controls/combobox/native_combobox_views.h" |
10 #include "views/ime/mock_input_method.h" | 10 #include "views/ime/mock_input_method.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (widget_) | 92 if (widget_) |
93 widget_->Close(); | 93 widget_->Close(); |
94 ViewsTestBase::TearDown(); | 94 ViewsTestBase::TearDown(); |
95 } | 95 } |
96 | 96 |
97 void InitCombobox() { | 97 void InitCombobox() { |
98 model_.reset(new TestComboboxModel()); | 98 model_.reset(new TestComboboxModel()); |
99 | 99 |
100 ASSERT_FALSE(combobox_); | 100 ASSERT_FALSE(combobox_); |
101 combobox_ = new TestCombobox(model_.get()); | 101 combobox_ = new TestCombobox(model_.get()); |
102 combobox_->SetID(1); | 102 combobox_->set_id(1); |
103 | 103 |
104 widget_ = new Widget; | 104 widget_ = new Widget; |
105 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 105 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); |
106 params.bounds = gfx::Rect(100, 100, 100, 100); | 106 params.bounds = gfx::Rect(100, 100, 100, 100); |
107 widget_->Init(params); | 107 widget_->Init(params); |
108 View* container = new View(); | 108 View* container = new View(); |
109 widget_->SetContentsView(container); | 109 widget_->SetContentsView(container); |
110 container->AddChildView(combobox_); | 110 container->AddChildView(combobox_); |
111 | 111 |
112 combobox_view_ | 112 combobox_view_ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 SendKeyEvent(ui::VKEY_DOWN); | 158 SendKeyEvent(ui::VKEY_DOWN); |
159 EXPECT_EQ(combobox_->selected_item(), 2); | 159 EXPECT_EQ(combobox_->selected_item(), 2); |
160 SendKeyEvent(ui::VKEY_RIGHT); | 160 SendKeyEvent(ui::VKEY_RIGHT); |
161 EXPECT_EQ(combobox_->selected_item(), 2); | 161 EXPECT_EQ(combobox_->selected_item(), 2); |
162 SendKeyEvent(ui::VKEY_LEFT); | 162 SendKeyEvent(ui::VKEY_LEFT); |
163 EXPECT_EQ(combobox_->selected_item(), 2); | 163 EXPECT_EQ(combobox_->selected_item(), 2); |
164 } | 164 } |
165 | 165 |
166 } // namespace views | 166 } // namespace views |
167 | 167 |
OLD | NEW |