OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/views/controls/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 test_api_.reset(new ComboboxTestApi(combobox_)); | 204 test_api_.reset(new ComboboxTestApi(combobox_)); |
205 combobox_->set_id(1); | 205 combobox_->set_id(1); |
206 | 206 |
207 widget_ = new Widget; | 207 widget_ = new Widget; |
208 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); | 208 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); |
209 params.bounds = gfx::Rect(200, 200, 200, 200); | 209 params.bounds = gfx::Rect(200, 200, 200, 200); |
210 widget_->Init(params); | 210 widget_->Init(params); |
211 View* container = new View(); | 211 View* container = new View(); |
212 widget_->SetContentsView(container); | 212 widget_->SetContentsView(container); |
213 container->AddChildView(combobox_); | 213 container->AddChildView(combobox_); |
| 214 widget_->Show(); |
214 | 215 |
215 combobox_->RequestFocus(); | 216 combobox_->RequestFocus(); |
216 combobox_->SizeToPreferredSize(); | 217 combobox_->SizeToPreferredSize(); |
217 } | 218 } |
218 | 219 |
219 protected: | 220 protected: |
220 void SendKeyEvent(ui::KeyboardCode key_code) { | 221 void SendKeyEvent(ui::KeyboardCode key_code) { |
221 SendKeyEventWithType(key_code, ui::ET_KEY_PRESSED); | 222 SendKeyEventWithType(key_code, ui::ET_KEY_PRESSED); |
222 } | 223 } |
223 | 224 |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); | 818 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); |
818 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); | 819 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); |
819 | 820 |
820 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); | 821 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); |
821 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); | 822 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); |
822 EXPECT_FALSE(menu_model->IsVisibleAt(0)); | 823 EXPECT_FALSE(menu_model->IsVisibleAt(0)); |
823 EXPECT_TRUE(menu_model->IsVisibleAt(1)); | 824 EXPECT_TRUE(menu_model->IsVisibleAt(1)); |
824 } | 825 } |
825 | 826 |
826 } // namespace views | 827 } // namespace views |
OLD | NEW |