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

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: 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') | ash/wm/window_cycle_event_filter_aura.cc » ('J')
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 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
« no previous file with comments | « no previous file | ash/wm/window_cycle_event_filter_aura.cc » ('j') | ash/wm/window_cycle_event_filter_aura.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698