| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/test/base/in_process_browser_test.h" | 23 #include "chrome/test/base/in_process_browser_test.h" |
| 24 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
| 25 #include "chromeos/dbus/cryptohome_client.h" | 25 #include "chromeos/dbus/cryptohome_client.h" |
| 26 #include "chromeos/dbus/dbus_thread_manager.h" | 26 #include "chromeos/dbus/dbus_thread_manager.h" |
| 27 #include "chromeos/dbus/fake_cryptohome_client.h" | 27 #include "chromeos/dbus/fake_cryptohome_client.h" |
| 28 #include "chromeos/dbus/fake_session_manager_client.h" | 28 #include "chromeos/dbus/fake_session_manager_client.h" |
| 29 #include "chromeos/dbus/session_manager_client.h" | 29 #include "chromeos/dbus/session_manager_client.h" |
| 30 #include "chromeos/settings/cros_settings_names.h" | 30 #include "chromeos/settings/cros_settings_names.h" |
| 31 #include "content/public/test/test_utils.h" | 31 #include "content/public/test/test_utils.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 33 #include "ui/display/manager/display_layout.h" |
| 33 #include "ui/gfx/display.h" | 34 #include "ui/gfx/display.h" |
| 34 | 35 |
| 35 namespace em = enterprise_management; | 36 namespace em = enterprise_management; |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 ash::DisplayManager* GetDisplayManager() { | 40 ash::DisplayManager* GetDisplayManager() { |
| 40 return ash::Shell::GetInstance()->display_manager(); | 41 return ash::Shell::GetInstance()->display_manager(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 gfx::Display::Rotation GetRotationOfFirstDisplay() { | 44 gfx::Display::Rotation GetRotationOfFirstDisplay() { |
| 44 const ash::DisplayManager* const display_manager = GetDisplayManager(); | 45 const ash::DisplayManager* const display_manager = GetDisplayManager(); |
| 45 const int64_t first_display_id = display_manager->first_display_id(); | 46 const int64_t first_display_id = display_manager->first_display_id(); |
| 46 const gfx::Display& first_display = | 47 const gfx::Display& first_display = |
| 47 display_manager->GetDisplayForId(first_display_id); | 48 display_manager->GetDisplayForId(first_display_id); |
| 48 return first_display.rotation(); | 49 return first_display.rotation(); |
| 49 } | 50 } |
| 50 | 51 |
| 51 // Fails the test and returns ROTATE_0 if there is no second display. | 52 // Fails the test and returns ROTATE_0 if there is no second display. |
| 52 gfx::Display::Rotation GetRotationOfSecondDisplay() { | 53 gfx::Display::Rotation GetRotationOfSecondDisplay() { |
| 53 const ash::DisplayManager* const display_manager = GetDisplayManager(); | 54 const ash::DisplayManager* const display_manager = GetDisplayManager(); |
| 54 if (display_manager->GetNumDisplays() < 2) { | 55 if (display_manager->GetNumDisplays() < 2) { |
| 55 ADD_FAILURE() | 56 ADD_FAILURE() |
| 56 << "Requested rotation of second display while there was only one."; | 57 << "Requested rotation of second display while there was only one."; |
| 57 return gfx::Display::ROTATE_0; | 58 return gfx::Display::ROTATE_0; |
| 58 } | 59 } |
| 59 const ash::DisplayIdList display_id_pair = | 60 const display::DisplayIdList display_id_pair = |
| 60 display_manager->GetCurrentDisplayIdList(); | 61 display_manager->GetCurrentDisplayIdList(); |
| 61 const gfx::Display& second_display = | 62 const gfx::Display& second_display = |
| 62 display_manager->GetDisplayForId(display_id_pair[1]); | 63 display_manager->GetDisplayForId(display_id_pair[1]); |
| 63 return second_display.rotation(); | 64 return second_display.rotation(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 } // anonymous namespace | 67 } // anonymous namespace |
| 67 | 68 |
| 68 namespace policy { | 69 namespace policy { |
| 69 | 70 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 } | 322 } |
| 322 | 323 |
| 323 INSTANTIATE_TEST_CASE_P(PolicyDisplayRotationDefault, | 324 INSTANTIATE_TEST_CASE_P(PolicyDisplayRotationDefault, |
| 324 DisplayRotationBootTest, | 325 DisplayRotationBootTest, |
| 325 testing::Values(gfx::Display::ROTATE_0, | 326 testing::Values(gfx::Display::ROTATE_0, |
| 326 gfx::Display::ROTATE_90, | 327 gfx::Display::ROTATE_90, |
| 327 gfx::Display::ROTATE_180, | 328 gfx::Display::ROTATE_180, |
| 328 gfx::Display::ROTATE_270)); | 329 gfx::Display::ROTATE_270)); |
| 329 | 330 |
| 330 } // namespace policy | 331 } // namespace policy |
| OLD | NEW |