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

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 436713002: Pressing tab in overview should cycle windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unittest. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/overview/window_selector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "ash/accessibility_delegate.h" 7 #include "ash/accessibility_delegate.h"
8 #include "ash/drag_drop/drag_drop_controller.h" 8 #include "ash/drag_drop/drag_drop_controller.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 // bounds. 858 // bounds.
859 UpdateDisplay("600x200/r"); 859 UpdateDisplay("600x200/r");
860 EXPECT_EQ("0,0 200x600", root_window->bounds().ToString()); 860 EXPECT_EQ("0,0 200x600", root_window->bounds().ToString());
861 for (ScopedVector<aura::Window>::iterator iter = windows.begin(); 861 for (ScopedVector<aura::Window>::iterator iter = windows.begin();
862 iter != windows.end(); ++iter) { 862 iter != windows.end(); ++iter) {
863 EXPECT_TRUE(root_window->bounds().Contains( 863 EXPECT_TRUE(root_window->bounds().Contains(
864 ToEnclosingRect(GetTransformedTargetBounds(*iter)))); 864 ToEnclosingRect(GetTransformedTargetBounds(*iter))));
865 } 865 }
866 } 866 }
867 867
868 // Tests traversing some windows in overview mode with the tab key.
869 TEST_F(WindowSelectorTest, BasicTabKeyNavigation) {
870 gfx::Rect bounds(0, 0, 100, 100);
871 scoped_ptr<aura::Window> window2(CreateWindow(bounds));
872 scoped_ptr<aura::Window> window1(CreateWindow(bounds));
873 ToggleOverview();
874
875 SendKey(ui::VKEY_TAB);
876 EXPECT_EQ(GetSelectedWindow(), window1.get());
877 SendKey(ui::VKEY_TAB);
878 EXPECT_EQ(GetSelectedWindow(), window2.get());
879 SendKey(ui::VKEY_TAB);
880 EXPECT_EQ(GetSelectedWindow(), window1.get());
881 }
882
868 // Tests traversing some windows in overview mode with the arrow keys in every 883 // Tests traversing some windows in overview mode with the arrow keys in every
869 // possible direction. 884 // possible direction.
870 TEST_F(WindowSelectorTest, BasicArrowKeyNavigation) { 885 TEST_F(WindowSelectorTest, BasicArrowKeyNavigation) {
871 if (!SupportsHostWindowResize()) 886 if (!SupportsHostWindowResize())
872 return; 887 return;
873 const size_t test_windows = 7; 888 const size_t test_windows = 7;
874 UpdateDisplay("400x300"); 889 UpdateDisplay("400x300");
875 ScopedVector<aura::Window> windows; 890 ScopedVector<aura::Window> windows;
876 for (size_t i = test_windows; i > 0; i--) 891 for (size_t i = test_windows; i > 0; i--)
877 windows.push_back(CreateWindowWithId(gfx::Rect(0, 0, 100, 100), i)); 892 windows.push_back(CreateWindowWithId(gfx::Rect(0, 0, 100, 100), i));
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 // Dimming all the items should hide the selection widget. 1130 // Dimming all the items should hide the selection widget.
1116 FilterItems("Pop"); 1131 FilterItems("Pop");
1117 EXPECT_FALSE(selection_widget_active()); 1132 EXPECT_FALSE(selection_widget_active());
1118 1133
1119 // Undimming one window should automatically select it. 1134 // Undimming one window should automatically select it.
1120 FilterItems("Rock and roll"); 1135 FilterItems("Rock and roll");
1121 EXPECT_EQ(GetSelectedWindow(), window2.get()); 1136 EXPECT_EQ(GetSelectedWindow(), window2.get());
1122 } 1137 }
1123 1138
1124 } // namespace ash 1139 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698