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 "chrome/browser/chromeos/display/display_preferences.h" | 5 #include "chrome/browser/chromeos/display/display_preferences.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 display::DisplayIdList list = ash::test::CreateDisplayIdList2(id1, dummy_id); | 293 display::DisplayIdList list = ash::test::CreateDisplayIdList2(id1, dummy_id); |
294 StoreDisplayLayoutPrefForTest(list, *dummy_layout); | 294 StoreDisplayLayoutPrefForTest(list, *dummy_layout); |
295 | 295 |
296 // Can't switch to a display that does not exist. | 296 // Can't switch to a display that does not exist. |
297 window_tree_host_manager->SetPrimaryDisplayId(dummy_id); | 297 window_tree_host_manager->SetPrimaryDisplayId(dummy_id); |
298 EXPECT_NE(dummy_id, display::Screen::GetScreen()->GetPrimaryDisplay().id()); | 298 EXPECT_NE(dummy_id, display::Screen::GetScreen()->GetPrimaryDisplay().id()); |
299 | 299 |
300 window_tree_host_manager->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13)); | 300 window_tree_host_manager->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13)); |
301 display_manager()->SetDisplayRotation(id1, display::Display::ROTATE_90, | 301 display_manager()->SetDisplayRotation(id1, display::Display::ROTATE_90, |
302 display::Display::ROTATION_SOURCE_USER); | 302 display::Display::ROTATION_SOURCE_USER); |
303 EXPECT_TRUE(display_manager()->SetDisplayUIScale(id1, 1.25f)); | 303 EXPECT_TRUE(ash::test::DisplayManagerTestApi(display_manager()) |
304 EXPECT_FALSE(display_manager()->SetDisplayUIScale(id2, 1.25f)); | 304 .SetDisplayUIScale(id1, 1.25f)); |
| 305 EXPECT_FALSE(ash::test::DisplayManagerTestApi(display_manager()) |
| 306 .SetDisplayUIScale(id2, 1.25f)); |
305 | 307 |
306 const base::DictionaryValue* displays = | 308 const base::DictionaryValue* displays = |
307 local_state()->GetDictionary(prefs::kSecondaryDisplays); | 309 local_state()->GetDictionary(prefs::kSecondaryDisplays); |
308 const base::DictionaryValue* layout_value = nullptr; | 310 const base::DictionaryValue* layout_value = nullptr; |
309 std::string key = base::Int64ToString(id1) + "," + base::Int64ToString(id2); | 311 std::string key = base::Int64ToString(id1) + "," + base::Int64ToString(id2); |
310 std::string dummy_key = | 312 std::string dummy_key = |
311 base::Int64ToString(id1) + "," + base::Int64ToString(dummy_id); | 313 base::Int64ToString(id1) + "," + base::Int64ToString(dummy_id); |
312 EXPECT_TRUE(displays->GetDictionary(dummy_key, &layout_value)); | 314 EXPECT_TRUE(displays->GetDictionary(dummy_key, &layout_value)); |
313 | 315 |
314 display::DisplayLayout stored_layout; | 316 display::DisplayLayout stored_layout; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 | 673 |
672 UpdateDisplay("200x200*2,200x200"); | 674 UpdateDisplay("200x200*2,200x200"); |
673 | 675 |
674 LoggedInAsGuest(); | 676 LoggedInAsGuest(); |
675 int64_t id1 = display::Screen::GetScreen()->GetPrimaryDisplay().id(); | 677 int64_t id1 = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
676 ash::test::ScopedSetInternalDisplayId set_internal( | 678 ash::test::ScopedSetInternalDisplayId set_internal( |
677 ash::Shell::GetInstance()->display_manager(), id1); | 679 ash::Shell::GetInstance()->display_manager(), id1); |
678 int64_t id2 = display_manager()->GetSecondaryDisplay().id(); | 680 int64_t id2 = display_manager()->GetSecondaryDisplay().id(); |
679 display_manager()->SetLayoutForCurrentDisplays(ash::test::CreateDisplayLayout( | 681 display_manager()->SetLayoutForCurrentDisplays(ash::test::CreateDisplayLayout( |
680 display_manager(), display::DisplayPlacement::TOP, 10)); | 682 display_manager(), display::DisplayPlacement::TOP, 10)); |
681 display_manager()->SetDisplayUIScale(id1, 1.25f); | 683 ash::test::DisplayManagerTestApi(display_manager()) |
| 684 .SetDisplayUIScale(id1, 1.25f); |
682 window_tree_host_manager->SetPrimaryDisplayId(id2); | 685 window_tree_host_manager->SetPrimaryDisplayId(id2); |
683 int64_t new_primary = display::Screen::GetScreen()->GetPrimaryDisplay().id(); | 686 int64_t new_primary = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
684 window_tree_host_manager->SetOverscanInsets(new_primary, | 687 window_tree_host_manager->SetOverscanInsets(new_primary, |
685 gfx::Insets(10, 11, 12, 13)); | 688 gfx::Insets(10, 11, 12, 13)); |
686 display_manager()->SetDisplayRotation(new_primary, | 689 display_manager()->SetDisplayRotation(new_primary, |
687 display::Display::ROTATE_90, | 690 display::Display::ROTATE_90, |
688 display::Display::ROTATION_SOURCE_USER); | 691 display::Display::ROTATION_SOURCE_USER); |
689 | 692 |
690 // Does not store the preferences locally. | 693 // Does not store the preferences locally. |
691 EXPECT_FALSE(local_state()->FindPreference( | 694 EXPECT_FALSE(local_state()->FindPreference( |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 | 1112 |
1110 EXPECT_EQ(gfx::Rect(0, 0, 200, 200), | 1113 EXPECT_EQ(gfx::Rect(0, 0, 200, 200), |
1111 display_manager()->GetDisplayForId(list[0]).bounds()); | 1114 display_manager()->GetDisplayForId(list[0]).bounds()); |
1112 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200), | 1115 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200), |
1113 display_manager()->GetDisplayForId(list[1]).bounds()); | 1116 display_manager()->GetDisplayForId(list[1]).bounds()); |
1114 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300), | 1117 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300), |
1115 display_manager()->GetDisplayForId(list[2]).bounds()); | 1118 display_manager()->GetDisplayForId(list[2]).bounds()); |
1116 } | 1119 } |
1117 | 1120 |
1118 } // namespace chromeos | 1121 } // namespace chromeos |
OLD | NEW |