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

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

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include "ash/ash_constants.h" 7 #include "ash/ash_constants.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 class WorkspaceWindowResizerTest : public test::AshTestBase { 101 class WorkspaceWindowResizerTest : public test::AshTestBase {
102 public: 102 public:
103 WorkspaceWindowResizerTest() {} 103 WorkspaceWindowResizerTest() {}
104 virtual ~WorkspaceWindowResizerTest() {} 104 virtual ~WorkspaceWindowResizerTest() {}
105 105
106 virtual void SetUp() OVERRIDE { 106 virtual void SetUp() OVERRIDE {
107 AshTestBase::SetUp(); 107 AshTestBase::SetUp();
108 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); 108 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight));
109 109
110 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 110 aura::Window* root = Shell::GetPrimaryRootWindow();
111 gfx::Rect root_bounds(root->bounds()); 111 gfx::Rect root_bounds(root->bounds());
112 #if defined(OS_WIN) 112 #if defined(OS_WIN)
113 // RootWindow and Display can't resize on Windows Ash. 113 // RootWindow and Display can't resize on Windows Ash.
114 // http://crbug.com/165962 114 // http://crbug.com/165962
115 EXPECT_EQ(kRootHeight, root_bounds.height()); 115 EXPECT_EQ(kRootHeight, root_bounds.height());
116 #endif 116 #endif
117 EXPECT_EQ(800, root_bounds.width()); 117 EXPECT_EQ(800, root_bounds.width());
118 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 118 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
119 window_.reset(new aura::Window(&delegate_)); 119 window_.reset(new aura::Window(&delegate_));
120 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); 120 window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 455 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
456 #define MAYBE_AttachedResize_BOTTOM_3 DISABLED_AttachedResize_BOTTOM_3 456 #define MAYBE_AttachedResize_BOTTOM_3 DISABLED_AttachedResize_BOTTOM_3
457 #else 457 #else
458 #define MAYBE_AttachedResize_BOTTOM_3 AttachedResize_BOTTOM_3 458 #define MAYBE_AttachedResize_BOTTOM_3 AttachedResize_BOTTOM_3
459 #endif 459 #endif
460 460
461 // Assertions around attached window resize dragging from the bottom with 3 461 // Assertions around attached window resize dragging from the bottom with 3
462 // windows. 462 // windows.
463 TEST_F(WorkspaceWindowResizerTest, MAYBE_AttachedResize_BOTTOM_3) { 463 TEST_F(WorkspaceWindowResizerTest, MAYBE_AttachedResize_BOTTOM_3) {
464 UpdateDisplay("600x800"); 464 UpdateDisplay("600x800");
465 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 465 aura::Window* root = Shell::GetPrimaryRootWindow();
466 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 466 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
467 467
468 window_->SetBounds(gfx::Rect( 300, 100, 300, 200)); 468 window_->SetBounds(gfx::Rect( 300, 100, 300, 200));
469 window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); 469 window2_->SetBounds(gfx::Rect(300, 300, 200, 150));
470 window3_->SetBounds(gfx::Rect(300, 450, 200, 100)); 470 window3_->SetBounds(gfx::Rect(300, 450, 200, 100));
471 delegate2_.set_min_size(gfx::Size(50, 52)); 471 delegate2_.set_min_size(gfx::Size(50, 52));
472 delegate3_.set_min_size(gfx::Size(50, 38)); 472 delegate3_.set_min_size(gfx::Size(50, 38));
473 473
474 std::vector<aura::Window*> windows; 474 std::vector<aura::Window*> windows;
475 windows.push_back(window2_.get()); 475 windows.push_back(window2_.get());
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 1471 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
1472 window_.get(), gfx::Point(), HTCAPTION, 1472 window_.get(), gfx::Point(), HTCAPTION,
1473 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows())); 1473 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows()));
1474 resizer->Drag(CalculateDragPoint(*resizer, 801, 0), 0); 1474 resizer->Drag(CalculateDragPoint(*resizer, 801, 0), 0);
1475 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); 1475 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
1476 } 1476 }
1477 } 1477 }
1478 1478
1479 TEST_F(WorkspaceWindowResizerTest, DontRewardRightmostWindowForOverflows) { 1479 TEST_F(WorkspaceWindowResizerTest, DontRewardRightmostWindowForOverflows) {
1480 UpdateDisplay("600x800"); 1480 UpdateDisplay("600x800");
1481 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 1481 aura::Window* root = Shell::GetPrimaryRootWindow();
1482 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 1482 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
1483 1483
1484 // Four 100x100 windows flush against eachother, starting at 100,100. 1484 // Four 100x100 windows flush against eachother, starting at 100,100.
1485 window_->SetBounds(gfx::Rect( 100, 100, 100, 100)); 1485 window_->SetBounds(gfx::Rect( 100, 100, 100, 100));
1486 window2_->SetBounds(gfx::Rect(200, 100, 100, 100)); 1486 window2_->SetBounds(gfx::Rect(200, 100, 100, 100));
1487 window3_->SetBounds(gfx::Rect(300, 100, 100, 100)); 1487 window3_->SetBounds(gfx::Rect(300, 100, 100, 100));
1488 window4_->SetBounds(gfx::Rect(400, 100, 100, 100)); 1488 window4_->SetBounds(gfx::Rect(400, 100, 100, 100));
1489 delegate2_.set_max_size(gfx::Size(101, 0)); 1489 delegate2_.set_max_size(gfx::Size(101, 0));
1490 1490
1491 std::vector<aura::Window*> windows; 1491 std::vector<aura::Window*> windows;
(...skipping 10 matching lines...) Expand all
1502 // fair implementation will give 25 pixels to each of the other windows. 1502 // fair implementation will give 25 pixels to each of the other windows.
1503 resizer->Drag(CalculateDragPoint(*resizer, -51, 0), 0); 1503 resizer->Drag(CalculateDragPoint(*resizer, -51, 0), 0);
1504 EXPECT_EQ("100,100 49x100", window_->bounds().ToString()); 1504 EXPECT_EQ("100,100 49x100", window_->bounds().ToString());
1505 EXPECT_EQ("149,100 101x100", window2_->bounds().ToString()); 1505 EXPECT_EQ("149,100 101x100", window2_->bounds().ToString());
1506 EXPECT_EQ("250,100 125x100", window3_->bounds().ToString()); 1506 EXPECT_EQ("250,100 125x100", window3_->bounds().ToString());
1507 EXPECT_EQ("375,100 125x100", window4_->bounds().ToString()); 1507 EXPECT_EQ("375,100 125x100", window4_->bounds().ToString());
1508 } 1508 }
1509 1509
1510 TEST_F(WorkspaceWindowResizerTest, DontExceedMaxWidth) { 1510 TEST_F(WorkspaceWindowResizerTest, DontExceedMaxWidth) {
1511 UpdateDisplay("600x800"); 1511 UpdateDisplay("600x800");
1512 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 1512 aura::Window* root = Shell::GetPrimaryRootWindow();
1513 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 1513 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
1514 1514
1515 // Four 100x100 windows flush against eachother, starting at 100,100. 1515 // Four 100x100 windows flush against eachother, starting at 100,100.
1516 window_->SetBounds(gfx::Rect( 100, 100, 100, 100)); 1516 window_->SetBounds(gfx::Rect( 100, 100, 100, 100));
1517 window2_->SetBounds(gfx::Rect(200, 100, 100, 100)); 1517 window2_->SetBounds(gfx::Rect(200, 100, 100, 100));
1518 window3_->SetBounds(gfx::Rect(300, 100, 100, 100)); 1518 window3_->SetBounds(gfx::Rect(300, 100, 100, 100));
1519 window4_->SetBounds(gfx::Rect(400, 100, 100, 100)); 1519 window4_->SetBounds(gfx::Rect(400, 100, 100, 100));
1520 delegate2_.set_max_size(gfx::Size(101, 0)); 1520 delegate2_.set_max_size(gfx::Size(101, 0));
1521 delegate3_.set_max_size(gfx::Size(101, 0)); 1521 delegate3_.set_max_size(gfx::Size(101, 0));
1522 1522
1523 std::vector<aura::Window*> windows; 1523 std::vector<aura::Window*> windows;
1524 windows.push_back(window2_.get()); 1524 windows.push_back(window2_.get());
1525 windows.push_back(window3_.get()); 1525 windows.push_back(window3_.get());
1526 windows.push_back(window4_.get()); 1526 windows.push_back(window4_.get());
1527 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 1527 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
1528 window_.get(), gfx::Point(), HTRIGHT, 1528 window_.get(), gfx::Point(), HTRIGHT,
1529 aura::client::WINDOW_MOVE_SOURCE_MOUSE, windows)); 1529 aura::client::WINDOW_MOVE_SOURCE_MOUSE, windows));
1530 ASSERT_TRUE(resizer.get()); 1530 ASSERT_TRUE(resizer.get());
1531 // Move it 52 to the left, which should contract w1 and expand w2-4. 1531 // Move it 52 to the left, which should contract w1 and expand w2-4.
1532 resizer->Drag(CalculateDragPoint(*resizer, -52, 0), 0); 1532 resizer->Drag(CalculateDragPoint(*resizer, -52, 0), 0);
1533 EXPECT_EQ("100,100 48x100", window_->bounds().ToString()); 1533 EXPECT_EQ("100,100 48x100", window_->bounds().ToString());
1534 EXPECT_EQ("148,100 101x100", window2_->bounds().ToString()); 1534 EXPECT_EQ("148,100 101x100", window2_->bounds().ToString());
1535 EXPECT_EQ("249,100 101x100", window3_->bounds().ToString()); 1535 EXPECT_EQ("249,100 101x100", window3_->bounds().ToString());
1536 EXPECT_EQ("350,100 150x100", window4_->bounds().ToString()); 1536 EXPECT_EQ("350,100 150x100", window4_->bounds().ToString());
1537 } 1537 }
1538 1538
1539 TEST_F(WorkspaceWindowResizerTest, DontExceedMaxHeight) { 1539 TEST_F(WorkspaceWindowResizerTest, DontExceedMaxHeight) {
1540 UpdateDisplay("600x800"); 1540 UpdateDisplay("600x800");
1541 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 1541 aura::Window* root = Shell::GetPrimaryRootWindow();
1542 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 1542 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
1543 1543
1544 // Four 100x100 windows flush against eachother, starting at 100,100. 1544 // Four 100x100 windows flush against eachother, starting at 100,100.
1545 window_->SetBounds(gfx::Rect( 100, 100, 100, 100)); 1545 window_->SetBounds(gfx::Rect( 100, 100, 100, 100));
1546 window2_->SetBounds(gfx::Rect(100, 200, 100, 100)); 1546 window2_->SetBounds(gfx::Rect(100, 200, 100, 100));
1547 window3_->SetBounds(gfx::Rect(100, 300, 100, 100)); 1547 window3_->SetBounds(gfx::Rect(100, 300, 100, 100));
1548 window4_->SetBounds(gfx::Rect(100, 400, 100, 100)); 1548 window4_->SetBounds(gfx::Rect(100, 400, 100, 100));
1549 delegate2_.set_max_size(gfx::Size(0, 101)); 1549 delegate2_.set_max_size(gfx::Size(0, 101));
1550 delegate3_.set_max_size(gfx::Size(0, 101)); 1550 delegate3_.set_max_size(gfx::Size(0, 101));
1551 1551
(...skipping 15 matching lines...) Expand all
1567 1567
1568 #if defined(OS_WIN) 1568 #if defined(OS_WIN)
1569 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 1569 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
1570 #define MAYBE_DontExceedMinHeight DISABLED_DontExceedMinHeight 1570 #define MAYBE_DontExceedMinHeight DISABLED_DontExceedMinHeight
1571 #else 1571 #else
1572 #define MAYBE_DontExceedMinHeight DontExceedMinHeight 1572 #define MAYBE_DontExceedMinHeight DontExceedMinHeight
1573 #endif 1573 #endif
1574 1574
1575 TEST_F(WorkspaceWindowResizerTest, MAYBE_DontExceedMinHeight) { 1575 TEST_F(WorkspaceWindowResizerTest, MAYBE_DontExceedMinHeight) {
1576 UpdateDisplay("600x500"); 1576 UpdateDisplay("600x500");
1577 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 1577 aura::Window* root = Shell::GetPrimaryRootWindow();
1578 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 1578 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
1579 1579
1580 // Four 100x100 windows flush against eachother, starting at 100,100. 1580 // Four 100x100 windows flush against eachother, starting at 100,100.
1581 window_->SetBounds(gfx::Rect( 100, 100, 100, 100)); 1581 window_->SetBounds(gfx::Rect( 100, 100, 100, 100));
1582 window2_->SetBounds(gfx::Rect(100, 200, 100, 100)); 1582 window2_->SetBounds(gfx::Rect(100, 200, 100, 100));
1583 window3_->SetBounds(gfx::Rect(100, 300, 100, 100)); 1583 window3_->SetBounds(gfx::Rect(100, 300, 100, 100));
1584 window4_->SetBounds(gfx::Rect(100, 400, 100, 100)); 1584 window4_->SetBounds(gfx::Rect(100, 400, 100, 100));
1585 delegate2_.set_min_size(gfx::Size(0, 99)); 1585 delegate2_.set_min_size(gfx::Size(0, 99));
1586 delegate3_.set_min_size(gfx::Size(0, 99)); 1586 delegate3_.set_min_size(gfx::Size(0, 99));
1587 1587
1588 std::vector<aura::Window*> windows; 1588 std::vector<aura::Window*> windows;
1589 windows.push_back(window2_.get()); 1589 windows.push_back(window2_.get());
1590 windows.push_back(window3_.get()); 1590 windows.push_back(window3_.get());
1591 windows.push_back(window4_.get()); 1591 windows.push_back(window4_.get());
1592 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 1592 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
1593 window_.get(), gfx::Point(), HTBOTTOM, 1593 window_.get(), gfx::Point(), HTBOTTOM,
1594 aura::client::WINDOW_MOVE_SOURCE_MOUSE, windows)); 1594 aura::client::WINDOW_MOVE_SOURCE_MOUSE, windows));
1595 ASSERT_TRUE(resizer.get()); 1595 ASSERT_TRUE(resizer.get());
1596 // Move it 52 down, which should expand w1 and contract w2-4. 1596 // Move it 52 down, which should expand w1 and contract w2-4.
1597 resizer->Drag(CalculateDragPoint(*resizer, 0, 52), 0); 1597 resizer->Drag(CalculateDragPoint(*resizer, 0, 52), 0);
1598 EXPECT_EQ("100,100 100x152", window_->bounds().ToString()); 1598 EXPECT_EQ("100,100 100x152", window_->bounds().ToString());
1599 EXPECT_EQ("100,252 100x99", window2_->bounds().ToString()); 1599 EXPECT_EQ("100,252 100x99", window2_->bounds().ToString());
1600 EXPECT_EQ("100,351 100x99", window3_->bounds().ToString()); 1600 EXPECT_EQ("100,351 100x99", window3_->bounds().ToString());
1601 EXPECT_EQ("100,450 100x50", window4_->bounds().ToString()); 1601 EXPECT_EQ("100,450 100x50", window4_->bounds().ToString());
1602 } 1602 }
1603 1603
1604 TEST_F(WorkspaceWindowResizerTest, DontExpandRightmostPastMaxWidth) { 1604 TEST_F(WorkspaceWindowResizerTest, DontExpandRightmostPastMaxWidth) {
1605 UpdateDisplay("600x800"); 1605 UpdateDisplay("600x800");
1606 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 1606 aura::Window* root = Shell::GetPrimaryRootWindow();
1607 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 1607 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
1608 1608
1609 // Three 100x100 windows flush against eachother, starting at 100,100. 1609 // Three 100x100 windows flush against eachother, starting at 100,100.
1610 window_->SetBounds(gfx::Rect( 100, 100, 100, 100)); 1610 window_->SetBounds(gfx::Rect( 100, 100, 100, 100));
1611 window2_->SetBounds(gfx::Rect(200, 100, 100, 100)); 1611 window2_->SetBounds(gfx::Rect(200, 100, 100, 100));
1612 window3_->SetBounds(gfx::Rect(300, 100, 100, 100)); 1612 window3_->SetBounds(gfx::Rect(300, 100, 100, 100));
1613 delegate3_.set_max_size(gfx::Size(101, 0)); 1613 delegate3_.set_max_size(gfx::Size(101, 0));
1614 1614
1615 std::vector<aura::Window*> windows; 1615 std::vector<aura::Window*> windows;
1616 windows.push_back(window2_.get()); 1616 windows.push_back(window2_.get());
1617 windows.push_back(window3_.get()); 1617 windows.push_back(window3_.get());
1618 windows.push_back(window4_.get()); 1618 windows.push_back(window4_.get());
1619 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 1619 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
1620 window_.get(), gfx::Point(), HTRIGHT, 1620 window_.get(), gfx::Point(), HTRIGHT,
1621 aura::client::WINDOW_MOVE_SOURCE_MOUSE, windows)); 1621 aura::client::WINDOW_MOVE_SOURCE_MOUSE, windows));
1622 ASSERT_TRUE(resizer.get()); 1622 ASSERT_TRUE(resizer.get());
1623 // Move it 51 to the left, which should contract w1 and expand w2-3. 1623 // Move it 51 to the left, which should contract w1 and expand w2-3.
1624 resizer->Drag(CalculateDragPoint(*resizer, -51, 0), 0); 1624 resizer->Drag(CalculateDragPoint(*resizer, -51, 0), 0);
1625 EXPECT_EQ("100,100 49x100", window_->bounds().ToString()); 1625 EXPECT_EQ("100,100 49x100", window_->bounds().ToString());
1626 EXPECT_EQ("149,100 150x100", window2_->bounds().ToString()); 1626 EXPECT_EQ("149,100 150x100", window2_->bounds().ToString());
1627 EXPECT_EQ("299,100 101x100", window3_->bounds().ToString()); 1627 EXPECT_EQ("299,100 101x100", window3_->bounds().ToString());
1628 } 1628 }
1629 1629
1630 TEST_F(WorkspaceWindowResizerTest, MoveAttachedWhenGrownToMaxSize) { 1630 TEST_F(WorkspaceWindowResizerTest, MoveAttachedWhenGrownToMaxSize) {
1631 UpdateDisplay("600x800"); 1631 UpdateDisplay("600x800");
1632 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 1632 aura::Window* root = Shell::GetPrimaryRootWindow();
1633 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 1633 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
1634 1634
1635 // Three 100x100 windows flush against eachother, starting at 100,100. 1635 // Three 100x100 windows flush against eachother, starting at 100,100.
1636 window_->SetBounds(gfx::Rect( 100, 100, 100, 100)); 1636 window_->SetBounds(gfx::Rect( 100, 100, 100, 100));
1637 window2_->SetBounds(gfx::Rect(200, 100, 100, 100)); 1637 window2_->SetBounds(gfx::Rect(200, 100, 100, 100));
1638 window3_->SetBounds(gfx::Rect(300, 100, 100, 100)); 1638 window3_->SetBounds(gfx::Rect(300, 100, 100, 100));
1639 delegate2_.set_max_size(gfx::Size(101, 0)); 1639 delegate2_.set_max_size(gfx::Size(101, 0));
1640 delegate3_.set_max_size(gfx::Size(101, 0)); 1640 delegate3_.set_max_size(gfx::Size(101, 0));
1641 1641
1642 std::vector<aura::Window*> windows; 1642 std::vector<aura::Window*> windows;
(...skipping 13 matching lines...) Expand all
1656 1656
1657 #if defined(OS_WIN) 1657 #if defined(OS_WIN)
1658 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 1658 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
1659 #define MAYBE_MainWindowHonoursMaxWidth DISABLED_MainWindowHonoursMaxWidth 1659 #define MAYBE_MainWindowHonoursMaxWidth DISABLED_MainWindowHonoursMaxWidth
1660 #else 1660 #else
1661 #define MAYBE_MainWindowHonoursMaxWidth MainWindowHonoursMaxWidth 1661 #define MAYBE_MainWindowHonoursMaxWidth MainWindowHonoursMaxWidth
1662 #endif 1662 #endif
1663 1663
1664 TEST_F(WorkspaceWindowResizerTest, MAYBE_MainWindowHonoursMaxWidth) { 1664 TEST_F(WorkspaceWindowResizerTest, MAYBE_MainWindowHonoursMaxWidth) {
1665 UpdateDisplay("400x800"); 1665 UpdateDisplay("400x800");
1666 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 1666 aura::Window* root = Shell::GetPrimaryRootWindow();
1667 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 1667 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
1668 1668
1669 // Three 100x100 windows flush against eachother, starting at 100,100. 1669 // Three 100x100 windows flush against eachother, starting at 100,100.
1670 window_->SetBounds(gfx::Rect( 100, 100, 100, 100)); 1670 window_->SetBounds(gfx::Rect( 100, 100, 100, 100));
1671 window2_->SetBounds(gfx::Rect(200, 100, 100, 100)); 1671 window2_->SetBounds(gfx::Rect(200, 100, 100, 100));
1672 window3_->SetBounds(gfx::Rect(300, 100, 100, 100)); 1672 window3_->SetBounds(gfx::Rect(300, 100, 100, 100));
1673 delegate_.set_max_size(gfx::Size(102, 0)); 1673 delegate_.set_max_size(gfx::Size(102, 0));
1674 1674
1675 std::vector<aura::Window*> windows; 1675 std::vector<aura::Window*> windows;
1676 windows.push_back(window2_.get()); 1676 windows.push_back(window2_.get());
1677 windows.push_back(window3_.get()); 1677 windows.push_back(window3_.get());
1678 windows.push_back(window4_.get()); 1678 windows.push_back(window4_.get());
1679 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 1679 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
1680 window_.get(), gfx::Point(), HTRIGHT, 1680 window_.get(), gfx::Point(), HTRIGHT,
1681 aura::client::WINDOW_MOVE_SOURCE_MOUSE, windows)); 1681 aura::client::WINDOW_MOVE_SOURCE_MOUSE, windows));
1682 ASSERT_TRUE(resizer.get()); 1682 ASSERT_TRUE(resizer.get());
1683 // Move it 50 to the right, which should expand w1 and contract w2-3, as they 1683 // Move it 50 to the right, which should expand w1 and contract w2-3, as they
1684 // won't fit in the root window in their original sizes. 1684 // won't fit in the root window in their original sizes.
1685 resizer->Drag(CalculateDragPoint(*resizer, 50, 0), 0); 1685 resizer->Drag(CalculateDragPoint(*resizer, 50, 0), 0);
1686 EXPECT_EQ("100,100 102x100", window_->bounds().ToString()); 1686 EXPECT_EQ("100,100 102x100", window_->bounds().ToString());
1687 EXPECT_EQ("202,100 99x100", window2_->bounds().ToString()); 1687 EXPECT_EQ("202,100 99x100", window2_->bounds().ToString());
1688 EXPECT_EQ("301,100 99x100", window3_->bounds().ToString()); 1688 EXPECT_EQ("301,100 99x100", window3_->bounds().ToString());
1689 } 1689 }
1690 1690
1691 TEST_F(WorkspaceWindowResizerTest, MainWindowHonoursMinWidth) { 1691 TEST_F(WorkspaceWindowResizerTest, MainWindowHonoursMinWidth) {
1692 UpdateDisplay("400x800"); 1692 UpdateDisplay("400x800");
1693 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 1693 aura::Window* root = Shell::GetPrimaryRootWindow();
1694 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); 1694 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
1695 1695
1696 // Three 100x100 windows flush against eachother, starting at 100,100. 1696 // Three 100x100 windows flush against eachother, starting at 100,100.
1697 window_->SetBounds(gfx::Rect( 100, 100, 100, 100)); 1697 window_->SetBounds(gfx::Rect( 100, 100, 100, 100));
1698 window2_->SetBounds(gfx::Rect(200, 100, 100, 100)); 1698 window2_->SetBounds(gfx::Rect(200, 100, 100, 100));
1699 window3_->SetBounds(gfx::Rect(300, 100, 100, 100)); 1699 window3_->SetBounds(gfx::Rect(300, 100, 100, 100));
1700 delegate_.set_min_size(gfx::Size(98, 0)); 1700 delegate_.set_min_size(gfx::Size(98, 0));
1701 1701
1702 std::vector<aura::Window*> windows; 1702 std::vector<aura::Window*> windows;
1703 windows.push_back(window2_.get()); 1703 windows.push_back(window2_.get());
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 RunAnimationTillComplete(phantom_controller->animation_.get()); 1954 RunAnimationTillComplete(phantom_controller->animation_.get());
1955 1955
1956 // Hide phantom controller. Both widgets should close. 1956 // Hide phantom controller. Both widgets should close.
1957 phantom_controller->Hide(); 1957 phantom_controller->Hide();
1958 EXPECT_FALSE(phantom_controller->phantom_widget_); 1958 EXPECT_FALSE(phantom_controller->phantom_widget_);
1959 EXPECT_FALSE(phantom_controller->phantom_widget_start_); 1959 EXPECT_FALSE(phantom_controller->phantom_widget_start_);
1960 } 1960 }
1961 1961
1962 } // namespace internal 1962 } // namespace internal
1963 } // namespace ash 1963 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | chrome/browser/chromeos/display/overscan_calibrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698