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