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

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

Issue 2371113003: Do not give instant focus if a view's toplevelwidget is not active (Closed)
Patch Set: based on comments Created 4 years, 2 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
« no previous file with comments | « chrome/test/BUILD.gn ('k') | ui/views/focus/focus_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/views/controls/combobox/combobox.h" 5 #include "ui/views/controls/combobox/combobox.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 test_api_.reset(new ComboboxTestApi(combobox_)); 204 test_api_.reset(new ComboboxTestApi(combobox_));
205 combobox_->set_id(1); 205 combobox_->set_id(1);
206 206
207 widget_ = new Widget; 207 widget_ = new Widget;
208 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); 208 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP);
209 params.bounds = gfx::Rect(200, 200, 200, 200); 209 params.bounds = gfx::Rect(200, 200, 200, 200);
210 widget_->Init(params); 210 widget_->Init(params);
211 View* container = new View(); 211 View* container = new View();
212 widget_->SetContentsView(container); 212 widget_->SetContentsView(container);
213 container->AddChildView(combobox_); 213 container->AddChildView(combobox_);
214 widget_->Show();
214 215
215 combobox_->RequestFocus(); 216 combobox_->RequestFocus();
216 combobox_->SizeToPreferredSize(); 217 combobox_->SizeToPreferredSize();
217 } 218 }
218 219
219 protected: 220 protected:
220 void SendKeyEvent(ui::KeyboardCode key_code) { 221 void SendKeyEvent(ui::KeyboardCode key_code) {
221 SendKeyEventWithType(key_code, ui::ET_KEY_PRESSED); 222 SendKeyEventWithType(key_code, ui::ET_KEY_PRESSED);
222 } 223 }
223 224
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); 818 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0));
818 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); 819 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1));
819 820
820 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); 821 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0));
821 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); 822 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1));
822 EXPECT_FALSE(menu_model->IsVisibleAt(0)); 823 EXPECT_FALSE(menu_model->IsVisibleAt(0));
823 EXPECT_TRUE(menu_model->IsVisibleAt(1)); 824 EXPECT_TRUE(menu_model->IsVisibleAt(1));
824 } 825 }
825 826
826 } // namespace views 827 } // namespace views
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | ui/views/focus/focus_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698