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

Unified Diff: ui/views/view_unittest.cc

Issue 1782773002: MacViews: Fix ViewTest.HandleAccelerator by faking window activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Faked activations for everyone! Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/test/widget_test_mac.mm ('k') | ui/views/views.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view_unittest.cc
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index 7d7000017867ad0633f2d8aa12fe5f182343e457..4b50b319ad2556c1533674235ada984e97361550 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -2115,7 +2115,7 @@ TEST_F(ViewTest, HandleAccelerator) {
// Create a window and add the view as its child.
scoped_ptr<Widget> widget(new Widget);
Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP);
- params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.bounds = gfx::Rect(0, 0, 100, 100);
widget->Init(params);
View* root = widget->GetRootView();
@@ -2132,6 +2132,10 @@ TEST_F(ViewTest, HandleAccelerator) {
EXPECT_EQ(0, view->accelerator_count_map_[return_accelerator]);
#endif
+ // TYPE_POPUP widgets default to non-activatable, so the Show() above wouldn't
+ // have activated the Widget. First, allow activation.
+ widget->widget_delegate()->set_can_activate(true);
+
// When a non-child view is active, it should handle accelerators.
view->accelerator_count_map_[return_accelerator] = 0;
widget->Activate();
« no previous file with comments | « ui/views/test/widget_test_mac.mm ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698