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

Unified Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 2072853002: Implement "pinned" mode in ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 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 | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller_unittest.cc
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index 78df54b23583644e4ee0a35a6958f7922cf4d247..2ed4eb51efc709fa13ca94484a4bdad15354da5b 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -1181,6 +1181,36 @@ TEST_F(PreferredReservedAcceleratorsTest, AcceleratorsWithFullscreen) {
ASSERT_EQ(w2, wm::GetActiveWindow());
}
+TEST_F(PreferredReservedAcceleratorsTest, AcceleratorsWithPinned) {
+ aura::Window* w1 = CreateTestWindowInShellWithId(0);
+ aura::Window* w2 = CreateTestWindowInShellWithId(1);
+ wm::ActivateWindow(w1);
+
+ {
+ wm::WMEvent pin_event(wm::WM_EVENT_PIN);
+ wm::WindowState* w1_state = wm::GetWindowState(w1);
+ w1_state->OnWMEvent(&pin_event);
+ ASSERT_TRUE(w1_state->IsPinned());
+ }
+
+ ui::test::EventGenerator& generator = GetEventGenerator();
+#if defined(OS_CHROMEOS)
+ // Power key (reserved) should always be handled.
+ LockStateController::TestApi test_api(
+ Shell::GetInstance()->lock_state_controller());
+ EXPECT_FALSE(test_api.is_animating_lock());
+ generator.PressKey(ui::VKEY_POWER, ui::EF_NONE);
+ EXPECT_TRUE(test_api.is_animating_lock());
+#endif
+
+ // A pinned window can consume ALT-TAB (preferred), but no side effect.
+ ASSERT_EQ(w1, wm::GetActiveWindow());
+ generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
+ generator.ReleaseKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
+ ASSERT_EQ(w1, wm::GetActiveWindow());
+ ASSERT_NE(w2, wm::GetActiveWindow());
+}
+
#if defined(OS_CHROMEOS)
TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) {
std::set<AcceleratorAction> all_actions;
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698