| 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/workspace/multi_window_resize_controller.h" | 5 #include "ash/wm/workspace/multi_window_resize_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "ash/wm/workspace_controller.h" | 10 #include "ash/wm/workspace_controller.h" |
| 11 #include "ash/wm/workspace_controller_test_helper.h" | 11 #include "ash/wm/workspace_controller_test_helper.h" |
| 12 #include "ash/wm/workspace/workspace_event_handler_test_helper.h" | 12 #include "ash/wm/workspace/workspace_event_handler_test_helper.h" |
| 13 #include "ui/aura/client/aura_constants.h" |
| 13 #include "ui/aura/test/event_generator.h" | 14 #include "ui/aura/test/event_generator.h" |
| 14 #include "ui/aura/test/test_window_delegate.h" | 15 #include "ui/aura/test/test_window_delegate.h" |
| 15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 16 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
| 17 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
| 18 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 namespace internal { | 22 namespace internal { |
| 22 | 23 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 120 |
| 120 EXPECT_FALSE(IsOverWindows(gfx::Point(200, 200))); | 121 EXPECT_FALSE(IsOverWindows(gfx::Point(200, 200))); |
| 121 | 122 |
| 122 // Have to explicitly invoke this as MouseWatcher listens for native events. | 123 // Have to explicitly invoke this as MouseWatcher listens for native events. |
| 123 resize_controller_->MouseMovedOutOfHost(); | 124 resize_controller_->MouseMovedOutOfHost(); |
| 124 EXPECT_FALSE(HasPendingShow()); | 125 EXPECT_FALSE(HasPendingShow()); |
| 125 EXPECT_FALSE(IsShowing()); | 126 EXPECT_FALSE(IsShowing()); |
| 126 EXPECT_FALSE(HasPendingHide()); | 127 EXPECT_FALSE(HasPendingHide()); |
| 127 } | 128 } |
| 128 | 129 |
| 130 // Make sure that a non resizable window has no impact. |
| 131 TEST_F(MultiWindowResizeControllerTest, NonResizableTest) { |
| 132 aura::test::TestWindowDelegate delegate1; |
| 133 scoped_ptr<aura::Window> w1( |
| 134 CreateTestWindow(&delegate1, gfx::Rect(0, 0, 100, 100))); |
| 135 delegate1.set_window_component(HTRIGHT); |
| 136 aura::test::TestWindowDelegate delegate2; |
| 137 scoped_ptr<aura::Window> w2( |
| 138 CreateTestWindow(&delegate2, gfx::Rect(100, 0, 100, 100))); |
| 139 delegate2.set_window_component(HTRIGHT); |
| 140 w2->SetProperty(aura::client::kCanResizeKey, false); |
| 141 aura::test::EventGenerator generator(w1->GetRootWindow()); |
| 142 generator.MoveMouseTo(99, 50); |
| 143 EXPECT_FALSE(HasPendingShow()); |
| 144 EXPECT_FALSE(IsShowing()); |
| 145 EXPECT_FALSE(HasPendingHide()); |
| 146 } |
| 147 |
| 129 // Makes sure deleting a window hides. | 148 // Makes sure deleting a window hides. |
| 130 TEST_F(MultiWindowResizeControllerTest, DeleteWindow) { | 149 TEST_F(MultiWindowResizeControllerTest, DeleteWindow) { |
| 131 aura::test::TestWindowDelegate delegate1; | 150 aura::test::TestWindowDelegate delegate1; |
| 132 scoped_ptr<aura::Window> w1( | 151 scoped_ptr<aura::Window> w1( |
| 133 CreateTestWindow(&delegate1, gfx::Rect(0, 0, 100, 100))); | 152 CreateTestWindow(&delegate1, gfx::Rect(0, 0, 100, 100))); |
| 134 delegate1.set_window_component(HTRIGHT); | 153 delegate1.set_window_component(HTRIGHT); |
| 135 aura::test::TestWindowDelegate delegate2; | 154 aura::test::TestWindowDelegate delegate2; |
| 136 scoped_ptr<aura::Window> w2( | 155 scoped_ptr<aura::Window> w2( |
| 137 CreateTestWindow(&delegate2, gfx::Rect(100, 0, 100, 100))); | 156 CreateTestWindow(&delegate2, gfx::Rect(100, 0, 100, 100))); |
| 138 delegate2.set_window_component(HTRIGHT); | 157 delegate2.set_window_component(HTRIGHT); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 EXPECT_TRUE(HasTarget(w3.get())); | 267 EXPECT_TRUE(HasTarget(w3.get())); |
| 249 | 268 |
| 250 // Release the mouse. The resizer should still be visible and a subsequent | 269 // Release the mouse. The resizer should still be visible and a subsequent |
| 251 // press should not trigger a DCHECK. | 270 // press should not trigger a DCHECK. |
| 252 generator.ReleaseLeftButton(); | 271 generator.ReleaseLeftButton(); |
| 253 EXPECT_TRUE(IsShowing()); | 272 EXPECT_TRUE(IsShowing()); |
| 254 generator.PressLeftButton(); | 273 generator.PressLeftButton(); |
| 255 } | 274 } |
| 256 } // namespace internal | 275 } // namespace internal |
| 257 } // namespace ash | 276 } // namespace ash |
| OLD | NEW |