Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc

Issue 2931643002: chromeos: Introduce ash::SystemTrayTestApi (Closed)
Patch Set: review comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/test/BUILD.gn ('k') | chrome/browser/chromeos/shutdown_policy_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/login_status.h" 5 #include "ash/login_status.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "ash/system/date/date_view.h" 7 #include "ash/system/date/date_view.h"
8 #include "ash/system/date/system_info_default_view.h" 8 #include "ash/system/date/system_info_default_view.h"
9 #include "ash/system/date/tray_system_info.h" 9 #include "ash/system/date/tray_system_info.h"
10 #include "ash/system/tray/system_tray.h" 10 #include "ash/system/tray/system_tray.h"
11 #include "ash/system/tray/system_tray_test_api.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/location.h" 13 #include "base/location.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/run_loop.h" 15 #include "base/run_loop.h"
15 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/browser_process_platform_part.h" 19 #include "chrome/browser/browser_process_platform_part.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_cros_browser_test.h" 21 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 RefreshDevicePolicy(); 67 RefreshDevicePolicy();
67 run_loop.Run(); 68 run_loop.Run();
68 } 69 }
69 70
70 static bool SystemClockShouldUse24Hour() { 71 static bool SystemClockShouldUse24Hour() {
71 return g_browser_process->platform_part() 72 return g_browser_process->platform_part()
72 ->GetSystemClock() 73 ->GetSystemClock()
73 ->ShouldUse24HourClock(); 74 ->ShouldUse24HourClock();
74 } 75 }
75 76
77 static ash::TraySystemInfo* GetTraySystemInfo() {
78 return ash::SystemTrayTestApi(ash::Shell::Get()->GetPrimarySystemTray())
79 .tray_system_info();
80 }
81
76 static base::HourClockType TestGetPrimarySystemTrayTimeHourType() { 82 static base::HourClockType TestGetPrimarySystemTrayTimeHourType() {
77 const ash::TraySystemInfo* tray_system_info = 83 const ash::TraySystemInfo* tray_system_info = GetTraySystemInfo();
78 ash::Shell::Get()
79 ->GetPrimarySystemTray()
80 ->GetTraySystemInfoForTesting();
81 const ash::tray::TimeView* time_tray = 84 const ash::tray::TimeView* time_tray =
82 tray_system_info->GetTimeTrayForTesting(); 85 tray_system_info->GetTimeTrayForTesting();
83 86
84 return time_tray->GetHourTypeForTesting(); 87 return time_tray->GetHourTypeForTesting();
85 } 88 }
86 89
87 static bool TestPrimarySystemTrayHasDateDefaultView() { 90 static bool TestPrimarySystemTrayHasDateDefaultView() {
88 const ash::TraySystemInfo* tray_system_info = 91 const ash::TraySystemInfo* tray_system_info = GetTraySystemInfo();
89 ash::Shell::Get()
90 ->GetPrimarySystemTray()
91 ->GetTraySystemInfoForTesting();
92 const ash::SystemInfoDefaultView* system_info_default_view = 92 const ash::SystemInfoDefaultView* system_info_default_view =
93 tray_system_info->GetDefaultViewForTesting(); 93 tray_system_info->GetDefaultViewForTesting();
94 return system_info_default_view != nullptr; 94 return system_info_default_view != nullptr;
95 } 95 }
96 96
97 static void TestPrimarySystemTrayCreateDefaultView() { 97 static void TestPrimarySystemTrayCreateDefaultView() {
98 ash::TraySystemInfo* tray_system_info = ash::Shell::Get() 98 ash::TraySystemInfo* tray_system_info = GetTraySystemInfo();
99 ->GetPrimarySystemTray()
100 ->GetTraySystemInfoForTesting();
101 tray_system_info->CreateDefaultViewForTesting( 99 tray_system_info->CreateDefaultViewForTesting(
102 ash::LoginStatus::NOT_LOGGED_IN); 100 ash::LoginStatus::NOT_LOGGED_IN);
103 } 101 }
104 102
105 static base::HourClockType TestGetPrimarySystemTrayDateHourType() { 103 static base::HourClockType TestGetPrimarySystemTrayDateHourType() {
106 const ash::TraySystemInfo* tray_system_info = 104 const ash::TraySystemInfo* tray_system_info = GetTraySystemInfo();
107 ash::Shell::Get()
108 ->GetPrimarySystemTray()
109 ->GetTraySystemInfoForTesting();
110 const ash::SystemInfoDefaultView* system_info_default_view = 105 const ash::SystemInfoDefaultView* system_info_default_view =
111 tray_system_info->GetDefaultViewForTesting(); 106 tray_system_info->GetDefaultViewForTesting();
112 107
113 return system_info_default_view->GetDateView()->GetHourTypeForTesting(); 108 return system_info_default_view->GetDateView()->GetHourTypeForTesting();
114 } 109 }
115 110
116 private: 111 private:
117 DISALLOW_COPY_AND_ASSIGN(SystemUse24HourClockPolicyTest); 112 DISALLOW_COPY_AND_ASSIGN(SystemUse24HourClockPolicyTest);
118 }; 113 };
119 114
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kSystemUse24HourClock, 170 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kSystemUse24HourClock,
176 &system_use_24hour_clock)); 171 &system_use_24hour_clock));
177 EXPECT_FALSE(system_use_24hour_clock); 172 EXPECT_FALSE(system_use_24hour_clock);
178 EXPECT_FALSE(SystemClockShouldUse24Hour()); 173 EXPECT_FALSE(SystemClockShouldUse24Hour());
179 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayTimeHourType()); 174 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayTimeHourType());
180 EXPECT_TRUE(TestPrimarySystemTrayHasDateDefaultView()); 175 EXPECT_TRUE(TestPrimarySystemTrayHasDateDefaultView());
181 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayDateHourType()); 176 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayDateHourType());
182 } 177 }
183 178
184 } // namespace chromeos 179 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/test/BUILD.gn ('k') | chrome/browser/chromeos/shutdown_policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698