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/strings/utf_string_conversions.h" | 5 #include "base/strings/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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 View* container = new View(); | 106 View* container = new View(); |
107 widget_->SetContentsView(container); | 107 widget_->SetContentsView(container); |
108 container->AddChildView(combobox_); | 108 container->AddChildView(combobox_); |
109 | 109 |
110 combobox_view_ = static_cast<NativeComboboxViews*>( | 110 combobox_view_ = static_cast<NativeComboboxViews*>( |
111 combobox_->GetNativeWrapperForTesting()); | 111 combobox_->GetNativeWrapperForTesting()); |
112 ASSERT_TRUE(combobox_view_); | 112 ASSERT_TRUE(combobox_view_); |
113 | 113 |
114 input_method_ = new MockInputMethod(); | 114 input_method_ = new MockInputMethod(); |
115 widget_->ReplaceInputMethod(input_method_); | 115 widget_->ReplaceInputMethod(input_method_); |
| 116 |
| 117 // Assumes the Widget is always focused. |
| 118 input_method_->OnFocus(); |
| 119 |
116 combobox_->RequestFocus(); | 120 combobox_->RequestFocus(); |
117 } | 121 } |
118 | 122 |
119 protected: | 123 protected: |
120 void SendKeyEvent(ui::KeyboardCode key_code) { | 124 void SendKeyEvent(ui::KeyboardCode key_code) { |
121 ui::KeyEvent event(ui::ET_KEY_PRESSED, key_code, 0, false); | 125 ui::KeyEvent event(ui::ET_KEY_PRESSED, key_code, 0, false); |
122 input_method_->DispatchKeyEvent(event); | 126 input_method_->DispatchKeyEvent(event); |
123 } | 127 } |
124 | 128 |
125 View* GetFocusedView() { | 129 View* GetFocusedView() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 widget_->SetContentsView(container); | 185 widget_->SetContentsView(container); |
182 container->AddChildView(combobox_); | 186 container->AddChildView(combobox_); |
183 | 187 |
184 combobox_view_ = static_cast<NativeComboboxViews*>( | 188 combobox_view_ = static_cast<NativeComboboxViews*>( |
185 combobox_->GetNativeWrapperForTesting()); | 189 combobox_->GetNativeWrapperForTesting()); |
186 ASSERT_TRUE(combobox_view_); | 190 ASSERT_TRUE(combobox_view_); |
187 ASSERT_FALSE(combobox_view_->enabled()); | 191 ASSERT_FALSE(combobox_view_->enabled()); |
188 } | 192 } |
189 | 193 |
190 } // namespace views | 194 } // namespace views |
OLD | NEW |