OLD | NEW |
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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 EXPECT_EQ(GetSelectedWindow(), window2.get()); | 878 EXPECT_EQ(GetSelectedWindow(), window2.get()); |
879 SendKey(ui::VKEY_TAB); | 879 SendKey(ui::VKEY_TAB); |
880 EXPECT_EQ(GetSelectedWindow(), window1.get()); | 880 EXPECT_EQ(GetSelectedWindow(), window1.get()); |
881 } | 881 } |
882 | 882 |
883 // 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 |
884 // possible direction. | 884 // possible direction. |
885 TEST_F(WindowSelectorTest, BasicArrowKeyNavigation) { | 885 TEST_F(WindowSelectorTest, BasicArrowKeyNavigation) { |
886 if (!SupportsHostWindowResize()) | 886 if (!SupportsHostWindowResize()) |
887 return; | 887 return; |
888 const size_t test_windows = 7; | 888 const size_t test_windows = 9; |
889 UpdateDisplay("400x300"); | 889 UpdateDisplay("800x600"); |
890 ScopedVector<aura::Window> windows; | 890 ScopedVector<aura::Window> windows; |
891 for (size_t i = test_windows; i > 0; i--) | 891 for (size_t i = test_windows; i > 0; i--) |
892 windows.push_back(CreateWindowWithId(gfx::Rect(0, 0, 100, 100), i)); | 892 windows.push_back(CreateWindowWithId(gfx::Rect(0, 0, 100, 100), i)); |
893 | 893 |
894 ui::KeyboardCode arrow_keys[] = { | 894 ui::KeyboardCode arrow_keys[] = { |
895 ui::VKEY_RIGHT, | 895 ui::VKEY_RIGHT, |
896 ui::VKEY_DOWN, | 896 ui::VKEY_DOWN, |
897 ui::VKEY_LEFT, | 897 ui::VKEY_LEFT, |
898 ui::VKEY_UP | 898 ui::VKEY_UP |
899 }; | 899 }; |
900 // Expected window layout: | 900 // Expected window layout, assuming that the text filtering feature is |
901 // +-------+ +-------+ +-------+ | 901 // enabled by default (i.e., --ash-disable-text-filtering-in-overview-mode |
902 // | 1 | | 2 | | 3 | | 902 // is not being used). |
903 // +-------+ +-------+ +-------+ | 903 // +-------+ +-------+ +-------+ +-------+ |
904 // +-------+ +-------+ +-------+ | 904 // | 1 | | 2 | | 3 | | 4 | |
905 // | 4 | | 5 | | 6 | | 905 // +-------+ +-------+ +-------+ +-------+ |
906 // +-------+ +-------+ +-------+ | 906 // +-------+ +-------+ +-------+ +-------+ |
| 907 // | 5 | | 6 | | 7 | | 8 | |
| 908 // +-------+ +-------+ +-------+ +-------+ |
907 // +-------+ | 909 // +-------+ |
908 // | 7 | | 910 // | 9 | |
909 // +-------+ | 911 // +-------+ |
910 // Index for each window during a full loop plus wrapping around. | 912 // Index for each window during a full loop plus wrapping around. |
911 int index_path_for_direction[][test_windows + 1] = { | 913 int index_path_for_direction[][test_windows + 1] = { |
912 {1, 2, 3, 4, 5, 6, 7, 1}, // Right | 914 {1, 2, 3, 4, 5, 6, 7, 8, 9, 1}, // Right |
913 {1, 4, 7, 2, 5, 3, 6, 1}, // Down | 915 {1, 5, 9, 2, 6, 3, 7, 4, 8, 1}, // Down |
914 {7, 6, 5, 4, 3, 2, 1, 7}, // Left | 916 {9, 8, 7, 6, 5, 4, 3, 2, 1, 9}, // Left |
915 {6, 3, 5, 2, 7, 4, 1, 6} // Up | 917 {8, 4, 7, 3, 6, 2, 9, 5, 1, 8} // Up |
916 }; | 918 }; |
917 | 919 |
918 for (size_t key_index = 0; key_index < arraysize(arrow_keys); key_index++) { | 920 for (size_t key_index = 0; key_index < arraysize(arrow_keys); key_index++) { |
919 ToggleOverview(); | 921 ToggleOverview(); |
920 for (size_t i = 0; i < test_windows + 1; i++) { | 922 for (size_t i = 0; i < test_windows + 1; i++) { |
921 SendKey(arrow_keys[key_index]); | 923 SendKey(arrow_keys[key_index]); |
922 // TODO(flackr): Add a more readable error message by constructing a | 924 // TODO(flackr): Add a more readable error message by constructing a |
923 // string from the window IDs. | 925 // string from the window IDs. |
924 EXPECT_EQ(GetSelectedWindow()->id(), | 926 EXPECT_EQ(GetSelectedWindow()->id(), |
925 index_path_for_direction[key_index][i]); | 927 index_path_for_direction[key_index][i]); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 // Dimming all the items should hide the selection widget. | 1132 // Dimming all the items should hide the selection widget. |
1131 FilterItems("Pop"); | 1133 FilterItems("Pop"); |
1132 EXPECT_FALSE(selection_widget_active()); | 1134 EXPECT_FALSE(selection_widget_active()); |
1133 | 1135 |
1134 // Undimming one window should automatically select it. | 1136 // Undimming one window should automatically select it. |
1135 FilterItems("Rock and roll"); | 1137 FilterItems("Rock and roll"); |
1136 EXPECT_EQ(GetSelectedWindow(), window2.get()); | 1138 EXPECT_EQ(GetSelectedWindow(), window2.get()); |
1137 } | 1139 } |
1138 | 1140 |
1139 } // namespace ash | 1141 } // namespace ash |
OLD | NEW |