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

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

Issue 131543006: Revert 243986 "Fix AdjustBoundsToEnsureWindowVisibility to work ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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/display/mouse_cursor_event_filter.h" 7 #include "ash/display/mouse_cursor_event_filter.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ASSERT_TRUE(resizer.get()); 237 ASSERT_TRUE(resizer.get());
238 resizer->Drag(CalculateDragPoint(*resizer, 101, 10), ui::EF_CONTROL_DOWN); 238 resizer->Drag(CalculateDragPoint(*resizer, 101, 10), ui::EF_CONTROL_DOWN);
239 resizer->CompleteDrag(); 239 resizer->CompleteDrag();
240 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 240 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
241 // Window size should be adjusted to fit to the work area 241 // Window size should be adjusted to fit to the work area
242 EXPECT_EQ("400x253", window_->bounds().size().ToString()); 242 EXPECT_EQ("400x253", window_->bounds().size().ToString());
243 gfx::Rect window_bounds_in_screen = window_->GetBoundsInScreen(); 243 gfx::Rect window_bounds_in_screen = window_->GetBoundsInScreen();
244 gfx::Rect intersect(window_->GetRootWindow()->GetBoundsInScreen()); 244 gfx::Rect intersect(window_->GetRootWindow()->GetBoundsInScreen());
245 intersect.Intersect(window_bounds_in_screen); 245 intersect.Intersect(window_bounds_in_screen);
246 246
247 EXPECT_LE(10, intersect.width()); 247 // TODO(oshima): Following condition fails without docked window resizer.
248 EXPECT_LE(10, intersect.height()); 248 // Proper fix caused the other failures, so I'm disabling these
249 EXPECT_TRUE(window_bounds_in_screen.Contains(gfx::Point(800, 10))); 249 // for m33 (Which is harmless).
250 // EXPECT_LE(10, intersect.width());
251 // EXPECT_LE(10, intersect.height());
252 // EXPECT_TRUE(window_bounds_in_screen.Contains(gfx::Point(800, 10)));
250 } 253 }
251 254
252 // Dropping a window that is larger than the destination work area 255 // Dropping a window that is larger than the destination work area
253 // will shrink to fit to the work area. 256 // will shrink to fit to the work area.
254 window_->SetBoundsInScreen(gfx::Rect(0, 0, 700, 500), 257 window_->SetBoundsInScreen(gfx::Rect(0, 0, 700, 500),
255 Shell::GetScreen()->GetPrimaryDisplay()); 258 Shell::GetScreen()->GetPrimaryDisplay());
256 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 259 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
257 { 260 {
258 // Grab the top-left edge of the window and move the pointer to (150, 10) 261 // Grab the top-left edge of the window and move the pointer to (150, 10)
259 // in the secondary root window's coordinates. Make sure the window is 262 // in the secondary root window's coordinates. Make sure the window is
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); 509 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
507 WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(399, 200)); 510 WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(399, 200));
508 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); 511 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor());
509 resizer->CompleteDrag(); 512 resizer->CompleteDrag();
510 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); 513 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor());
511 } 514 }
512 515
513 // Move window from the root window with 2.0 device scale factor to the root 516 // Move window from the root window with 2.0 device scale factor to the root
514 // window with 1.0 device scale factor. 517 // window with 1.0 device scale factor.
515 { 518 {
516 // Make sure the window is on the default container first.
517 aura::Window* default_container =
518 GetRootWindowController(root_windows[1])->GetContainer(
519 internal::kShellWindowId_DefaultContainer);
520 default_container->AddChild(window_.get());
521 window_->SetBoundsInScreen( 519 window_->SetBoundsInScreen(
522 gfx::Rect(600, 0, 50, 60), 520 gfx::Rect(600, 0, 50, 60),
523 Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1])); 521 Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1]));
524 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 522 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
525 // Grab (0, 0) of the window. 523 // Grab (0, 0) of the window.
526 scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( 524 scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer(
527 window_.get(), gfx::Point(), HTCAPTION)); 525 window_.get(), gfx::Point(), HTCAPTION));
528 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); 526 EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor());
529 ASSERT_TRUE(resizer.get()); 527 ASSERT_TRUE(resizer.get());
530 resizer->Drag(CalculateDragPoint(*resizer, -200, 200), 0); 528 resizer->Drag(CalculateDragPoint(*resizer, -200, 200), 0);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 resizer->CompleteDrag(); 719 resizer->CompleteDrag();
722 EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls()); 720 EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls());
723 EXPECT_NE(initial_bounds.ToString(), window->bounds().ToString()); 721 EXPECT_NE(initial_bounds.ToString(), window->bounds().ToString());
724 } 722 }
725 } 723 }
726 #endif 724 #endif
727 725
728 726
729 } // namespace internal 727 } // namespace internal
730 } // namespace ash 728 } // namespace ash
OLDNEW
« no previous file with comments | « trunk/src/ash/wm/drag_window_resizer.cc ('k') | trunk/src/ash/wm/system_gesture_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698