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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/accessibility_delegate.h" 5 #include "ash/accessibility_delegate.h"
6 #include "ash/drag_drop/drag_drop_controller.h" 6 #include "ash/drag_drop/drag_drop_controller.h"
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_widget.h" 10 #include "ash/shelf/shelf_widget.h"
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 SendKey(ui::VKEY_RIGHT); 854 SendKey(ui::VKEY_RIGHT);
855 EXPECT_EQ(GetSelectedWindow(), window1.get()); 855 EXPECT_EQ(GetSelectedWindow(), window1.get());
856 SendKey(ui::VKEY_RIGHT); 856 SendKey(ui::VKEY_RIGHT);
857 EXPECT_EQ(GetSelectedWindow(), window2.get()); 857 EXPECT_EQ(GetSelectedWindow(), window2.get());
858 SendKey(ui::VKEY_RIGHT); 858 SendKey(ui::VKEY_RIGHT);
859 EXPECT_EQ(GetSelectedWindow(), window3.get()); 859 EXPECT_EQ(GetSelectedWindow(), window3.get());
860 SendKey(ui::VKEY_RIGHT); 860 SendKey(ui::VKEY_RIGHT);
861 EXPECT_EQ(GetSelectedWindow(), window4.get()); 861 EXPECT_EQ(GetSelectedWindow(), window4.get());
862 } 862 }
863 863
864 // Tests selecting a window in overview mode with the return key.
865 TEST_F(WindowSelectorTest, SelectWindowWithReturnKey) {
866 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.
867 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
868 scoped_ptr<aura::Window> window1(CreateWindow(bounds1));
869 ToggleOverview();
870
871 // Pressing the return key without a selection widget should not do anything.
872 SendKey(ui::VKEY_RETURN);
873 EXPECT_TRUE(IsSelecting());
874
875 // Select the first window.
876 SendKey(ui::VKEY_RIGHT);
877 SendKey(ui::VKEY_RETURN);
878 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
879 EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
880
881 // Select the second window.
882 ToggleOverview();
883 SendKey(ui::VKEY_RIGHT);
884 SendKey(ui::VKEY_RIGHT);
885 SendKey(ui::VKEY_RETURN);
886 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.
887 }
888
864 } // namespace ash 889 } // namespace ash
OLDNEW
« 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