| 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/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 "ui/views/controls/combobox/combobox.h" | 8 #include "ui/views/controls/combobox/combobox.h" |
| 9 #include "ui/views/controls/combobox/native_combobox_views.h" | 9 #include "ui/views/controls/combobox/native_combobox_views.h" |
| 10 #include "ui/views/ime/mock_input_method.h" | 10 #include "ui/views/ime/mock_input_method.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 key_received_ = key_handled_ = false; | 43 key_received_ = key_handled_ = false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 bool key_handled_; | 47 bool key_handled_; |
| 48 bool key_received_; | 48 bool key_received_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(TestCombobox); | 50 DISALLOW_COPY_AND_ASSIGN(TestCombobox); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // A concrete class is needed to test the combobox | 53 // A concrete class is needed to test the combo box. |
| 54 class TestComboboxModel : public ui::ComboboxModel { | 54 class TestComboboxModel : public ui::ComboboxModel { |
| 55 public: | 55 public: |
| 56 TestComboboxModel() {} | 56 TestComboboxModel() {} |
| 57 virtual ~TestComboboxModel() {} | 57 virtual ~TestComboboxModel() {} |
| 58 virtual int GetItemCount() { | 58 |
| 59 // Overridden from ui::ComboboxModel: |
| 60 virtual int GetItemCount() const OVERRIDE { |
| 59 return 4; | 61 return 4; |
| 60 } | 62 } |
| 61 virtual string16 GetItemAt(int index) { | 63 virtual string16 GetItemAt(int index) OVERRIDE { |
| 62 EXPECT_GE(index, 0); | |
| 63 EXPECT_LT(index, GetItemCount()); | |
| 64 return string16(); | 64 return string16(); |
| 65 } | 65 } |
| 66 |
| 66 private: | 67 private: |
| 67 DISALLOW_COPY_AND_ASSIGN(TestComboboxModel); | 68 DISALLOW_COPY_AND_ASSIGN(TestComboboxModel); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace | 71 } // namespace |
| 71 | 72 |
| 72 namespace views { | 73 namespace views { |
| 73 | 74 |
| 74 class NativeComboboxViewsTest : public ViewsTestBase { | 75 class NativeComboboxViewsTest : public ViewsTestBase { |
| 75 public: | 76 public: |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 widget_->SetContentsView(container); | 182 widget_->SetContentsView(container); |
| 182 container->AddChildView(combobox_); | 183 container->AddChildView(combobox_); |
| 183 | 184 |
| 184 combobox_view_ = static_cast<NativeComboboxViews*>( | 185 combobox_view_ = static_cast<NativeComboboxViews*>( |
| 185 combobox_->GetNativeWrapperForTesting()); | 186 combobox_->GetNativeWrapperForTesting()); |
| 186 ASSERT_TRUE(combobox_view_); | 187 ASSERT_TRUE(combobox_view_); |
| 187 ASSERT_FALSE(combobox_view_->enabled()); | 188 ASSERT_FALSE(combobox_view_->enabled()); |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace views | 191 } // namespace views |
| OLD | NEW |