| OLD | NEW |
| 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "ui/base/events/event.h" | 6 #include "ui/base/events/event.h" |
| 7 #include "ui/base/keycodes/keyboard_codes.h" | 7 #include "ui/base/keycodes/keyboard_codes.h" |
| 8 #include "ui/base/models/combobox_model.h" | 8 #include "ui/base/models/combobox_model.h" |
| 9 #include "ui/views/controls/combobox/combobox.h" | 9 #include "ui/views/controls/combobox/combobox.h" |
| 10 #include "ui/views/controls/combobox/native_combobox_views.h" | 10 #include "ui/views/controls/combobox/native_combobox_views.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_->set_id(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 = CreateParams(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_ = static_cast<NativeComboboxViews*>( | 112 combobox_view_ = static_cast<NativeComboboxViews*>( |
| 113 combobox_->GetNativeWrapperForTesting()); | 113 combobox_->GetNativeWrapperForTesting()); |
| 114 ASSERT_TRUE(combobox_view_); | 114 ASSERT_TRUE(combobox_view_); |
| 115 | 115 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // native wrapper inherits the disabled state when it gets created. | 173 // native wrapper inherits the disabled state when it gets created. |
| 174 TEST_F(NativeComboboxViewsTest, DisabilityTest) { | 174 TEST_F(NativeComboboxViewsTest, DisabilityTest) { |
| 175 model_.reset(new TestComboboxModel()); | 175 model_.reset(new TestComboboxModel()); |
| 176 | 176 |
| 177 ASSERT_FALSE(combobox_); | 177 ASSERT_FALSE(combobox_); |
| 178 combobox_ = new TestCombobox(model_.get()); | 178 combobox_ = new TestCombobox(model_.get()); |
| 179 combobox_->SetEnabled(false); | 179 combobox_->SetEnabled(false); |
| 180 ASSERT_FALSE(combobox_->GetNativeWrapperForTesting()); | 180 ASSERT_FALSE(combobox_->GetNativeWrapperForTesting()); |
| 181 | 181 |
| 182 widget_ = new Widget; | 182 widget_ = new Widget; |
| 183 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 183 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); |
| 184 params.bounds = gfx::Rect(100, 100, 100, 100); | 184 params.bounds = gfx::Rect(100, 100, 100, 100); |
| 185 widget_->Init(params); | 185 widget_->Init(params); |
| 186 View* container = new View(); | 186 View* container = new View(); |
| 187 widget_->SetContentsView(container); | 187 widget_->SetContentsView(container); |
| 188 container->AddChildView(combobox_); | 188 container->AddChildView(combobox_); |
| 189 | 189 |
| 190 combobox_view_ = static_cast<NativeComboboxViews*>( | 190 combobox_view_ = static_cast<NativeComboboxViews*>( |
| 191 combobox_->GetNativeWrapperForTesting()); | 191 combobox_->GetNativeWrapperForTesting()); |
| 192 ASSERT_TRUE(combobox_view_); | 192 ASSERT_TRUE(combobox_view_); |
| 193 ASSERT_FALSE(combobox_view_->enabled()); | 193 ASSERT_FALSE(combobox_view_->enabled()); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace views | 196 } // namespace views |
| OLD | NEW |