OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/login_status.h" | 5 #include "ash/common/login_status.h" |
6 #include "ash/common/system/date/date_default_view.h" | 6 #include "ash/common/system/date/date_default_view.h" |
7 #include "ash/common/system/date/date_view.h" | 7 #include "ash/common/system/date/date_view.h" |
8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
16 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 16 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
17 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 17 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
18 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 18 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
20 #include "chrome/browser/lifetime/application_lifetime.h" | 20 #include "chrome/browser/lifetime/application_lifetime.h" |
21 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" | 21 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
22 #include "chromeos/chromeos_switches.h" | 22 #include "chromeos/chromeos_switches.h" |
23 #include "content/public/test/test_utils.h" | 23 #include "content/public/test/test_utils.h" |
(...skipping 24 matching lines...) Expand all Loading... |
48 // If the login display is still showing, exit gracefully. | 48 // If the login display is still showing, exit gracefully. |
49 if (LoginDisplayHost::default_host()) { | 49 if (LoginDisplayHost::default_host()) { |
50 base::ThreadTaskRunnerHandle::Get()->PostTask( | 50 base::ThreadTaskRunnerHandle::Get()->PostTask( |
51 FROM_HERE, base::Bind(&chrome::AttemptExit)); | 51 FROM_HERE, base::Bind(&chrome::AttemptExit)); |
52 content::RunMessageLoop(); | 52 content::RunMessageLoop(); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 protected: | 56 protected: |
57 void RefreshPolicyAndWaitDeviceSettingsUpdated() { | 57 void RefreshPolicyAndWaitDeviceSettingsUpdated() { |
| 58 base::RunLoop run_loop; |
58 std::unique_ptr<CrosSettings::ObserverSubscription> observer = | 59 std::unique_ptr<CrosSettings::ObserverSubscription> observer = |
59 CrosSettings::Get()->AddSettingsObserver( | 60 CrosSettings::Get()->AddSettingsObserver( |
60 kSystemUse24HourClock, | 61 kSystemUse24HourClock, run_loop.QuitWhenIdleClosure()); |
61 base::MessageLoop::current()->QuitWhenIdleClosure()); | |
62 | 62 |
63 RefreshDevicePolicy(); | 63 RefreshDevicePolicy(); |
64 base::MessageLoop::current()->Run(); | 64 run_loop.Run(); |
65 } | 65 } |
66 | 66 |
67 static bool GetSystemTrayDelegateShouldUse24HourClock() { | 67 static bool GetSystemTrayDelegateShouldUse24HourClock() { |
68 chromeos::SystemTrayDelegateChromeOS* tray_delegate = | 68 chromeos::SystemTrayDelegateChromeOS* tray_delegate = |
69 static_cast<chromeos::SystemTrayDelegateChromeOS*>( | 69 static_cast<chromeos::SystemTrayDelegateChromeOS*>( |
70 ash::WmShell::Get()->system_tray_delegate()); | 70 ash::WmShell::Get()->system_tray_delegate()); |
71 return tray_delegate->GetShouldUse24HourClockForTesting(); | 71 return tray_delegate->GetShouldUse24HourClockForTesting(); |
72 } | 72 } |
73 | 73 |
74 static base::HourClockType TestGetPrimarySystemTrayTimeHourType() { | 74 static base::HourClockType TestGetPrimarySystemTrayTimeHourType() { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kSystemUse24HourClock, | 168 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kSystemUse24HourClock, |
169 &system_use_24hour_clock)); | 169 &system_use_24hour_clock)); |
170 EXPECT_FALSE(system_use_24hour_clock); | 170 EXPECT_FALSE(system_use_24hour_clock); |
171 EXPECT_FALSE(GetSystemTrayDelegateShouldUse24HourClock()); | 171 EXPECT_FALSE(GetSystemTrayDelegateShouldUse24HourClock()); |
172 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayTimeHourType()); | 172 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayTimeHourType()); |
173 EXPECT_TRUE(TestPrimarySystemTrayHasDateDefaultView()); | 173 EXPECT_TRUE(TestPrimarySystemTrayHasDateDefaultView()); |
174 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayDateHourType()); | 174 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayDateHourType()); |
175 } | 175 } |
176 | 176 |
177 } // namespace chromeos | 177 } // namespace chromeos |
OLD | NEW |