| 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/accelerators/accelerator_commands_aura.h" | 7 #include "ash/accelerators/accelerator_commands_aura.h" |
| 8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/display/display_info.h" | 9 #include "ash/common/display/display_info.h" |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| 11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 12 #include "ash/display/display_configuration_controller.h" | 12 #include "ash/display/display_configuration_controller.h" |
| 13 #include "ash/display/display_layout_store.h" | |
| 14 #include "ash/display/display_util.h" | 13 #include "ash/display/display_util.h" |
| 15 #include "ash/display/mirror_window_controller.h" | 14 #include "ash/display/mirror_window_controller.h" |
| 16 #include "ash/display/window_tree_host_manager.h" | 15 #include "ash/display/window_tree_host_manager.h" |
| 17 #include "ash/screen_util.h" | 16 #include "ash/screen_util.h" |
| 18 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 19 #include "ash/test/ash_md_test_base.h" | 18 #include "ash/test/ash_md_test_base.h" |
| 20 #include "ash/test/ash_test_base.h" | 19 #include "ash/test/ash_test_base.h" |
| 21 #include "ash/test/display_manager_test_api.h" | 20 #include "ash/test/display_manager_test_api.h" |
| 22 #include "ash/test/mirror_window_test_api.h" | 21 #include "ash/test/mirror_window_test_api.h" |
| 23 #include "ash/wm/window_state_aura.h" | 22 #include "ash/wm/window_state_aura.h" |
| 24 #include "base/command_line.h" | 23 #include "base/command_line.h" |
| 25 #include "base/format_macros.h" | 24 #include "base/format_macros.h" |
| 26 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 27 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
| 28 #include "grit/ash_strings.h" | 27 #include "grit/ash_strings.h" |
| 29 #include "ui/aura/client/aura_constants.h" | 28 #include "ui/aura/client/aura_constants.h" |
| 30 #include "ui/aura/env.h" | 29 #include "ui/aura/env.h" |
| 31 #include "ui/aura/window_observer.h" | 30 #include "ui/aura/window_observer.h" |
| 32 #include "ui/aura/window_tree_host.h" | 31 #include "ui/aura/window_tree_host.h" |
| 33 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 34 #include "ui/display/display.h" | 33 #include "ui/display/display.h" |
| 35 #include "ui/display/display_observer.h" | 34 #include "ui/display/display_observer.h" |
| 36 #include "ui/display/manager/display_layout_builder.h" | 35 #include "ui/display/manager/display_layout_builder.h" |
| 36 #include "ui/display/manager/display_layout_store.h" |
| 37 #include "ui/display/screen.h" | 37 #include "ui/display/screen.h" |
| 38 #include "ui/events/test/event_generator.h" | 38 #include "ui/events/test/event_generator.h" |
| 39 #include "ui/gfx/font_render_params.h" | 39 #include "ui/gfx/font_render_params.h" |
| 40 | 40 |
| 41 namespace ash { | 41 namespace ash { |
| 42 | 42 |
| 43 using std::vector; | 43 using std::vector; |
| 44 using std::string; | 44 using std::string; |
| 45 | 45 |
| 46 using base::StringPrintf; | 46 using base::StringPrintf; |
| (...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2319 | 2319 |
| 2320 const DisplayInfo& info = display_manager()->GetDisplayInfo(id); | 2320 const DisplayInfo& info = display_manager()->GetDisplayInfo(id); |
| 2321 | 2321 |
| 2322 EXPECT_EQ(display::Display::ROTATE_90, | 2322 EXPECT_EQ(display::Display::ROTATE_90, |
| 2323 info.GetRotation(display::Display::ROTATION_SOURCE_USER)); | 2323 info.GetRotation(display::Display::ROTATION_SOURCE_USER)); |
| 2324 EXPECT_EQ(display::Display::ROTATE_90, | 2324 EXPECT_EQ(display::Display::ROTATE_90, |
| 2325 info.GetRotation(display::Display::ROTATION_SOURCE_ACTIVE)); | 2325 info.GetRotation(display::Display::ROTATION_SOURCE_ACTIVE)); |
| 2326 } | 2326 } |
| 2327 | 2327 |
| 2328 TEST_P(DisplayManagerTest, RejectInvalidLayoutData) { | 2328 TEST_P(DisplayManagerTest, RejectInvalidLayoutData) { |
| 2329 DisplayLayoutStore* layout_store = display_manager()->layout_store(); | 2329 display::DisplayLayoutStore* layout_store = display_manager()->layout_store(); |
| 2330 int64_t id1 = 10001; | 2330 int64_t id1 = 10001; |
| 2331 int64_t id2 = 10002; | 2331 int64_t id2 = 10002; |
| 2332 ASSERT_TRUE(CompareDisplayIds(id1, id2)); | 2332 ASSERT_TRUE(CompareDisplayIds(id1, id2)); |
| 2333 display::DisplayLayoutBuilder good_builder(id1); | 2333 display::DisplayLayoutBuilder good_builder(id1); |
| 2334 good_builder.SetSecondaryPlacement(id2, display::DisplayPlacement::LEFT, 0); | 2334 good_builder.SetSecondaryPlacement(id2, display::DisplayPlacement::LEFT, 0); |
| 2335 std::unique_ptr<display::DisplayLayout> good(good_builder.Build()); | 2335 std::unique_ptr<display::DisplayLayout> good(good_builder.Build()); |
| 2336 | 2336 |
| 2337 display::DisplayIdList good_list = test::CreateDisplayIdList2(id1, id2); | 2337 display::DisplayIdList good_list = test::CreateDisplayIdList2(id1, id2); |
| 2338 layout_store->RegisterLayoutForDisplayIdList(good_list, good->Copy()); | 2338 layout_store->RegisterLayoutForDisplayIdList(good_list, good->Copy()); |
| 2339 | 2339 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2351 | 2351 |
| 2352 TEST_P(DisplayManagerTest, GuessDisplayIdFieldsInDisplayLayout) { | 2352 TEST_P(DisplayManagerTest, GuessDisplayIdFieldsInDisplayLayout) { |
| 2353 int64_t id1 = 10001; | 2353 int64_t id1 = 10001; |
| 2354 int64_t id2 = 10002; | 2354 int64_t id2 = 10002; |
| 2355 | 2355 |
| 2356 std::unique_ptr<display::DisplayLayout> old_layout( | 2356 std::unique_ptr<display::DisplayLayout> old_layout( |
| 2357 new display::DisplayLayout); | 2357 new display::DisplayLayout); |
| 2358 old_layout->placement_list.emplace_back(display::DisplayPlacement::BOTTOM, 0); | 2358 old_layout->placement_list.emplace_back(display::DisplayPlacement::BOTTOM, 0); |
| 2359 old_layout->primary_id = id1; | 2359 old_layout->primary_id = id1; |
| 2360 | 2360 |
| 2361 DisplayLayoutStore* layout_store = display_manager()->layout_store(); | 2361 display::DisplayLayoutStore* layout_store = display_manager()->layout_store(); |
| 2362 display::DisplayIdList list = test::CreateDisplayIdList2(id1, id2); | 2362 display::DisplayIdList list = test::CreateDisplayIdList2(id1, id2); |
| 2363 layout_store->RegisterLayoutForDisplayIdList(list, std::move(old_layout)); | 2363 layout_store->RegisterLayoutForDisplayIdList(list, std::move(old_layout)); |
| 2364 const display::DisplayLayout& stored = | 2364 const display::DisplayLayout& stored = |
| 2365 layout_store->GetRegisteredDisplayLayout(list); | 2365 layout_store->GetRegisteredDisplayLayout(list); |
| 2366 | 2366 |
| 2367 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); | 2367 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); |
| 2368 EXPECT_EQ(id2, stored.placement_list[0].display_id); | 2368 EXPECT_EQ(id2, stored.placement_list[0].display_id); |
| 2369 } | 2369 } |
| 2370 | 2370 |
| 2371 #endif // OS_CHROMEOS | 2371 #endif // OS_CHROMEOS |
| 2372 | 2372 |
| 2373 } // namespace ash | 2373 } // namespace ash |
| OLD | NEW |