Chromium Code Reviews| 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/drag_window_resizer.h" | 5 #include "ash/wm/drag_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_layout_manager.h" | 7 #include "ash/common/shelf/shelf_layout_manager.h" |
| 8 #include "ash/common/wm/window_positioning_utils.h" | 8 #include "ash/common/wm/window_positioning_utils.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/display/mouse_cursor_event_filter.h" | 10 #include "ash/display/mouse_cursor_event_filter.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 std::unique_ptr<aura::Window> window(new aura::Window(&delegate)); | 302 std::unique_ptr<aura::Window> window(new aura::Window(&delegate)); |
| 303 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 303 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 304 window->Init(ui::LAYER_TEXTURED); | 304 window->Init(ui::LAYER_TEXTURED); |
| 305 ParentWindowInPrimaryRootWindow(window.get()); | 305 ParentWindowInPrimaryRootWindow(window.get()); |
| 306 window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), | 306 window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), |
| 307 display::Screen::GetScreen()->GetPrimaryDisplay()); | 307 display::Screen::GetScreen()->GetPrimaryDisplay()); |
| 308 window->Show(); | 308 window->Show(); |
| 309 EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); | 309 EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); |
| 310 ash::wm::ActivateWindow(window.get()); | 310 ash::wm::ActivateWindow(window.get()); |
| 311 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 311 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 312 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 312 EXPECT_EQ(root_windows[0], ash::Shell::GetRootWindowForNewWindows()); |
|
James Cook
2017/03/08 20:19:17
nit: I don't think ash:: is needed, here or below
sky
2017/03/08 20:42:59
Done.
| |
| 313 { | 313 { |
| 314 // Grab (0, 0) of the window. | 314 // Grab (0, 0) of the window. |
| 315 std::unique_ptr<WindowResizer> resizer( | 315 std::unique_ptr<WindowResizer> resizer( |
| 316 CreateDragWindowResizer(window.get(), gfx::Point(), HTCAPTION)); | 316 CreateDragWindowResizer(window.get(), gfx::Point(), HTCAPTION)); |
| 317 ASSERT_TRUE(resizer.get()); | 317 ASSERT_TRUE(resizer.get()); |
| 318 // Drag the pointer to the right. Once it reaches the right edge of the | 318 // Drag the pointer to the right. Once it reaches the right edge of the |
| 319 // primary display, it warps to the secondary. | 319 // primary display, it warps to the secondary. |
| 320 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); | 320 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); |
| 321 resizer->CompleteDrag(); | 321 resizer->CompleteDrag(); |
| 322 // The whole window is on the secondary display now. The parent should be | 322 // The whole window is on the secondary display now. The parent should be |
| 323 // changed. | 323 // changed. |
| 324 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 324 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 325 EXPECT_EQ(root_windows[1], ash::Shell::GetTargetRootWindow()); | 325 EXPECT_EQ(root_windows[1], ash::Shell::GetRootWindowForNewWindows()); |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 // Verifies a window can be moved from the secondary display to primary. | 329 // Verifies a window can be moved from the secondary display to primary. |
| 330 TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysRightToLeft) { | 330 TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysRightToLeft) { |
| 331 UpdateDisplay("800x600,800x600"); | 331 UpdateDisplay("800x600,800x600"); |
| 332 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 332 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 333 ASSERT_EQ(2U, root_windows.size()); | 333 ASSERT_EQ(2U, root_windows.size()); |
| 334 | 334 |
| 335 window_->SetBoundsInScreen( | 335 window_->SetBoundsInScreen( |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 ASSERT_TRUE(resizer.get()); | 745 ASSERT_TRUE(resizer.get()); |
| 746 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); | 746 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); |
| 747 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(399, 200))); | 747 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(399, 200))); |
| 748 EXPECT_EQ("401,200", | 748 EXPECT_EQ("401,200", |
| 749 aura::Env::GetInstance()->last_mouse_location().ToString()); | 749 aura::Env::GetInstance()->last_mouse_location().ToString()); |
| 750 resizer->CompleteDrag(); | 750 resizer->CompleteDrag(); |
| 751 } | 751 } |
| 752 } | 752 } |
| 753 | 753 |
| 754 } // namespace ash | 754 } // namespace ash |
| OLD | NEW |