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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 11369017: Use correct restore bounds in resizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/mouse_cursor_event_filter.h" 8 #include "ash/display/mouse_cursor_event_filter.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 ASSERT_TRUE(resizer.get()); 467 ASSERT_TRUE(resizer.get());
468 resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0); 468 resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0);
469 resizer->CompleteDrag(0); 469 resizer->CompleteDrag(0);
470 EXPECT_EQ("0,0 720x" + base::IntToString(bottom), 470 EXPECT_EQ("0,0 720x" + base::IntToString(bottom),
471 window_->bounds().ToString()); 471 window_->bounds().ToString());
472 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get())); 472 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get()));
473 EXPECT_EQ("20,30 50x60", 473 EXPECT_EQ("20,30 50x60",
474 GetRestoreBoundsInScreen(window_.get())->ToString()); 474 GetRestoreBoundsInScreen(window_.get())->ToString());
475 } 475 }
476 // Try the same with the right side. 476 // Try the same with the right side.
477 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 477 {
478 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); 478 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
479 ASSERT_TRUE(resizer.get()); 479 window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
480 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); 480 ASSERT_TRUE(resizer.get());
481 resizer->CompleteDrag(0); 481 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0);
482 EXPECT_EQ("80,0 720x" + base::IntToString(bottom), 482 resizer->CompleteDrag(0);
483 window_->bounds().ToString()); 483 EXPECT_EQ("80,0 720x" + base::IntToString(bottom),
484 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get())); 484 window_->bounds().ToString());
485 EXPECT_EQ("20,30 50x60", GetRestoreBoundsInScreen(window_.get())->ToString()); 485 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get()));
486 EXPECT_EQ("20,30 50x60",
487 GetRestoreBoundsInScreen(window_.get())->ToString());
488 }
489
490 // Test if the restore bounds is correct in multiple displays.
491 ClearRestoreBounds(window_.get());
492 UpdateDisplay("800x600,200x600");
493 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
494 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
495 window_->SetBoundsInScreen(gfx::Rect(800, 10, 50, 60),
496 ScreenAsh::GetSecondaryDisplay());
497 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
498 {
499 bottom =
500 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
501 EXPECT_EQ("800,10 50x60", window_->GetBoundsInScreen().ToString());
502
503 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
504 window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
505 ASSERT_TRUE(resizer.get());
506
507 resizer->Drag(CalculateDragPoint(*resizer, 199, 00), 0);
508 resizer->CompleteDrag(0);
509 EXPECT_EQ("20,0 180x" + base::IntToString(bottom),
510 window_->bounds().ToString());
511 EXPECT_EQ("800,10 50x60",
512 GetRestoreBoundsInScreen(window_.get())->ToString());
513 }
486 } 514 }
487 515
488 // Verifies a window can be moved from the primary display to another. 516 // Verifies a window can be moved from the primary display to another.
489 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) { 517 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
490 // The secondary display is logically on the right, but on the system (e.g. X) 518 // The secondary display is logically on the right, but on the system (e.g. X)
491 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. 519 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
492 UpdateDisplay("800x600,800x600"); 520 UpdateDisplay("800x600,800x600");
493 shelf_layout_manager()->LayoutShelf(); 521 shelf_layout_manager()->LayoutShelf();
494 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 522 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
495 ASSERT_EQ(2U, root_windows.size()); 523 ASSERT_EQ(2U, root_windows.size());
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 event_filter->WarpMouseCursorIfNecessary(root_windows[1], 1402 event_filter->WarpMouseCursorIfNecessary(root_windows[1],
1375 gfx::Point(400, 200)); 1403 gfx::Point(400, 200));
1376 EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor()); 1404 EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor());
1377 resizer->CompleteDrag(0); 1405 resizer->CompleteDrag(0);
1378 EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor()); 1406 EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor());
1379 } 1407 }
1380 } 1408 }
1381 1409
1382 } // namespace internal 1410 } // namespace internal
1383 } // namespace ash 1411 } // namespace ash
OLDNEW
« ash/wm/workspace/frame_maximize_button.cc ('K') | « ash/wm/workspace/workspace_window_resizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698