Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: ui/views/controls/combobox/native_combobox_views_unittest.cc

Issue 9817007: ui/base/models: Add protected virtual destructor to ComboboxModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittest Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/models/combobox_model.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 input_method_->DispatchKeyEvent(event); 128 input_method_->DispatchKeyEvent(event);
129 } 129 }
130 130
131 View* GetFocusedView() { 131 View* GetFocusedView() {
132 return widget_->GetFocusManager()->GetFocusedView(); 132 return widget_->GetFocusManager()->GetFocusedView();
133 } 133 }
134 134
135 // We need widget to populate wrapper class. 135 // We need widget to populate wrapper class.
136 Widget* widget_; 136 Widget* widget_;
137 137
138 // combobox_ will be allocated InitCombobox() and then owned by widget_. 138 // |combobox_| will be allocated InitCombobox() and then owned by |widget_|.
139 TestCombobox* combobox_; 139 TestCombobox* combobox_;
140 140
141 // combobox_view_ is the pointer to the pure Views interface of combobox_. 141 // |combobox_view_| is the pointer to the pure Views interface of |combobox_|.
142 NativeComboboxViews* combobox_view_; 142 NativeComboboxViews* combobox_view_;
143 143
144 // Combobox does not take ownership of model_, which needs to be scoped. 144 // Combobox does not take ownership of the model, hence it needs to be scoped.
145 scoped_ptr<ui::ComboboxModel> model_; 145 scoped_ptr<TestComboboxModel> model_;
146 146
147 // For testing input method related behaviors. 147 // For testing input method related behaviors.
148 MockInputMethod* input_method_; 148 MockInputMethod* input_method_;
149 }; 149 };
150 150
151 TEST_F(NativeComboboxViewsTest, KeyTest) { 151 TEST_F(NativeComboboxViewsTest, KeyTest) {
152 InitCombobox(); 152 InitCombobox();
153 SendKeyEvent(ui::VKEY_END); 153 SendKeyEvent(ui::VKEY_END);
154 EXPECT_EQ(combobox_->selected_item() + 1, model_->GetItemCount()); 154 EXPECT_EQ(combobox_->selected_item() + 1, model_->GetItemCount());
155 SendKeyEvent(ui::VKEY_HOME); 155 SendKeyEvent(ui::VKEY_HOME);
(...skipping 25 matching lines...) Expand all
181 widget_->SetContentsView(container); 181 widget_->SetContentsView(container);
182 container->AddChildView(combobox_); 182 container->AddChildView(combobox_);
183 183
184 combobox_view_ = static_cast<NativeComboboxViews*>( 184 combobox_view_ = static_cast<NativeComboboxViews*>(
185 combobox_->GetNativeWrapperForTesting()); 185 combobox_->GetNativeWrapperForTesting());
186 ASSERT_TRUE(combobox_view_); 186 ASSERT_TRUE(combobox_view_);
187 ASSERT_FALSE(combobox_view_->enabled()); 187 ASSERT_FALSE(combobox_view_->enabled());
188 } 188 }
189 189
190 } // namespace views 190 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/models/combobox_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698