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

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
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #if !defined(OS_WIN)
491 // Test if the restore bounds is correct in multiple displays.
492 ClearRestoreBounds(window_.get());
493 UpdateDisplay("800x600,200x600");
494 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
495 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
496 window_->SetBoundsInScreen(gfx::Rect(800, 10, 50, 60),
497 ScreenAsh::GetSecondaryDisplay());
498 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
499 {
500 bottom =
501 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
502 EXPECT_EQ("800,10 50x60", window_->GetBoundsInScreen().ToString());
503
504 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
505 window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
506 ASSERT_TRUE(resizer.get());
507
508 resizer->Drag(CalculateDragPoint(*resizer, 199, 00), 0);
509 resizer->CompleteDrag(0);
510 EXPECT_EQ("20,0 180x" + base::IntToString(bottom),
511 window_->bounds().ToString());
512 EXPECT_EQ("800,10 50x60",
513 GetRestoreBoundsInScreen(window_.get())->ToString());
514 }
515 #endif
486 } 516 }
487 517
488 // Verifies a window can be moved from the primary display to another. 518 // Verifies a window can be moved from the primary display to another.
489 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) { 519 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
490 // The secondary display is logically on the right, but on the system (e.g. X) 520 // 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. 521 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
492 UpdateDisplay("800x600,800x600"); 522 UpdateDisplay("800x600,800x600");
493 shelf_layout_manager()->LayoutShelf(); 523 shelf_layout_manager()->LayoutShelf();
494 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 524 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
495 ASSERT_EQ(2U, root_windows.size()); 525 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], 1404 event_filter->WarpMouseCursorIfNecessary(root_windows[1],
1375 gfx::Point(400, 200)); 1405 gfx::Point(400, 200));
1376 EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor()); 1406 EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor());
1377 resizer->CompleteDrag(0); 1407 resizer->CompleteDrag(0);
1378 EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor()); 1408 EXPECT_EQ(1.0f, cursor_test_api.GetDeviceScaleFactor());
1379 } 1409 }
1380 } 1410 }
1381 1411
1382 } // namespace internal 1412 } // namespace internal
1383 } // namespace ash 1413 } // namespace ash
OLDNEW
« no previous file with comments | « 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