| 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" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ToplevelWindowEventHandlerTest() {} | 63 ToplevelWindowEventHandlerTest() {} |
| 64 virtual ~ToplevelWindowEventHandlerTest() {} | 64 virtual ~ToplevelWindowEventHandlerTest() {} |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 aura::Window* CreateWindow(int hittest_code) { | 67 aura::Window* CreateWindow(int hittest_code) { |
| 68 TestWindowDelegate* d1 = new TestWindowDelegate(hittest_code); | 68 TestWindowDelegate* d1 = new TestWindowDelegate(hittest_code); |
| 69 aura::Window* w1 = new aura::Window(d1); | 69 aura::Window* w1 = new aura::Window(d1); |
| 70 w1->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 70 w1->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 71 w1->set_id(1); | 71 w1->set_id(1); |
| 72 w1->Init(aura::WINDOW_LAYER_TEXTURED); | 72 w1->Init(aura::WINDOW_LAYER_TEXTURED); |
| 73 aura::Window* parent = | 73 aura::Window* parent = Shell::GetContainer( |
| 74 Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 74 Shell::GetPrimaryRootWindow(), kShellWindowId_AlwaysOnTopContainer); |
| 75 internal::kShellWindowId_AlwaysOnTopContainer); | |
| 76 parent->AddChild(w1); | 75 parent->AddChild(w1); |
| 77 w1->SetBounds(gfx::Rect(0, 0, 100, 100)); | 76 w1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 78 w1->Show(); | 77 w1->Show(); |
| 79 return w1; | 78 return w1; |
| 80 } | 79 } |
| 81 | 80 |
| 82 void DragFromCenterBy(aura::Window* window, int dx, int dy) { | 81 void DragFromCenterBy(aura::Window* window, int dx, int dy) { |
| 83 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window); | 82 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window); |
| 84 generator.DragMouseBy(dx, dy); | 83 generator.DragMouseBy(dx, dy); |
| 85 } | 84 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 469 |
| 471 // Tests that a gesture cannot minimize a window in login/lock screen. | 470 // Tests that a gesture cannot minimize a window in login/lock screen. |
| 472 TEST_F(ToplevelWindowEventHandlerTest, GestureDragMinimizeLoginScreen) { | 471 TEST_F(ToplevelWindowEventHandlerTest, GestureDragMinimizeLoginScreen) { |
| 473 LockStateController* state_controller = | 472 LockStateController* state_controller = |
| 474 Shell::GetInstance()->lock_state_controller(); | 473 Shell::GetInstance()->lock_state_controller(); |
| 475 state_controller->OnLoginStateChanged(user::LOGGED_IN_NONE); | 474 state_controller->OnLoginStateChanged(user::LOGGED_IN_NONE); |
| 476 state_controller->OnLockStateChanged(false); | 475 state_controller->OnLockStateChanged(false); |
| 477 SetUserLoggedIn(false); | 476 SetUserLoggedIn(false); |
| 478 | 477 |
| 479 scoped_ptr<aura::Window> target(CreateWindow(HTCAPTION)); | 478 scoped_ptr<aura::Window> target(CreateWindow(HTCAPTION)); |
| 480 aura::Window* lock = internal::RootWindowController::ForWindow(target.get())-> | 479 aura::Window* lock = |
| 481 GetContainer(internal::kShellWindowId_LockSystemModalContainer); | 480 RootWindowController::ForWindow(target.get()) |
| 481 ->GetContainer(kShellWindowId_LockSystemModalContainer); |
| 482 lock->AddChild(target.get()); | 482 lock->AddChild(target.get()); |
| 483 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 483 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 484 target.get()); | 484 target.get()); |
| 485 gfx::Rect old_bounds = target->bounds(); | 485 gfx::Rect old_bounds = target->bounds(); |
| 486 gfx::Point location(5, 5); | 486 gfx::Point location(5, 5); |
| 487 target->SetProperty(aura::client::kCanMaximizeKey, true); | 487 target->SetProperty(aura::client::kCanMaximizeKey, true); |
| 488 | 488 |
| 489 gfx::Point end = location; | 489 gfx::Point end = location; |
| 490 end.Offset(0, 100); | 490 end.Offset(0, 100); |
| 491 generator.GestureScrollSequence(location, end, | 491 generator.GestureScrollSequence(location, end, |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 | 703 |
| 704 generator.ReleaseLeftButton(); | 704 generator.ReleaseLeftButton(); |
| 705 EXPECT_EQ("10,11 100x100", window1->bounds().ToString()); | 705 EXPECT_EQ("10,11 100x100", window1->bounds().ToString()); |
| 706 } | 706 } |
| 707 | 707 |
| 708 // Showing the resize shadows when the mouse is over the window edges is tested | 708 // Showing the resize shadows when the mouse is over the window edges is tested |
| 709 // in resize_shadow_and_cursor_test.cc | 709 // in resize_shadow_and_cursor_test.cc |
| 710 | 710 |
| 711 } // namespace test | 711 } // namespace test |
| 712 } // namespace ash | 712 } // namespace ash |
| OLD | NEW |