| OLD | NEW |
| 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/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_controller.h" | 8 #include "ash/display/display_controller.h" |
| 9 #include "ash/display/display_info.h" | 9 #include "ash/display/display_info.h" |
| 10 #include "ash/display/display_layout_store.h" | 10 #include "ash/display/display_layout_store.h" |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); | 1456 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); |
| 1457 EXPECT_EQ("100,200", host0->GetBounds().origin().ToString()); | 1457 EXPECT_EQ("100,200", host0->GetBounds().origin().ToString()); |
| 1458 EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); | 1458 EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); |
| 1459 EXPECT_EQ("300,500", host1->GetBounds().origin().ToString()); | 1459 EXPECT_EQ("300,500", host1->GetBounds().origin().ToString()); |
| 1460 EXPECT_EQ("200x300", host1->GetBounds().size().ToString()); | 1460 EXPECT_EQ("200x300", host1->GetBounds().size().ToString()); |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 TEST_F(DisplayManagerTest, UnifiedDesktopBasic) { | 1463 TEST_F(DisplayManagerTest, UnifiedDesktopBasic) { |
| 1464 if (!SupportsMultipleDisplays()) | 1464 if (!SupportsMultipleDisplays()) |
| 1465 return; | 1465 return; |
| 1466 test::DisplayManagerTestApi::EnableUnifiedDesktopForTest(); |
| 1467 |
| 1466 // Don't check root window destruction in unified mode. | 1468 // Don't check root window destruction in unified mode. |
| 1467 Shell::GetPrimaryRootWindow()->RemoveObserver(this); | 1469 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
| 1468 | 1470 |
| 1469 UpdateDisplay("300x200,400x500"); | 1471 UpdateDisplay("300x200,400x500"); |
| 1470 | 1472 |
| 1471 // Switch to unified desktop. | 1473 // Switch to unified desktop. |
| 1472 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); | 1474 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); |
| 1473 display_manager()->ReconfigureDisplays(); | 1475 display_manager()->ReconfigureDisplays(); |
| 1474 | 1476 |
| 1475 gfx::Screen* screen = | 1477 gfx::Screen* screen = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1493 // Switch back to extended desktop. | 1495 // Switch back to extended desktop. |
| 1494 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::EXTENDED); | 1496 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::EXTENDED); |
| 1495 display_manager()->ReconfigureDisplays(); | 1497 display_manager()->ReconfigureDisplays(); |
| 1496 EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString()); | 1498 EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString()); |
| 1497 EXPECT_EQ("400x500", ScreenUtil::GetSecondaryDisplay().size().ToString()); | 1499 EXPECT_EQ("400x500", ScreenUtil::GetSecondaryDisplay().size().ToString()); |
| 1498 } | 1500 } |
| 1499 | 1501 |
| 1500 TEST_F(DisplayManagerTest, RotateUnifiedDesktop) { | 1502 TEST_F(DisplayManagerTest, RotateUnifiedDesktop) { |
| 1501 if (!SupportsMultipleDisplays()) | 1503 if (!SupportsMultipleDisplays()) |
| 1502 return; | 1504 return; |
| 1505 test::DisplayManagerTestApi::EnableUnifiedDesktopForTest(); |
| 1506 |
| 1503 // Don't check root window destruction in unified mode. | 1507 // Don't check root window destruction in unified mode. |
| 1504 Shell::GetPrimaryRootWindow()->RemoveObserver(this); | 1508 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
| 1505 | 1509 |
| 1506 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); | 1510 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); |
| 1507 display_manager()->SetMultiDisplayMode(DisplayManager::UNIFIED); | 1511 display_manager()->SetMultiDisplayMode(DisplayManager::UNIFIED); |
| 1508 UpdateDisplay("300x200,400x500"); | 1512 UpdateDisplay("300x200,400x500"); |
| 1509 | 1513 |
| 1510 gfx::Screen* screen = | 1514 gfx::Screen* screen = |
| 1511 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); | 1515 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); |
| 1512 const gfx::Display& display = screen->GetPrimaryDisplay(); | 1516 const gfx::Display& display = screen->GetPrimaryDisplay(); |
| 1513 EXPECT_EQ("700x500", display.size().ToString()); | 1517 EXPECT_EQ("700x500", display.size().ToString()); |
| 1514 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_90, | 1518 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_90, |
| 1515 gfx::Display::ROTATION_SOURCE_ACTIVE); | 1519 gfx::Display::ROTATION_SOURCE_ACTIVE); |
| 1516 EXPECT_EQ("500x700", screen->GetPrimaryDisplay().size().ToString()); | 1520 EXPECT_EQ("500x700", screen->GetPrimaryDisplay().size().ToString()); |
| 1517 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_0, | 1521 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_0, |
| 1518 gfx::Display::ROTATION_SOURCE_ACTIVE); | 1522 gfx::Display::ROTATION_SOURCE_ACTIVE); |
| 1519 EXPECT_EQ("700x500", screen->GetPrimaryDisplay().size().ToString()); | 1523 EXPECT_EQ("700x500", screen->GetPrimaryDisplay().size().ToString()); |
| 1520 | 1524 |
| 1521 UpdateDisplay("300x200"); | 1525 UpdateDisplay("300x200"); |
| 1522 EXPECT_EQ("300x200", screen->GetPrimaryDisplay().size().ToString()); | 1526 EXPECT_EQ("300x200", screen->GetPrimaryDisplay().size().ToString()); |
| 1523 } | 1527 } |
| 1524 | 1528 |
| 1525 // Makes sure the transition from unified to single won't crash | 1529 // Makes sure the transition from unified to single won't crash |
| 1526 // with docked wnidows. | 1530 // with docked wnidows. |
| 1527 TEST_F(DisplayManagerTest, UnifiedWithDockWindows) { | 1531 TEST_F(DisplayManagerTest, UnifiedWithDockWindows) { |
| 1528 if (!SupportsMultipleDisplays()) | 1532 if (!SupportsMultipleDisplays()) |
| 1529 return; | 1533 return; |
| 1534 test::DisplayManagerTestApi::EnableUnifiedDesktopForTest(); |
| 1535 |
| 1530 // Don't check root window destruction in unified mode. | 1536 // Don't check root window destruction in unified mode. |
| 1531 Shell::GetPrimaryRootWindow()->RemoveObserver(this); | 1537 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
| 1532 | 1538 |
| 1533 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); | 1539 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); |
| 1534 display_manager()->SetMultiDisplayMode(DisplayManager::UNIFIED); | 1540 display_manager()->SetMultiDisplayMode(DisplayManager::UNIFIED); |
| 1535 UpdateDisplay("300x200,400x500"); | 1541 UpdateDisplay("300x200,400x500"); |
| 1536 | 1542 |
| 1537 scoped_ptr<aura::Window> docked( | 1543 scoped_ptr<aura::Window> docked( |
| 1538 CreateTestWindowInShellWithBounds(gfx::Rect(10, 10, 50, 50))); | 1544 CreateTestWindowInShellWithBounds(gfx::Rect(10, 10, 50, 50))); |
| 1539 docked->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); | 1545 docked->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 1705 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
| 1700 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); | 1706 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); |
| 1701 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); | 1707 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); |
| 1702 | 1708 |
| 1703 DisplayInfo::SetUse125DSFForUIScaling(false); | 1709 DisplayInfo::SetUse125DSFForUIScaling(false); |
| 1704 } | 1710 } |
| 1705 | 1711 |
| 1706 #endif // OS_CHROMEOS | 1712 #endif // OS_CHROMEOS |
| 1707 | 1713 |
| 1708 } // namespace ash | 1714 } // namespace ash |
| OLD | NEW |