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

Side by Side Diff: ash/display/display_manager_unittest.cc

Issue 1130653004: Remove the removed display from the active list after displays are added (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/test/display_manager_test_api.cc » ('j') | 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/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"
11 #include "ash/display/display_util.h" 11 #include "ash/display/display_util.h"
12 #include "ash/display/mirror_window_controller.h" 12 #include "ash/display/mirror_window_controller.h"
13 #include "ash/screen_util.h" 13 #include "ash/screen_util.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
16 #include "ash/test/display_manager_test_api.h" 16 #include "ash/test/display_manager_test_api.h"
17 #include "ash/test/mirror_window_test_api.h" 17 #include "ash/test/mirror_window_test_api.h"
18 #include "ash/wm/window_state.h"
18 #include "base/command_line.h" 19 #include "base/command_line.h"
19 #include "base/format_macros.h" 20 #include "base/format_macros.h"
20 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "ui/aura/client/aura_constants.h"
22 #include "ui/aura/env.h" 24 #include "ui/aura/env.h"
23 #include "ui/aura/window_observer.h" 25 #include "ui/aura/window_observer.h"
24 #include "ui/aura/window_tree_host.h" 26 #include "ui/aura/window_tree_host.h"
25 #include "ui/events/test/event_generator.h" 27 #include "ui/events/test/event_generator.h"
26 #include "ui/gfx/display.h" 28 #include "ui/gfx/display.h"
27 #include "ui/gfx/display_observer.h" 29 #include "ui/gfx/display_observer.h"
28 #include "ui/gfx/font_render_params.h" 30 #include "ui/gfx/font_render_params.h"
29 #include "ui/gfx/screen.h" 31 #include "ui/gfx/screen.h"
30 #include "ui/gfx/screen_type_delegate.h" 32 #include "ui/gfx/screen_type_delegate.h"
31 33
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 gfx::Display::ROTATION_SOURCE_ACTIVE); 1507 gfx::Display::ROTATION_SOURCE_ACTIVE);
1506 EXPECT_EQ("500x700", screen->GetPrimaryDisplay().size().ToString()); 1508 EXPECT_EQ("500x700", screen->GetPrimaryDisplay().size().ToString());
1507 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_0, 1509 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_0,
1508 gfx::Display::ROTATION_SOURCE_ACTIVE); 1510 gfx::Display::ROTATION_SOURCE_ACTIVE);
1509 EXPECT_EQ("700x500", screen->GetPrimaryDisplay().size().ToString()); 1511 EXPECT_EQ("700x500", screen->GetPrimaryDisplay().size().ToString());
1510 1512
1511 UpdateDisplay("300x200"); 1513 UpdateDisplay("300x200");
1512 EXPECT_EQ("300x200", screen->GetPrimaryDisplay().size().ToString()); 1514 EXPECT_EQ("300x200", screen->GetPrimaryDisplay().size().ToString());
1513 } 1515 }
1514 1516
1517 // Makes sure the transition from unified to single won't crash
1518 // with docked wnidows.
1519 TEST_F(DisplayManagerTest, UnifiedWithDockWindows) {
1520 if (!SupportsMultipleDisplays())
1521 return;
1522
1523 display_manager()->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED);
1524 display_manager()->SetMultiDisplayMode(DisplayManager::UNIFIED);
1525 UpdateDisplay("300x200,400x500");
1526
1527 scoped_ptr<aura::Window> docked(
1528 CreateTestWindowInShellWithBounds(gfx::Rect(10, 10, 50, 50)));
1529 docked->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED);
1530 ASSERT_TRUE(wm::GetWindowState(docked.get())->IsDocked());
1531 EXPECT_EQ("0,0 250x453", docked->bounds().ToString());
1532 UpdateDisplay("300x200");
1533 // Make sure the window is still docked.
1534 EXPECT_TRUE(wm::GetWindowState(docked.get())->IsDocked());
1535 EXPECT_EQ("0,0 250x250", docked->bounds().ToString());
1536 }
1537
1515 class ScreenShutdownTest : public test::AshTestBase { 1538 class ScreenShutdownTest : public test::AshTestBase {
1516 public: 1539 public:
1517 ScreenShutdownTest() { 1540 ScreenShutdownTest() {
1518 } 1541 }
1519 ~ScreenShutdownTest() override {} 1542 ~ScreenShutdownTest() override {}
1520 1543
1521 void TearDown() override { 1544 void TearDown() override {
1522 gfx::Screen* orig_screen = 1545 gfx::Screen* orig_screen =
1523 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); 1546 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
1524 AshTestBase::TearDown(); 1547 AshTestBase::TearDown();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1689 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1667 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 1690 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
1668 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1691 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1669 1692
1670 DisplayInfo::SetUse125DSFForUIScaling(false); 1693 DisplayInfo::SetUse125DSFForUIScaling(false);
1671 } 1694 }
1672 1695
1673 #endif // OS_CHROMEOS 1696 #endif // OS_CHROMEOS
1674 1697
1675 } // namespace ash 1698 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/test/display_manager_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698