| 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 "chrome/browser/chromeos/policy/display_rotation_default_handler.h" | 5 #include "chrome/browser/chromeos/policy/display_rotation_default_handler.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/message_loop/message_loop.h" | |
| 18 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/single_thread_task_runner.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 20 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 20 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 21 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 21 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 22 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 22 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 23 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 24 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 24 #include "chrome/browser/lifetime/application_lifetime.h" | 25 #include "chrome/browser/lifetime/application_lifetime.h" |
| 25 #include "chrome/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
| 26 #include "chromeos/chromeos_switches.h" | 27 #include "chromeos/chromeos_switches.h" |
| 27 #include "chromeos/dbus/cryptohome_client.h" | 28 #include "chromeos/dbus/cryptohome_client.h" |
| 28 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 84 |
| 84 void SetUpInProcessBrowserTestFixture() override { | 85 void SetUpInProcessBrowserTestFixture() override { |
| 85 InstallOwnerKey(); | 86 InstallOwnerKey(); |
| 86 MarkAsEnterpriseOwned(); | 87 MarkAsEnterpriseOwned(); |
| 87 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); | 88 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 void TearDownOnMainThread() override { | 91 void TearDownOnMainThread() override { |
| 91 // If the login display is still showing, exit gracefully. | 92 // If the login display is still showing, exit gracefully. |
| 92 if (chromeos::LoginDisplayHost::default_host()) { | 93 if (chromeos::LoginDisplayHost::default_host()) { |
| 93 base::MessageLoop::current()->PostTask(FROM_HERE, | 94 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 94 base::Bind(&chrome::AttemptExit)); | 95 FROM_HERE, base::Bind(&chrome::AttemptExit)); |
| 95 content::RunMessageLoop(); | 96 content::RunMessageLoop(); |
| 96 } | 97 } |
| 97 } | 98 } |
| 98 | 99 |
| 99 protected: | 100 protected: |
| 100 void SetPolicy(int rotation) { | 101 void SetPolicy(int rotation) { |
| 101 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); | 102 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); |
| 102 proto.mutable_display_rotation_default()->set_display_rotation_default( | 103 proto.mutable_display_rotation_default()->set_display_rotation_default( |
| 103 static_cast<em::DisplayRotationDefaultProto::Rotation>(rotation)); | 104 static_cast<em::DisplayRotationDefaultProto::Rotation>(rotation)); |
| 104 RefreshPolicyAndWaitUntilDeviceSettingsUpdated(); | 105 RefreshPolicyAndWaitUntilDeviceSettingsUpdated(); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 325 } |
| 325 | 326 |
| 326 INSTANTIATE_TEST_CASE_P(PolicyDisplayRotationDefault, | 327 INSTANTIATE_TEST_CASE_P(PolicyDisplayRotationDefault, |
| 327 DisplayRotationBootTest, | 328 DisplayRotationBootTest, |
| 328 testing::Values(display::Display::ROTATE_0, | 329 testing::Values(display::Display::ROTATE_0, |
| 329 display::Display::ROTATE_90, | 330 display::Display::ROTATE_90, |
| 330 display::Display::ROTATE_180, | 331 display::Display::ROTATE_180, |
| 331 display::Display::ROTATE_270)); | 332 display::Display::ROTATE_270)); |
| 332 | 333 |
| 333 } // namespace policy | 334 } // namespace policy |
| OLD | NEW |