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 | |
120 combobox_->RequestFocus(); | 116 combobox_->RequestFocus(); |
121 } | 117 } |
122 | 118 |
123 protected: | 119 protected: |
124 void SendKeyEvent(ui::KeyboardCode key_code) { | 120 void SendKeyEvent(ui::KeyboardCode key_code) { |
125 ui::KeyEvent event(ui::ET_KEY_PRESSED, key_code, 0, false); | 121 ui::KeyEvent event(ui::ET_KEY_PRESSED, key_code, 0, false); |
126 input_method_->DispatchKeyEvent(event); | 122 input_method_->DispatchKeyEvent(event); |
127 } | 123 } |
128 | 124 |
129 View* GetFocusedView() { | 125 View* GetFocusedView() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 widget_->SetContentsView(container); | 181 widget_->SetContentsView(container); |
186 container->AddChildView(combobox_); | 182 container->AddChildView(combobox_); |
187 | 183 |
188 combobox_view_ = static_cast<NativeComboboxViews*>( | 184 combobox_view_ = static_cast<NativeComboboxViews*>( |
189 combobox_->GetNativeWrapperForTesting()); | 185 combobox_->GetNativeWrapperForTesting()); |
190 ASSERT_TRUE(combobox_view_); | 186 ASSERT_TRUE(combobox_view_); |
191 ASSERT_FALSE(combobox_view_->enabled()); | 187 ASSERT_FALSE(combobox_view_->enabled()); |
192 } | 188 } |
193 | 189 |
194 } // namespace views | 190 } // namespace views |
OLD | NEW |