Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Side by Side Diff: ash/wm/drag_window_resizer_unittest.cc

Issue 2739553005: Moves maintaining root_window_for_new_windows_ to Shell (Closed)
Patch Set: remove ash:: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 ASSERT_EQ(2U, root_windows.size()); 299 ASSERT_EQ(2U, root_windows.size());
300 300
301 aura::test::TestWindowDelegate delegate; 301 aura::test::TestWindowDelegate delegate;
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(wm::CanActivateWindow(window.get()));
310 ash::wm::ActivateWindow(window.get()); 310 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], Shell::GetRootWindowForNewWindows());
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], 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
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
OLDNEW
« no previous file with comments | « ash/wm/ash_focus_rules.cc ('k') | chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698