| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 if (separators) | 199 if (separators) |
| 200 model_->SetSeparators(*separators); | 200 model_->SetSeparators(*separators); |
| 201 | 201 |
| 202 ASSERT_FALSE(combobox_); | 202 ASSERT_FALSE(combobox_); |
| 203 combobox_ = new TestCombobox(model_.get(), style); | 203 combobox_ = new TestCombobox(model_.get(), style); |
| 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 = |
| 209 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 209 params.bounds = gfx::Rect(200, 200, 200, 200); | 210 params.bounds = gfx::Rect(200, 200, 200, 200); |
| 210 widget_->Init(params); | 211 widget_->Init(params); |
| 211 View* container = new View(); | 212 View* container = new View(); |
| 212 widget_->SetContentsView(container); | 213 widget_->SetContentsView(container); |
| 213 container->AddChildView(combobox_); | 214 container->AddChildView(combobox_); |
| 215 widget_->Show(); |
| 214 | 216 |
| 215 combobox_->RequestFocus(); | 217 combobox_->RequestFocus(); |
| 216 combobox_->SizeToPreferredSize(); | 218 combobox_->SizeToPreferredSize(); |
| 217 } | 219 } |
| 218 | 220 |
| 219 protected: | 221 protected: |
| 220 void SendKeyEvent(ui::KeyboardCode key_code) { | 222 void SendKeyEvent(ui::KeyboardCode key_code) { |
| 221 SendKeyEventWithType(key_code, ui::ET_KEY_PRESSED); | 223 SendKeyEventWithType(key_code, ui::ET_KEY_PRESSED); |
| 222 } | 224 } |
| 223 | 225 |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); | 819 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); |
| 818 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); | 820 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); |
| 819 | 821 |
| 820 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); | 822 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); |
| 821 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); | 823 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); |
| 822 EXPECT_FALSE(menu_model->IsVisibleAt(0)); | 824 EXPECT_FALSE(menu_model->IsVisibleAt(0)); |
| 823 EXPECT_TRUE(menu_model->IsVisibleAt(1)); | 825 EXPECT_TRUE(menu_model->IsVisibleAt(1)); |
| 824 } | 826 } |
| 825 | 827 |
| 826 } // namespace views | 828 } // namespace views |
| OLD | NEW |