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

Unified Diff: ash/wm/window_cycle_controller_unittest.cc

Issue 2252673002: Don't handle the tab press event in the window cycle event filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge and fix test for new alt+tab UI. Created 4 years, 4 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 | « no previous file | ash/wm/window_cycle_event_filter_aura.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c26d3d5bdfe8272431a08be5c57ff18fad6b32c5..03a5a93c355eb6ba2798cb960f45cb7b7ed8e1d0 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"
@@ -573,4 +574,41 @@ 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);
+
+ // To make this test work with or without the new alt+tab selector we make
+ // both the initial window and the second window fullscreen.
+ wm::GetWindowState(w0.get())->OnWMEvent(&maximize_event);
+ wm::GetWindowState(w1.get())->Activate();
+ wm::GetWindowState(w1.get())->OnWMEvent(&maximize_event);
+ EXPECT_TRUE(wm::GetWindowState(w0.get())->IsFullscreen());
+ EXPECT_TRUE(wm::GetWindowState(w1.get())->IsFullscreen());
+ wm::GetWindowState(w0.get())->Activate();
+ EXPECT_TRUE(wm::GetWindowState(w0.get())->IsActive());
+
+ ui::test::EventGenerator& generator = GetEventGenerator();
+ 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);
+
+ // Because w0 and w1 are 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). To make this test work with or
+ // without the new alt+tab selector we check for the event on either
+ // fullscreen window.
+ KeyEventCounter key_count;
+ w0->AddPreTargetHandler(&key_count);
+ w1->AddPreTargetHandler(&key_count);
+ generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
+ EXPECT_EQ(1u, key_count.GetCountAndReset());
+}
+
} // namespace ash
« no previous file with comments | « no previous file | ash/wm/window_cycle_event_filter_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698