| 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 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ash/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
| 10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 WindowSelector* window_selector() { | 181 WindowSelector* window_selector() { |
| 182 return window_selector_controller()->window_selector_.get(); | 182 return window_selector_controller()->window_selector_.get(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void ToggleOverview() { window_selector_controller()->ToggleOverview(); } | 185 void ToggleOverview() { window_selector_controller()->ToggleOverview(); } |
| 186 | 186 |
| 187 gfx::RectF GetTransformedBounds(aura::Window* window) { | 187 gfx::RectF GetTransformedBounds(aura::Window* window) { |
| 188 gfx::RectF bounds(ScreenUtil::ConvertRectToScreen( | 188 gfx::RectF bounds(ScreenUtil::ConvertRectToScreen( |
| 189 window->parent(), window->layer()->bounds())); | 189 window->parent(), window->layer()->bounds())); |
| 190 gfx::Transform transform(gfx::TransformAboutPivot( | 190 gfx::Transform transform(gfx::TransformAboutPivot( |
| 191 gfx::ToFlooredPoint(bounds.origin()), | 191 gfx::ToFlooredPoint(bounds.origin()), window->layer()->transform())); |
| 192 window->layer()->transform())); | |
| 193 transform.TransformRect(&bounds); | 192 transform.TransformRect(&bounds); |
| 194 return bounds; | 193 return bounds; |
| 195 } | 194 } |
| 196 | 195 |
| 197 gfx::RectF GetTransformedTargetBounds(aura::Window* window) { | 196 gfx::RectF GetTransformedTargetBounds(aura::Window* window) { |
| 198 gfx::RectF bounds(ScreenUtil::ConvertRectToScreen( | 197 gfx::RectF bounds(ScreenUtil::ConvertRectToScreen( |
| 199 window->parent(), window->layer()->GetTargetBounds())); | 198 window->parent(), window->layer()->GetTargetBounds())); |
| 200 gfx::Transform transform(gfx::TransformAboutPivot( | 199 gfx::Transform transform( |
| 201 gfx::ToFlooredPoint(bounds.origin()), | 200 gfx::TransformAboutPivot(gfx::ToFlooredPoint(bounds.origin()), |
| 202 window->layer()->GetTargetTransform())); | 201 window->layer()->GetTargetTransform())); |
| 203 transform.TransformRect(&bounds); | 202 transform.TransformRect(&bounds); |
| 204 return bounds; | 203 return bounds; |
| 205 } | 204 } |
| 206 | 205 |
| 207 gfx::RectF GetTransformedBoundsInRootWindow(aura::Window* window) { | 206 gfx::RectF GetTransformedBoundsInRootWindow(aura::Window* window) { |
| 208 gfx::RectF bounds = gfx::RectF(gfx::SizeF(window->bounds().size())); | 207 gfx::RectF bounds = gfx::RectF(gfx::SizeF(window->bounds().size())); |
| 209 aura::Window* root = window->GetRootWindow(); | 208 aura::Window* root = window->GetRootWindow(); |
| 210 CHECK(window->layer()); | 209 CHECK(window->layer()); |
| 211 CHECK(root->layer()); | 210 CHECK(root->layer()); |
| 212 gfx::Transform transform; | 211 gfx::Transform transform; |
| 213 if (!window->layer()->GetTargetTransformRelativeTo(root->layer(), | 212 if (!window->layer()->GetTargetTransformRelativeTo(root->layer(), |
| 214 &transform)) { | 213 &transform)) { |
| 215 return gfx::RectF(); | 214 return gfx::RectF(); |
| 216 } | 215 } |
| 217 transform.TransformRect(&bounds); | 216 transform.TransformRect(&bounds); |
| 218 return bounds; | 217 return bounds; |
| 219 } | 218 } |
| 220 | 219 |
| 221 void ClickWindow(aura::Window* window) { | 220 void ClickWindow(aura::Window* window) { |
| 222 ui::test::EventGenerator event_generator(window->GetRootWindow(), window); | 221 ui::test::EventGenerator event_generator(window->GetRootWindow(), window); |
| 223 event_generator.ClickLeftButton(); | 222 event_generator.ClickLeftButton(); |
| 224 } | 223 } |
| 225 | 224 |
| 226 void SendKey(ui::KeyboardCode key) { | 225 void SendKey(ui::KeyboardCode key) { |
| 227 ui::test::EventGenerator event_generator(Shell::GetPrimaryRootWindow()); | 226 ui::test::EventGenerator event_generator(Shell::GetPrimaryRootWindow()); |
| 228 event_generator.PressKey(key, 0); | 227 event_generator.PressKey(key, 0); |
| 229 event_generator.ReleaseKey(key, 0); | 228 event_generator.ReleaseKey(key, 0); |
| 230 } | 229 } |
| 231 | 230 |
| 232 bool IsSelecting() { return window_selector_controller()->IsSelecting(); } | 231 bool IsSelecting() { return window_selector_controller()->IsSelecting(); } |
| 233 | 232 |
| 234 aura::Window* GetFocusedWindow() { | 233 aura::Window* GetFocusedWindow() { |
| 235 return aura::client::GetFocusClient( | 234 return aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) |
| 236 Shell::GetPrimaryRootWindow())->GetFocusedWindow(); | 235 ->GetFocusedWindow(); |
| 237 } | 236 } |
| 238 | 237 |
| 239 const std::vector<WindowSelectorItem*>& GetWindowItemsForRoot(int index) { | 238 const std::vector<WindowSelectorItem*>& GetWindowItemsForRoot(int index) { |
| 240 return window_selector()->grid_list_[index]->window_list_.get(); | 239 return window_selector()->grid_list_[index]->window_list_.get(); |
| 241 } | 240 } |
| 242 | 241 |
| 243 WindowSelectorItem* GetWindowItemForWindow(int grid_index, | 242 WindowSelectorItem* GetWindowItemForWindow(int grid_index, |
| 244 aura::Window* window) { | 243 aura::Window* window) { |
| 245 const std::vector<WindowSelectorItem*>& windows = | 244 const std::vector<WindowSelectorItem*>& windows = |
| 246 GetWindowItemsForRoot(grid_index); | 245 GetWindowItemsForRoot(grid_index); |
| 247 auto iter = std::find_if(windows.cbegin(), windows.cend(), | 246 auto iter = std::find_if(windows.cbegin(), windows.cend(), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 ToEnclosingRect(GetTransformedTargetBounds(window)))); | 310 ToEnclosingRect(GetTransformedTargetBounds(window)))); |
| 312 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( | 311 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( |
| 313 ToEnclosingRect(GetTransformedTargetBounds( | 312 ToEnclosingRect(GetTransformedTargetBounds( |
| 314 GetCloseButton(window_item)->GetNativeView())))); | 313 GetCloseButton(window_item)->GetNativeView())))); |
| 315 } | 314 } |
| 316 | 315 |
| 317 void FilterItems(const base::StringPiece& pattern) { | 316 void FilterItems(const base::StringPiece& pattern) { |
| 318 window_selector()->ContentsChanged(nullptr, base::UTF8ToUTF16(pattern)); | 317 window_selector()->ContentsChanged(nullptr, base::UTF8ToUTF16(pattern)); |
| 319 } | 318 } |
| 320 | 319 |
| 321 test::ShelfViewTestAPI* shelf_view_test() { | 320 test::ShelfViewTestAPI* shelf_view_test() { return shelf_view_test_.get(); } |
| 322 return shelf_view_test_.get(); | |
| 323 } | |
| 324 | 321 |
| 325 views::Widget* text_filter_widget() { | 322 views::Widget* text_filter_widget() { |
| 326 return window_selector()->text_filter_widget_.get(); | 323 return window_selector()->text_filter_widget_.get(); |
| 327 } | 324 } |
| 328 | 325 |
| 329 private: | 326 private: |
| 330 aura::test::TestWindowDelegate delegate_; | 327 aura::test::TestWindowDelegate delegate_; |
| 331 NonActivatableActivationDelegate non_activatable_activation_delegate_; | 328 NonActivatableActivationDelegate non_activatable_activation_delegate_; |
| 332 std::unique_ptr<test::ShelfViewTestAPI> shelf_view_test_; | 329 std::unique_ptr<test::ShelfViewTestAPI> shelf_view_test_; |
| 333 std::unique_ptr<test::MaterialDesignControllerTestAPI> material_design_state_; | 330 std::unique_ptr<test::MaterialDesignControllerTestAPI> material_design_state_; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 TEST_P(WindowSelectorTest, BasicGesture) { | 620 TEST_P(WindowSelectorTest, BasicGesture) { |
| 624 gfx::Rect bounds(0, 0, 400, 400); | 621 gfx::Rect bounds(0, 0, 400, 400); |
| 625 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 622 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| 626 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); | 623 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); |
| 627 wm::ActivateWindow(window1.get()); | 624 wm::ActivateWindow(window1.get()); |
| 628 EXPECT_EQ(window1.get(), GetFocusedWindow()); | 625 EXPECT_EQ(window1.get(), GetFocusedWindow()); |
| 629 ToggleOverview(); | 626 ToggleOverview(); |
| 630 EXPECT_EQ(text_filter_widget()->GetNativeWindow(), GetFocusedWindow()); | 627 EXPECT_EQ(text_filter_widget()->GetNativeWindow(), GetFocusedWindow()); |
| 631 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 628 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 632 window2.get()); | 629 window2.get()); |
| 633 generator.GestureTapAt(gfx::ToEnclosingRect( | 630 generator.GestureTapAt( |
| 634 GetTransformedTargetBounds(window2.get())).CenterPoint()); | 631 gfx::ToEnclosingRect(GetTransformedTargetBounds(window2.get())) |
| 632 .CenterPoint()); |
| 635 EXPECT_EQ(window2.get(), GetFocusedWindow()); | 633 EXPECT_EQ(window2.get(), GetFocusedWindow()); |
| 636 } | 634 } |
| 637 | 635 |
| 638 // Tests that the user action WindowSelector_ActiveWindowChanged is | 636 // Tests that the user action WindowSelector_ActiveWindowChanged is |
| 639 // recorded when the mouse/touchscreen/keyboard are used to select a window | 637 // recorded when the mouse/touchscreen/keyboard are used to select a window |
| 640 // in overview mode which is different from the previously-active window. | 638 // in overview mode which is different from the previously-active window. |
| 641 TEST_P(WindowSelectorTest, ActiveWindowChangedUserActionRecorded) { | 639 TEST_P(WindowSelectorTest, ActiveWindowChangedUserActionRecorded) { |
| 642 base::UserActionTester user_action_tester; | 640 base::UserActionTester user_action_tester; |
| 643 gfx::Rect bounds(0, 0, 400, 400); | 641 gfx::Rect bounds(0, 0, 400, 400); |
| 644 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 642 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 EXPECT_TRUE(shelf->GetDimsShelf()); | 939 EXPECT_TRUE(shelf->GetDimsShelf()); |
| 942 } | 940 } |
| 943 | 941 |
| 944 // Tests that entering overview when a fullscreen window is active in maximized | 942 // Tests that entering overview when a fullscreen window is active in maximized |
| 945 // mode correctly applies the transformations to the window and correctly | 943 // mode correctly applies the transformations to the window and correctly |
| 946 // updates the window bounds on exiting overview mode: http://crbug.com/401664. | 944 // updates the window bounds on exiting overview mode: http://crbug.com/401664. |
| 947 TEST_P(WindowSelectorTest, FullscreenWindowMaximizeMode) { | 945 TEST_P(WindowSelectorTest, FullscreenWindowMaximizeMode) { |
| 948 gfx::Rect bounds(0, 0, 400, 400); | 946 gfx::Rect bounds(0, 0, 400, 400); |
| 949 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 947 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| 950 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); | 948 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); |
| 951 Shell::GetInstance()->maximize_mode_controller()-> | 949 Shell::GetInstance() |
| 952 EnableMaximizeModeWindowManager(true); | 950 ->maximize_mode_controller() |
| 951 ->EnableMaximizeModeWindowManager(true); |
| 953 wm::ActivateWindow(window2.get()); | 952 wm::ActivateWindow(window2.get()); |
| 954 wm::ActivateWindow(window1.get()); | 953 wm::ActivateWindow(window1.get()); |
| 955 gfx::Rect normal_window_bounds(window1->bounds()); | 954 gfx::Rect normal_window_bounds(window1->bounds()); |
| 956 const wm::WMEvent toggle_fullscreen_event(wm::WM_EVENT_TOGGLE_FULLSCREEN); | 955 const wm::WMEvent toggle_fullscreen_event(wm::WM_EVENT_TOGGLE_FULLSCREEN); |
| 957 wm::GetWindowState(window1.get())->OnWMEvent(&toggle_fullscreen_event); | 956 wm::GetWindowState(window1.get())->OnWMEvent(&toggle_fullscreen_event); |
| 958 gfx::Rect fullscreen_window_bounds(window1->bounds()); | 957 gfx::Rect fullscreen_window_bounds(window1->bounds()); |
| 959 EXPECT_NE(normal_window_bounds.ToString(), | 958 EXPECT_NE(normal_window_bounds.ToString(), |
| 960 fullscreen_window_bounds.ToString()); | 959 fullscreen_window_bounds.ToString()); |
| 961 EXPECT_EQ(fullscreen_window_bounds.ToString(), | 960 EXPECT_EQ(fullscreen_window_bounds.ToString(), |
| 962 window2->GetTargetBounds().ToString()); | 961 window2->GetTargetBounds().ToString()); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 window1.reset(); | 1093 window1.reset(); |
| 1095 window2.reset(); | 1094 window2.reset(); |
| 1096 EXPECT_FALSE(IsSelecting()); | 1095 EXPECT_FALSE(IsSelecting()); |
| 1097 } | 1096 } |
| 1098 | 1097 |
| 1099 // Tests that entering overview mode restores a window to its original | 1098 // Tests that entering overview mode restores a window to its original |
| 1100 // target location. | 1099 // target location. |
| 1101 TEST_P(WindowSelectorTest, QuickReentryRestoresInitialTransform) { | 1100 TEST_P(WindowSelectorTest, QuickReentryRestoresInitialTransform) { |
| 1102 gfx::Rect bounds(0, 0, 400, 400); | 1101 gfx::Rect bounds(0, 0, 400, 400); |
| 1103 std::unique_ptr<aura::Window> window(CreateWindow(bounds)); | 1102 std::unique_ptr<aura::Window> window(CreateWindow(bounds)); |
| 1104 gfx::Rect initial_bounds = ToEnclosingRect( | 1103 gfx::Rect initial_bounds = |
| 1105 GetTransformedBounds(window.get())); | 1104 ToEnclosingRect(GetTransformedBounds(window.get())); |
| 1106 ToggleOverview(); | 1105 ToggleOverview(); |
| 1107 // Quickly exit and reenter overview mode. The window should still be | 1106 // Quickly exit and reenter overview mode. The window should still be |
| 1108 // animating when we reenter. We cannot short circuit animations for this but | 1107 // animating when we reenter. We cannot short circuit animations for this but |
| 1109 // we also don't have to wait for them to complete. | 1108 // we also don't have to wait for them to complete. |
| 1110 { | 1109 { |
| 1111 ui::ScopedAnimationDurationScaleMode test_duration_mode( | 1110 ui::ScopedAnimationDurationScaleMode test_duration_mode( |
| 1112 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); | 1111 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); |
| 1113 ToggleOverview(); | 1112 ToggleOverview(); |
| 1114 ToggleOverview(); | 1113 ToggleOverview(); |
| 1115 } | 1114 } |
| 1116 EXPECT_NE(initial_bounds, ToEnclosingRect( | 1115 EXPECT_NE(initial_bounds, |
| 1117 GetTransformedTargetBounds(window.get()))); | 1116 ToEnclosingRect(GetTransformedTargetBounds(window.get()))); |
| 1118 ToggleOverview(); | 1117 ToggleOverview(); |
| 1119 EXPECT_FALSE(IsSelecting()); | 1118 EXPECT_FALSE(IsSelecting()); |
| 1120 EXPECT_EQ(initial_bounds, ToEnclosingRect( | 1119 EXPECT_EQ(initial_bounds, |
| 1121 GetTransformedTargetBounds(window.get()))); | 1120 ToEnclosingRect(GetTransformedTargetBounds(window.get()))); |
| 1122 } | 1121 } |
| 1123 | 1122 |
| 1124 // Tests that windows with modal child windows are transformed with the modal | 1123 // Tests that windows with modal child windows are transformed with the modal |
| 1125 // child even though not activatable themselves. | 1124 // child even though not activatable themselves. |
| 1126 TEST_P(WindowSelectorTest, ModalChild) { | 1125 TEST_P(WindowSelectorTest, ModalChild) { |
| 1127 gfx::Rect bounds(0, 0, 400, 400); | 1126 gfx::Rect bounds(0, 0, 400, 400); |
| 1128 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 1127 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| 1129 std::unique_ptr<aura::Window> child1(CreateWindow(bounds)); | 1128 std::unique_ptr<aura::Window> child1(CreateWindow(bounds)); |
| 1130 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); | 1129 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); |
| 1131 ::wm::AddTransientChild(window1.get(), child1.get()); | 1130 ::wm::AddTransientChild(window1.get(), child1.get()); |
| 1132 EXPECT_EQ(window1->parent(), child1->parent()); | 1131 EXPECT_EQ(window1->parent(), child1->parent()); |
| 1133 ToggleOverview(); | 1132 ToggleOverview(); |
| 1134 EXPECT_TRUE(window1->IsVisible()); | 1133 EXPECT_TRUE(window1->IsVisible()); |
| 1135 EXPECT_TRUE(child1->IsVisible()); | 1134 EXPECT_TRUE(child1->IsVisible()); |
| 1136 EXPECT_EQ(ToEnclosingRect(GetTransformedTargetBounds(child1.get())), | 1135 EXPECT_EQ(ToEnclosingRect(GetTransformedTargetBounds(child1.get())), |
| 1137 ToEnclosingRect(GetTransformedTargetBounds(window1.get()))); | 1136 ToEnclosingRect(GetTransformedTargetBounds(window1.get()))); |
| 1138 ToggleOverview(); | 1137 ToggleOverview(); |
| 1139 } | 1138 } |
| 1140 | 1139 |
| 1141 // Tests that clicking a modal window's parent activates the modal window in | 1140 // Tests that clicking a modal window's parent activates the modal window in |
| 1142 // overview. | 1141 // overview. |
| 1143 TEST_P(WindowSelectorTest, ClickModalWindowParent) { | 1142 TEST_P(WindowSelectorTest, ClickModalWindowParent) { |
| 1144 std::unique_ptr<aura::Window> window1( | 1143 std::unique_ptr<aura::Window> window1( |
| 1145 CreateWindow(gfx::Rect(0, 0, 180, 180))); | 1144 CreateWindow(gfx::Rect(0, 0, 180, 180))); |
| 1146 std::unique_ptr<aura::Window> child1( | 1145 std::unique_ptr<aura::Window> child1( |
| 1147 CreateWindow(gfx::Rect(200, 0, 180, 180))); | 1146 CreateWindow(gfx::Rect(200, 0, 180, 180))); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 ash::DragDropController* drag_drop_controller = | 1278 ash::DragDropController* drag_drop_controller = |
| 1280 shell_test_api.drag_drop_controller(); | 1279 shell_test_api.drag_drop_controller(); |
| 1281 ui::OSExchangeData data; | 1280 ui::OSExchangeData data; |
| 1282 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1281 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1283 FROM_HERE, | 1282 FROM_HERE, |
| 1284 base::Bind(&WindowSelectorTest::ToggleOverview, base::Unretained(this))); | 1283 base::Bind(&WindowSelectorTest::ToggleOverview, base::Unretained(this))); |
| 1285 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1284 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1286 FROM_HERE, | 1285 FROM_HERE, |
| 1287 base::Bind(&CancelDrag, drag_drop_controller, &drag_canceled_by_test)); | 1286 base::Bind(&CancelDrag, drag_drop_controller, &drag_canceled_by_test)); |
| 1288 data.SetString(base::UTF8ToUTF16("I am being dragged")); | 1287 data.SetString(base::UTF8ToUTF16("I am being dragged")); |
| 1289 drag_drop_controller->StartDragAndDrop(data, window->GetRootWindow(), | 1288 drag_drop_controller->StartDragAndDrop( |
| 1290 window.get(), gfx::Point(5, 5), ui::DragDropTypes::DRAG_MOVE, | 1289 data, window->GetRootWindow(), window.get(), gfx::Point(5, 5), |
| 1291 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); | 1290 ui::DragDropTypes::DRAG_MOVE, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); |
| 1292 RunAllPendingInMessageLoop(); | 1291 RunAllPendingInMessageLoop(); |
| 1293 EXPECT_FALSE(drag_canceled_by_test); | 1292 EXPECT_FALSE(drag_canceled_by_test); |
| 1294 ASSERT_TRUE(IsSelecting()); | 1293 ASSERT_TRUE(IsSelecting()); |
| 1295 RunAllPendingInMessageLoop(); | 1294 RunAllPendingInMessageLoop(); |
| 1296 } | 1295 } |
| 1297 | 1296 |
| 1298 // Test that a label is created under the window on entering overview mode. | 1297 // Test that a label is created under the window on entering overview mode. |
| 1299 TEST_P(WindowSelectorTest, CreateLabelUnderWindow) { | 1298 TEST_P(WindowSelectorTest, CreateLabelUnderWindow) { |
| 1300 std::unique_ptr<aura::Window> window(CreateWindow(gfx::Rect(0, 0, 300, 500))); | 1299 std::unique_ptr<aura::Window> window(CreateWindow(gfx::Rect(0, 0, 300, 500))); |
| 1301 base::string16 window_title = base::UTF8ToUTF16("My window"); | 1300 base::string16 window_title = base::UTF8ToUTF16("My window"); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 // possible direction. | 1378 // possible direction. |
| 1380 TEST_P(WindowSelectorTest, BasicArrowKeyNavigation) { | 1379 TEST_P(WindowSelectorTest, BasicArrowKeyNavigation) { |
| 1381 if (!SupportsHostWindowResize()) | 1380 if (!SupportsHostWindowResize()) |
| 1382 return; | 1381 return; |
| 1383 const size_t test_windows = 9; | 1382 const size_t test_windows = 9; |
| 1384 UpdateDisplay("800x600"); | 1383 UpdateDisplay("800x600"); |
| 1385 ScopedVector<aura::Window> windows; | 1384 ScopedVector<aura::Window> windows; |
| 1386 for (size_t i = test_windows; i > 0; i--) | 1385 for (size_t i = test_windows; i > 0; i--) |
| 1387 windows.push_back(CreateWindowWithId(gfx::Rect(0, 0, 100, 100), i)); | 1386 windows.push_back(CreateWindowWithId(gfx::Rect(0, 0, 100, 100), i)); |
| 1388 | 1387 |
| 1389 ui::KeyboardCode arrow_keys[] = { | 1388 ui::KeyboardCode arrow_keys[] = {ui::VKEY_RIGHT, ui::VKEY_DOWN, ui::VKEY_LEFT, |
| 1390 ui::VKEY_RIGHT, | 1389 ui::VKEY_UP}; |
| 1391 ui::VKEY_DOWN, | |
| 1392 ui::VKEY_LEFT, | |
| 1393 ui::VKEY_UP | |
| 1394 }; | |
| 1395 // Expected window layout, assuming that the text filtering feature is | 1390 // Expected window layout, assuming that the text filtering feature is |
| 1396 // enabled by default (i.e., --ash-disable-text-filtering-in-overview-mode | 1391 // enabled by default (i.e., --ash-disable-text-filtering-in-overview-mode |
| 1397 // is not being used). | 1392 // is not being used). |
| 1398 // +-------+ +-------+ +-------+ +-------+ | 1393 // +-------+ +-------+ +-------+ +-------+ |
| 1399 // | 1 | | 2 | | 3 | | 4 | | 1394 // | 1 | | 2 | | 3 | | 4 | |
| 1400 // +-------+ +-------+ +-------+ +-------+ | 1395 // +-------+ +-------+ +-------+ +-------+ |
| 1401 // +-------+ +-------+ +-------+ +-------+ | 1396 // +-------+ +-------+ +-------+ +-------+ |
| 1402 // | 5 | | 6 | | 7 | | 8 | | 1397 // | 5 | | 6 | | 7 | | 8 | |
| 1403 // +-------+ +-------+ +-------+ +-------+ | 1398 // +-------+ +-------+ +-------+ +-------+ |
| 1404 // +-------+ | 1399 // +-------+ |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 bounds.y()); | 1822 bounds.y()); |
| 1828 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); | 1823 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); |
| 1829 EXPECT_NEAR(transformed_rect.x() - bounds.x(), | 1824 EXPECT_NEAR(transformed_rect.x() - bounds.x(), |
| 1830 bounds.right() - transformed_rect.right(), 1); | 1825 bounds.right() - transformed_rect.right(), 1); |
| 1831 EXPECT_NEAR( | 1826 EXPECT_NEAR( |
| 1832 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), | 1827 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), |
| 1833 bounds.bottom() - transformed_rect.bottom(), 1); | 1828 bounds.bottom() - transformed_rect.bottom(), 1); |
| 1834 } | 1829 } |
| 1835 | 1830 |
| 1836 } // namespace ash | 1831 } // namespace ash |
| OLD | NEW |