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

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

Issue 106303005: Fix AdjustBoundsToEnsureWindowVisibility to work with non primary display bounds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 ASSERT_TRUE(resizer.get()); 236 ASSERT_TRUE(resizer.get());
237 resizer->Drag(CalculateDragPoint(*resizer, 101, 10), ui::EF_CONTROL_DOWN); 237 resizer->Drag(CalculateDragPoint(*resizer, 101, 10), ui::EF_CONTROL_DOWN);
238 resizer->CompleteDrag(0); 238 resizer->CompleteDrag(0);
239 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 239 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
240 // Window size should be adjusted to fit to the work area 240 // Window size should be adjusted to fit to the work area
241 EXPECT_EQ("400x253", window_->bounds().size().ToString()); 241 EXPECT_EQ("400x253", window_->bounds().size().ToString());
242 gfx::Rect window_bounds_in_screen = window_->GetBoundsInScreen(); 242 gfx::Rect window_bounds_in_screen = window_->GetBoundsInScreen();
243 gfx::Rect intersect(window_->GetRootWindow()->GetBoundsInScreen()); 243 gfx::Rect intersect(window_->GetRootWindow()->GetBoundsInScreen());
244 intersect.Intersect(window_bounds_in_screen); 244 intersect.Intersect(window_bounds_in_screen);
245 245
246 // TODO(oshima): Following condition fails without docked window resizer. 246 EXPECT_LE(10, intersect.width());
247 // Proper fix caused the other failures, so I'm disabling these 247 EXPECT_LE(10, intersect.height());
248 // for m33 (Which is harmless). 248 EXPECT_TRUE(window_bounds_in_screen.Contains(gfx::Point(800, 10)));
249 // EXPECT_LE(10, intersect.width());
250 // EXPECT_LE(10, intersect.height());
251 // EXPECT_TRUE(window_bounds_in_screen.Contains(gfx::Point(800, 10)));
252 } 249 }
253 250
254 // Dropping a window that is larger than the destination work area 251 // Dropping a window that is larger than the destination work area
255 // will shrink to fit to the work area. 252 // will shrink to fit to the work area.
256 window_->SetBoundsInScreen(gfx::Rect(0, 0, 700, 500), 253 window_->SetBoundsInScreen(gfx::Rect(0, 0, 700, 500),
257 Shell::GetScreen()->GetPrimaryDisplay()); 254 Shell::GetScreen()->GetPrimaryDisplay());
258 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 255 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
259 { 256 {
260 // Grab the top-left edge of the window and move the pointer to (150, 10) 257 // Grab the top-left edge of the window and move the pointer to (150, 10)
261 // in the secondary root window's coordinates. Make sure the window is 258 // in the secondary root window's coordinates. Make sure the window is
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 resizer->CompleteDrag(0); 715 resizer->CompleteDrag(0);
719 EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls()); 716 EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls());
720 EXPECT_NE(initial_bounds.ToString(), window->bounds().ToString()); 717 EXPECT_NE(initial_bounds.ToString(), window->bounds().ToString());
721 } 718 }
722 } 719 }
723 #endif 720 #endif
724 721
725 722
726 } // namespace internal 723 } // namespace internal
727 } // namespace ash 724 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698