| 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_controller.h" | 5 #include "ash/display/display_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_info.h" | 7 #include "ash/display/display_info.h" |
| 8 #include "ash/display/display_layout_store.h" |
| 8 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 9 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
| 10 #include "ash/screen_ash.h" | 11 #include "ash/screen_ash.h" |
| 11 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
| 12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 13 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
| 14 #include "ash/test/cursor_manager_test_api.h" | 15 #include "ash/test/cursor_manager_test_api.h" |
| 15 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
| 16 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
| 17 #include "ui/aura/test/event_generator.h" | 18 #include "ui/aura/test/event_generator.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 Shell::GetAllRootWindows()[0]); | 71 Shell::GetAllRootWindows()[0]); |
| 71 } | 72 } |
| 72 | 73 |
| 73 gfx::Display GetSecondaryDisplay() { | 74 gfx::Display GetSecondaryDisplay() { |
| 74 return Shell::GetScreen()->GetDisplayNearestWindow( | 75 return Shell::GetScreen()->GetDisplayNearestWindow( |
| 75 Shell::GetAllRootWindows()[1]); | 76 Shell::GetAllRootWindows()[1]); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void SetSecondaryDisplayLayoutAndOffset(DisplayLayout::Position position, | 79 void SetSecondaryDisplayLayoutAndOffset(DisplayLayout::Position position, |
| 79 int offset) { | 80 int offset) { |
| 80 DisplayController* display_controller = | |
| 81 Shell::GetInstance()->display_controller(); | |
| 82 DisplayLayout layout(position, offset); | 81 DisplayLayout layout(position, offset); |
| 83 ASSERT_GT(Shell::GetScreen()->GetNumDisplays(), 1); | 82 ASSERT_GT(Shell::GetScreen()->GetNumDisplays(), 1); |
| 84 display_controller->SetLayoutForCurrentDisplays(layout); | 83 Shell::GetInstance()->display_controller()-> |
| 84 SetLayoutForCurrentDisplays(layout); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SetSecondaryDisplayLayout(DisplayLayout::Position position) { | 87 void SetSecondaryDisplayLayout(DisplayLayout::Position position) { |
| 88 SetSecondaryDisplayLayoutAndOffset(position, 0); | 88 SetSecondaryDisplayLayoutAndOffset(position, 0); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SetDefaultDisplayLayout(DisplayLayout::Position position) { | 91 void SetDefaultDisplayLayout(DisplayLayout::Position position) { |
| 92 Shell::GetInstance()->display_controller()-> | 92 Shell::GetInstance()->display_manager()->layout_store()-> |
| 93 SetDefaultDisplayLayout(DisplayLayout(position, 0)); | 93 SetDefaultDisplayLayout(DisplayLayout(position, 0)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 class DisplayControllerShutdownTest : public test::AshTestBase { | 96 class DisplayControllerShutdownTest : public test::AshTestBase { |
| 97 public: | 97 public: |
| 98 virtual void TearDown() OVERRIDE { | 98 virtual void TearDown() OVERRIDE { |
| 99 test::AshTestBase::TearDown(); | 99 test::AshTestBase::TearDown(); |
| 100 if (!SupportsMultipleDisplays()) | 100 if (!SupportsMultipleDisplays()) |
| 101 return; | 101 return; |
| 102 | 102 |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 EXPECT_EQ("aura_root_x", GetXWindowName(secondary)); | 991 EXPECT_EQ("aura_root_x", GetXWindowName(secondary)); |
| 992 | 992 |
| 993 // Switching back to single display. | 993 // Switching back to single display. |
| 994 UpdateDisplay("300x400"); | 994 UpdateDisplay("300x400"); |
| 995 EXPECT_EQ("aura_root_0", GetXWindowName(Shell::GetPrimaryRootWindow())); | 995 EXPECT_EQ("aura_root_0", GetXWindowName(Shell::GetPrimaryRootWindow())); |
| 996 } | 996 } |
| 997 #endif | 997 #endif |
| 998 | 998 |
| 999 } // namespace test | 999 } // namespace test |
| 1000 } // namespace ash | 1000 } // namespace ash |
| OLD | NEW |