Chromium Code Reviews| Index: ui/views/view_unittest.cc |
| diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc |
| index 7d7000017867ad0633f2d8aa12fe5f182343e457..f222dad8a5098d42267cc7254d6dfa5b1ec187e8 100644 |
| --- a/ui/views/view_unittest.cc |
| +++ b/ui/views/view_unittest.cc |
| @@ -2106,6 +2106,7 @@ bool TestView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| // handle accelerators or not (see View::CanHandleAccelerators for details). |
| // This test targets that extra logic, but should also work on other platforms. |
| TEST_F(ViewTest, HandleAccelerator) { |
| + EnableMacFakeWindowActivation(); |
| ui::Accelerator return_accelerator(ui::VKEY_RETURN, ui::EF_NONE); |
| TestView* view = new TestView(); |
| view->Reset(); |
| @@ -2115,7 +2116,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 +2133,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); |
|
tapted
2016/03/10 10:52:42
There's nothing in NativeWidgetAura::Activate that
|
| + |
| // When a non-child view is active, it should handle accelerators. |
| view->accelerator_count_map_[return_accelerator] = 0; |
| widget->Activate(); |