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/shell.h" | 5 #include "ash/shell.h" |
6 #include "ash/system/date/date_default_view.h" | 6 #include "ash/system/date/date_default_view.h" |
7 #include "ash/system/date/date_view.h" | 7 #include "ash/system/date/date_view.h" |
8 #include "ash/system/user/login_status.h" | 8 #include "ash/system/user/login_status.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 static bool GetSystemTrayDelegateShouldUse24HourClock() { | 50 static bool GetSystemTrayDelegateShouldUse24HourClock() { |
51 chromeos::SystemTrayDelegateChromeOS* tray_delegate = | 51 chromeos::SystemTrayDelegateChromeOS* tray_delegate = |
52 static_cast<chromeos::SystemTrayDelegateChromeOS*>( | 52 static_cast<chromeos::SystemTrayDelegateChromeOS*>( |
53 ash::Shell::GetInstance()->system_tray_delegate()); | 53 ash::Shell::GetInstance()->system_tray_delegate()); |
54 return tray_delegate->GetShouldUse24HourClockForTesting(); | 54 return tray_delegate->GetShouldUse24HourClockForTesting(); |
55 } | 55 } |
56 | 56 |
57 static base::HourClockType TestGetPrimarySystemTrayTimeHourType() { | 57 static base::HourClockType TestGetPrimarySystemTrayTimeHourType() { |
58 const ash::internal::TrayDate* tray_date = ash::Shell::GetInstance()-> | 58 const ash::TrayDate* tray_date = ash::Shell::GetInstance() |
59 GetPrimarySystemTray()-> | 59 ->GetPrimarySystemTray() |
60 GetTrayDateForTesting(); | 60 ->GetTrayDateForTesting(); |
61 const ash::internal::tray::TimeView* time_tray = | 61 const ash::tray::TimeView* time_tray = tray_date->GetTimeTrayForTesting(); |
62 tray_date->GetTimeTrayForTesting(); | |
63 | 62 |
64 return time_tray->GetHourTypeForTesting(); | 63 return time_tray->GetHourTypeForTesting(); |
65 } | 64 } |
66 | 65 |
67 static bool TestPrimarySystemTrayHasDateDefaultView() { | 66 static bool TestPrimarySystemTrayHasDateDefaultView() { |
68 const ash::internal::TrayDate* tray_date = ash::Shell::GetInstance()-> | 67 const ash::TrayDate* tray_date = ash::Shell::GetInstance() |
69 GetPrimarySystemTray()-> | 68 ->GetPrimarySystemTray() |
70 GetTrayDateForTesting(); | 69 ->GetTrayDateForTesting(); |
71 const ash::internal::DateDefaultView* date_default_view = | 70 const ash::DateDefaultView* date_default_view = |
72 tray_date->GetDefaultViewForTesting(); | 71 tray_date->GetDefaultViewForTesting(); |
73 return (date_default_view != NULL); | 72 return (date_default_view != NULL); |
74 } | 73 } |
75 | 74 |
76 static void TestPrimarySystemTrayCreateDefaultView() { | 75 static void TestPrimarySystemTrayCreateDefaultView() { |
77 ash::internal::TrayDate* tray_date = ash::Shell::GetInstance()-> | 76 ash::TrayDate* tray_date = ash::Shell::GetInstance() |
78 GetPrimarySystemTray()-> | 77 ->GetPrimarySystemTray() |
79 GetTrayDateForTesting(); | 78 ->GetTrayDateForTesting(); |
80 tray_date->CreateDefaultViewForTesting(ash::user::LOGGED_IN_NONE); | 79 tray_date->CreateDefaultViewForTesting(ash::user::LOGGED_IN_NONE); |
81 } | 80 } |
82 | 81 |
83 static base::HourClockType TestGetPrimarySystemTrayDateHourType() { | 82 static base::HourClockType TestGetPrimarySystemTrayDateHourType() { |
84 const ash::internal::TrayDate* tray_date = ash::Shell::GetInstance()-> | 83 const ash::TrayDate* tray_date = ash::Shell::GetInstance() |
85 GetPrimarySystemTray()-> | 84 ->GetPrimarySystemTray() |
86 GetTrayDateForTesting(); | 85 ->GetTrayDateForTesting(); |
87 const ash::internal::DateDefaultView* date_default_view = | 86 const ash::DateDefaultView* date_default_view = |
88 tray_date->GetDefaultViewForTesting(); | 87 tray_date->GetDefaultViewForTesting(); |
89 | 88 |
90 return date_default_view->GetDateView()->GetHourTypeForTesting(); | 89 return date_default_view->GetDateView()->GetHourTypeForTesting(); |
91 } | 90 } |
92 | 91 |
93 private: | 92 private: |
94 DISALLOW_COPY_AND_ASSIGN(SystemUse24HourClockPolicyTest); | 93 DISALLOW_COPY_AND_ASSIGN(SystemUse24HourClockPolicyTest); |
95 }; | 94 }; |
96 | 95 |
97 IN_PROC_BROWSER_TEST_F(SystemUse24HourClockPolicyTest, CheckUnset) { | 96 IN_PROC_BROWSER_TEST_F(SystemUse24HourClockPolicyTest, CheckUnset) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kSystemUse24HourClock, | 151 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kSystemUse24HourClock, |
153 &system_use_24hour_clock)); | 152 &system_use_24hour_clock)); |
154 EXPECT_FALSE(system_use_24hour_clock); | 153 EXPECT_FALSE(system_use_24hour_clock); |
155 EXPECT_FALSE(GetSystemTrayDelegateShouldUse24HourClock()); | 154 EXPECT_FALSE(GetSystemTrayDelegateShouldUse24HourClock()); |
156 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayTimeHourType()); | 155 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayTimeHourType()); |
157 EXPECT_TRUE(TestPrimarySystemTrayHasDateDefaultView()); | 156 EXPECT_TRUE(TestPrimarySystemTrayHasDateDefaultView()); |
158 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayDateHourType()); | 157 EXPECT_EQ(base::k12HourClock, TestGetPrimarySystemTrayDateHourType()); |
159 } | 158 } |
160 | 159 |
161 } // namespace chromeos | 160 } // namespace chromeos |
OLD | NEW |