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

Unified Diff: ash/wm/overview/window_selector_unittest.cc

Issue 324493004: Fix pressing enter key crashes overview mode without a selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unittest Created 6 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
« ash/wm/overview/window_selector.cc ('K') | « ash/wm/overview/window_selector.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/overview/window_selector_unittest.cc
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc
index 01fad7d9c29807220146439f26ce8a2b4e914de5..8b223968d54626f647cb71d857126d5217ca9973 100644
--- a/ash/wm/overview/window_selector_unittest.cc
+++ b/ash/wm/overview/window_selector_unittest.cc
@@ -861,4 +861,29 @@ TEST_F(WindowSelectorTest, BasicMultiMonitorArrowKeyNavigation) {
EXPECT_EQ(GetSelectedWindow(), window4.get());
}
+// Tests selecting a window in overview mode with the return key.
+TEST_F(WindowSelectorTest, SelectWindowWithReturnKey) {
+ gfx::Rect bounds1(0, 0, 100, 100);
tdanderson 2014/06/06 21:15:18 nit: bounds, not bounds1.
Nina 2014/06/06 21:44:32 Done.
+ scoped_ptr<aura::Window> window2(CreateWindow(bounds1));
tdanderson 2014/06/06 21:15:18 nit: declare window1 before window2
Nina 2014/06/06 21:44:32 The reason the declaration is in that order is so
+ scoped_ptr<aura::Window> window1(CreateWindow(bounds1));
+ ToggleOverview();
+
+ // Pressing the return key without a selection widget should not do anything.
+ SendKey(ui::VKEY_RETURN);
+ EXPECT_TRUE(IsSelecting());
+
+ // Select the first window.
+ SendKey(ui::VKEY_RIGHT);
+ SendKey(ui::VKEY_RETURN);
+ ASSERT_FALSE(IsSelecting());
tdanderson 2014/06/06 21:15:17 EXPECT_FALSE? (ASSERT_FALSE will crash the test at
Nina 2014/06/06 21:44:32 I want the test to stop if that fails as the outco
+ EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
+
+ // Select the second window.
+ ToggleOverview();
+ SendKey(ui::VKEY_RIGHT);
+ SendKey(ui::VKEY_RIGHT);
+ SendKey(ui::VKEY_RETURN);
+ EXPECT_TRUE(wm::IsActiveWindow(window2.get()));
tdanderson 2014/06/06 21:15:17 Can you also add an EXPECT for IsSelecting() here
Nina 2014/06/06 21:44:32 Sure.
+}
+
} // namespace ash
« ash/wm/overview/window_selector.cc ('K') | « ash/wm/overview/window_selector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698