Chromium Code Reviews| Index: ash/wm/window_cycle_controller_unittest.cc |
| diff --git a/ash/wm/window_cycle_controller_unittest.cc b/ash/wm/window_cycle_controller_unittest.cc |
| index ad61331fc9d2040e3e076c45d4054fcd25f5f6c4..142bc389aa2745e086e7a007e04dd28e6fb24fa0 100644 |
| --- a/ash/wm/window_cycle_controller_unittest.cc |
| +++ b/ash/wm/window_cycle_controller_unittest.cc |
| @@ -14,6 +14,7 @@ |
| #include "ash/common/shell_window_ids.h" |
| #include "ash/common/wm/window_cycle_list.h" |
| #include "ash/common/wm/window_state.h" |
| +#include "ash/common/wm/wm_event.h" |
| #include "ash/common/wm_shell.h" |
| #include "ash/shelf/shelf.h" |
| #include "ash/shelf/shelf_widget.h" |
| @@ -615,4 +616,34 @@ TEST_F(WindowCycleControllerTest, TabKeyNotLeaked) { |
| EXPECT_EQ(0u, key_count.GetCountAndReset()); |
| } |
| +// Tests that we can cycle past fullscreen windows: https://crbug.com/622396. |
| +// Fullscreen windows are special in that they are allowed to handle alt+tab |
| +// keypresses, which means the window cycle event filter should not handle |
| +// the tab press else it prevents cycling past that window. |
| +TEST_F(WindowCycleControllerTest, TabPastFullscreenWindow) { |
| + std::unique_ptr<Window> w0(CreateTestWindowInShellWithId(0)); |
| + std::unique_ptr<Window> w1(CreateTestWindowInShellWithId(1)); |
| + wm::WMEvent maximize_event(wm::WM_EVENT_FULLSCREEN); |
| + wm::GetWindowState(w1.get())->Activate(); |
| + wm::GetWindowState(w1.get())->OnWMEvent(&maximize_event); |
| + EXPECT_TRUE(wm::GetWindowState(w1.get())->IsFullscreen()); |
| + wm::GetWindowState(w0.get())->Activate(); |
| + |
| + ui::test::EventGenerator& generator = GetEventGenerator(); |
|
varkha
2016/08/17 18:06:57
nit: Could swap the line before and above this com
flackr
2016/08/17 19:07:19
Done.
|
| + EXPECT_TRUE(wm::GetWindowState(w0.get())->IsActive()); |
| + generator.PressKey(ui::VKEY_MENU, ui::EF_NONE); |
| + |
| + generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); |
| + generator.ReleaseKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); |
| + EXPECT_TRUE(wm::GetWindowState(w1.get())->IsActive()); |
| + |
| + // Because w1 is full-screen, the event should be passed to the browser |
| + // window to handle it (which if the browser doesn't handle it will pass on |
| + // the alt+tab to continue cycling). |
| + KeyEventCounter key_count; |
| + w1->AddPreTargetHandler(&key_count); |
| + generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); |
| + EXPECT_EQ(1u, key_count.GetCountAndReset()); |
| +} |
| + |
| } // namespace ash |