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/wm/toplevel_window_event_handler.h" | 5 #include "ash/wm/toplevel_window_event_handler.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "ash/wm/lock_state_controller.h" | |
12 #include "ash/wm/resize_shadow.h" | 11 #include "ash/wm/resize_shadow.h" |
13 #include "ash/wm/resize_shadow_controller.h" | 12 #include "ash/wm/resize_shadow_controller.h" |
14 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
15 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
16 #include "ash/wm/workspace_controller.h" | 15 #include "ash/wm/workspace_controller.h" |
17 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
18 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
19 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "ui/aura/client/aura_constants.h" | 20 #include "ui/aura/client/aura_constants.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 base::TimeDelta::FromMilliseconds(5), | 460 base::TimeDelta::FromMilliseconds(5), |
462 10); | 461 10); |
463 RunAllPendingInMessageLoop(); | 462 RunAllPendingInMessageLoop(); |
464 EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); | 463 EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); |
465 EXPECT_TRUE(window_state->IsMinimized()); | 464 EXPECT_TRUE(window_state->IsMinimized()); |
466 EXPECT_TRUE(window_state->unminimize_to_restore_bounds()); | 465 EXPECT_TRUE(window_state->unminimize_to_restore_bounds()); |
467 EXPECT_EQ(old_bounds.ToString(), | 466 EXPECT_EQ(old_bounds.ToString(), |
468 window_state->GetRestoreBoundsInScreen().ToString()); | 467 window_state->GetRestoreBoundsInScreen().ToString()); |
469 } | 468 } |
470 | 469 |
471 // Tests that a gesture cannot minimize a window in login/lock screen. | 470 // Tests that a gesture cannot minimize an unminimizeable window. |
472 TEST_F(ToplevelWindowEventHandlerTest, GestureDragMinimizeLoginScreen) { | 471 TEST_F(ToplevelWindowEventHandlerTest, |
473 LockStateController* state_controller = | 472 GestureAttemptMinimizeUnminimizeableWindow) { |
474 Shell::GetInstance()->lock_state_controller(); | |
475 state_controller->OnLoginStateChanged(user::LOGGED_IN_NONE); | |
476 state_controller->OnLockStateChanged(false); | |
477 SetUserLoggedIn(false); | |
478 | |
479 scoped_ptr<aura::Window> target(CreateWindow(HTCAPTION)); | 473 scoped_ptr<aura::Window> target(CreateWindow(HTCAPTION)); |
480 aura::Window* lock = | |
481 RootWindowController::ForWindow(target.get()) | |
482 ->GetContainer(kShellWindowId_LockSystemModalContainer); | |
483 lock->AddChild(target.get()); | |
484 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 474 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
485 target.get()); | 475 target.get()); |
486 gfx::Rect old_bounds = target->bounds(); | 476 gfx::Rect old_bounds = target->bounds(); |
487 gfx::Point location(5, 5); | 477 gfx::Point location(5, 5); |
488 target->SetProperty(aura::client::kCanMaximizeKey, true); | 478 target->SetProperty(aura::client::kCanMaximizeKey, true); |
| 479 target->SetProperty(aura::client::kCanMinimizeKey, false); |
489 | 480 |
490 gfx::Point end = location; | 481 gfx::Point end = location; |
491 end.Offset(0, 100); | 482 end.Offset(0, 100); |
492 generator.GestureScrollSequence(location, end, | 483 generator.GestureScrollSequence(location, end, |
493 base::TimeDelta::FromMilliseconds(5), | 484 base::TimeDelta::FromMilliseconds(5), |
494 10); | 485 10); |
495 RunAllPendingInMessageLoop(); | 486 RunAllPendingInMessageLoop(); |
496 EXPECT_FALSE(wm::GetWindowState(target.get())->IsMinimized()); | 487 EXPECT_FALSE(wm::GetWindowState(target.get())->IsMinimized()); |
497 } | 488 } |
498 | 489 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 EXPECT_EQ(aura::client::MOVE_SUCCESSFUL, | 725 EXPECT_EQ(aura::client::MOVE_SUCCESSFUL, |
735 move_client->RunMoveLoop(window.get(), gfx::Vector2d(), | 726 move_client->RunMoveLoop(window.get(), gfx::Vector2d(), |
736 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); | 727 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); |
737 } | 728 } |
738 | 729 |
739 // Showing the resize shadows when the mouse is over the window edges is tested | 730 // Showing the resize shadows when the mouse is over the window edges is tested |
740 // in resize_shadow_and_cursor_test.cc | 731 // in resize_shadow_and_cursor_test.cc |
741 | 732 |
742 } // namespace test | 733 } // namespace test |
743 } // namespace ash | 734 } // namespace ash |
OLD | NEW |