| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accelerators/accelerator_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_table.h" | 7 #include "ash/accelerators/accelerator_table.h" |
| 8 #include "ash/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 TEST_F(AcceleratorControllerTest, WindowSnap) { | 425 TEST_F(AcceleratorControllerTest, WindowSnap) { |
| 426 scoped_ptr<aura::Window> window( | 426 scoped_ptr<aura::Window> window( |
| 427 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 427 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 428 const ui::Accelerator dummy; | 428 const ui::Accelerator dummy; |
| 429 | 429 |
| 430 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 430 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 431 | 431 |
| 432 window_state->Activate(); | 432 window_state->Activate(); |
| 433 | 433 |
| 434 { | 434 { |
| 435 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy); | 435 GetController()->PerformAction(WINDOW_SNAP_OR_DOCK_LEFT, dummy); |
| 436 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( | 436 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( |
| 437 window.get()); | 437 window.get()); |
| 438 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); | 438 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); |
| 439 } | 439 } |
| 440 { | 440 { |
| 441 GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy); | 441 GetController()->PerformAction(WINDOW_SNAP_OR_DOCK_RIGHT, dummy); |
| 442 gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( | 442 gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( |
| 443 window.get()); | 443 window.get()); |
| 444 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); | 444 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); |
| 445 } | 445 } |
| 446 { | 446 { |
| 447 gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); | 447 gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); |
| 448 | 448 |
| 449 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); | 449 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); |
| 450 EXPECT_TRUE(window_state->IsMaximized()); | 450 EXPECT_TRUE(window_state->IsMaximized()); |
| 451 EXPECT_NE(normal_bounds.ToString(), window->bounds().ToString()); | 451 EXPECT_NE(normal_bounds.ToString(), window->bounds().ToString()); |
| 452 | 452 |
| 453 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); | 453 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); |
| 454 EXPECT_FALSE(window_state->IsMaximized()); | 454 EXPECT_FALSE(window_state->IsMaximized()); |
| 455 // Window gets restored to its restore bounds since side-maximized state | 455 // Window gets restored to its restore bounds since side-maximized state |
| 456 // is treated as a "maximized" state. | 456 // is treated as a "maximized" state. |
| 457 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); | 457 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); |
| 458 | 458 |
| 459 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); | 459 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); |
| 460 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy); | 460 GetController()->PerformAction(WINDOW_SNAP_OR_DOCK_LEFT, dummy); |
| 461 EXPECT_FALSE(window_state->IsMaximized()); | 461 EXPECT_FALSE(window_state->IsMaximized()); |
| 462 | 462 |
| 463 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); | 463 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); |
| 464 GetController()->PerformAction(WINDOW_SNAP_RIGHT, dummy); | 464 GetController()->PerformAction(WINDOW_SNAP_OR_DOCK_RIGHT, dummy); |
| 465 EXPECT_FALSE(window_state->IsMaximized()); | 465 EXPECT_FALSE(window_state->IsMaximized()); |
| 466 | 466 |
| 467 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); | 467 GetController()->PerformAction(TOGGLE_MAXIMIZED, dummy); |
| 468 EXPECT_TRUE(window_state->IsMaximized()); | 468 EXPECT_TRUE(window_state->IsMaximized()); |
| 469 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); | 469 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); |
| 470 EXPECT_FALSE(window_state->IsMaximized()); | 470 EXPECT_FALSE(window_state->IsMaximized()); |
| 471 EXPECT_TRUE(window_state->IsMinimized()); | 471 EXPECT_TRUE(window_state->IsMinimized()); |
| 472 window_state->Restore(); | 472 window_state->Restore(); |
| 473 window_state->Activate(); | 473 window_state->Activate(); |
| 474 } | 474 } |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 1244 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 1245 wm::ActivateWindow(window.get()); | 1245 wm::ActivateWindow(window.get()); |
| 1246 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); | 1246 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); |
| 1247 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); | 1247 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); |
| 1248 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); | 1248 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); |
| 1249 EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); | 1249 EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); |
| 1250 } | 1250 } |
| 1251 } | 1251 } |
| 1252 | 1252 |
| 1253 } // namespace ash | 1253 } // namespace ash |
| OLD | NEW |