Chromium Code Reviews| Index: ui/views/accessible_pane_view_unittest.cc |
| diff --git a/ui/views/accessible_pane_view_unittest.cc b/ui/views/accessible_pane_view_unittest.cc |
| index d53fb72f67db1d0e3513b3b11a5633e2f249bce5..7b1b1e97ea2c355438d08165ba20f78bc2fe97f3 100644 |
| --- a/ui/views/accessible_pane_view_unittest.cc |
| +++ b/ui/views/accessible_pane_view_unittest.cc |
| @@ -10,6 +10,10 @@ |
| #include "ui/views/test/views_test_base.h" |
| #include "ui/views/widget/widget.h" |
| +#if defined(OS_MACOSX) |
| +#include "ui/base/test/scoped_fake_nswindow_focus.h" |
| +#endif |
| + |
| namespace views { |
| // TODO(alicet): bring pane rotation into views and add tests. |
| @@ -101,6 +105,13 @@ TEST_F(AccessiblePaneViewTest, SimpleSetPaneFocus) { |
| // This test will not work properly in Windows because it uses ::GetNextWindow |
| // on deactivate which is rather unpredictable where the focus will land. |
| TEST_F(AccessiblePaneViewTest, SetPaneFocusAndRestore) { |
| +#if defined(OS_MACOSX) |
| + // On Aura platforms, this test creates Ash windows and only interacts with |
| + // the Ash window manager. On Mac, it creates native windows, but since unit |
| + // tests cannot gain key status, fake it out here. |
| + ui::test::ScopedFakeNSWindowKeyStatus fake_key; |
| +#endif |
| + |
| View* test_view_main = new View(); |
| scoped_ptr<Widget> widget_main(new Widget()); |
| Widget::InitParams params_main = CreateParams(Widget::InitParams::TYPE_POPUP); |
| @@ -133,9 +144,13 @@ TEST_F(AccessiblePaneViewTest, SetPaneFocusAndRestore) { |
| EXPECT_EQ(test_view_bar->child_button(), |
| test_view_bar->GetWidget()->GetFocusManager()->GetFocusedView()); |
| + // Esc should deactivate the widget. |
| + // Widget::Deactivate is not supported on Mac. |
|
tapted
2015/08/06 03:01:00
I think it's more correct to say that Deactivation
jackhou1
2015/08/06 06:10:57
Done.
|
| +#if !defined(OS_MACOSX) |
| test_view_bar->AcceleratorPressed(test_view_bar->escape_key()); |
| EXPECT_TRUE(widget_main->IsActive()); |
| EXPECT_FALSE(widget_bar->IsActive()); |
| +#endif |
| widget_bar->CloseNow(); |
| widget_bar.reset(); |