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

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

Issue 2728373003: Fixs bug resulting in double event delivery in mus (Closed)
Patch Set: comments Created 3 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
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 combobox_ = new TestCombobox(model_.get(), style); 205 combobox_ = new TestCombobox(model_.get(), style);
206 test_api_.reset(new ComboboxTestApi(combobox_)); 206 test_api_.reset(new ComboboxTestApi(combobox_));
207 test_api_->InstallTestMenuRunner(&menu_show_count_); 207 test_api_->InstallTestMenuRunner(&menu_show_count_);
208 combobox_->set_id(1); 208 combobox_->set_id(1);
209 209
210 widget_ = new Widget; 210 widget_ = new Widget;
211 Widget::InitParams params = 211 Widget::InitParams params =
212 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); 212 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
213 params.bounds = gfx::Rect(200, 200, 200, 200); 213 params.bounds = gfx::Rect(200, 200, 200, 200);
214 widget_->Init(params); 214 widget_->Init(params);
215 // This test sends events that in mus are normally routed to ime. Disable
216 // talking to the server so the test doesn't have to wait for the ack.
217 DisableMusInputMethod(widget_);
215 View* container = new View(); 218 View* container = new View();
216 widget_->SetContentsView(container); 219 widget_->SetContentsView(container);
217 container->AddChildView(combobox_); 220 container->AddChildView(combobox_);
218 widget_->Show(); 221 widget_->Show();
219 222
220 combobox_->RequestFocus(); 223 combobox_->RequestFocus();
221 combobox_->SizeToPreferredSize(); 224 combobox_->SizeToPreferredSize();
222 225
223 event_generator_ = 226 event_generator_ =
224 base::MakeUnique<ui::test::EventGenerator>(widget_->GetNativeWindow()); 227 base::MakeUnique<ui::test::EventGenerator>(widget_->GetNativeWindow());
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); 919 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0));
917 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); 920 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1));
918 921
919 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); 922 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0));
920 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); 923 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1));
921 EXPECT_FALSE(menu_model->IsVisibleAt(0)); 924 EXPECT_FALSE(menu_model->IsVisibleAt(0));
922 EXPECT_TRUE(menu_model->IsVisibleAt(1)); 925 EXPECT_TRUE(menu_model->IsVisibleAt(1));
923 } 926 }
924 927
925 } // namespace views 928 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698