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 "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/system/date/date_default_view.h" | 10 #include "ash/common/system/date/date_default_view.h" |
11 #include "ash/common/system/date/date_view.h" | 11 #include "ash/common/system/date/date_view.h" |
12 #include "ash/common/system/date/system_info_default_view.h" | 12 #include "ash/common/system/date/system_info_default_view.h" |
13 #include "ash/common/system/date/tray_date.h" | 13 #include "ash/common/system/date/tray_date.h" |
14 #include "ash/common/system/date/tray_system_info.h" | 14 #include "ash/common/system/date/tray_system_info.h" |
15 #include "ash/common/system/tray/system_tray.h" | 15 #include "ash/common/system/tray/system_tray.h" |
| 16 #include "ash/common/system/update/tray_update.h" |
| 17 #include "ash/common/wm_shell.h" |
16 #include "ash/shell.h" | 18 #include "ash/shell.h" |
17 #include "base/macros.h" | 19 #include "base/macros.h" |
18 #include "chrome/browser/chromeos/login/login_manager_test.h" | 20 #include "chrome/browser/chromeos/login/login_manager_test.h" |
19 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 21 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
20 #include "chrome/browser/chromeos/login/startup_utils.h" | 22 #include "chrome/browser/chromeos/login/startup_utils.h" |
21 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 23 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
22 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 24 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
23 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
24 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
25 #include "chrome/test/base/in_process_browser_test.h" | 27 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 CreateDefaultView(); | 124 CreateDefaultView(); |
123 EXPECT_EQ(base::k12HourClock, GetHourType()); | 125 EXPECT_EQ(base::k12HourClock, GetHourType()); |
124 | 126 |
125 user_manager::UserManager::Get()->SwitchActiveUser(account_id1_); | 127 user_manager::UserManager::Get()->SwitchActiveUser(account_id1_); |
126 // Allow clock setting to be sent to ash over mojo. | 128 // Allow clock setting to be sent to ash over mojo. |
127 content::RunAllPendingInMessageLoop(); | 129 content::RunAllPendingInMessageLoop(); |
128 CreateDefaultView(); | 130 CreateDefaultView(); |
129 EXPECT_EQ(base::k24HourClock, GetHourType()); | 131 EXPECT_EQ(base::k24HourClock, GetHourType()); |
130 } | 132 } |
131 | 133 |
| 134 // Test that a flash update causes the update UI to show in the system menu. |
| 135 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest, |
| 136 TestFlashUpdateTrayIcon) { |
| 137 ash::TrayUpdate* tray_update = ash::Shell::GetInstance() |
| 138 ->GetPrimarySystemTray() |
| 139 ->GetTrayUpdateForTesting(); |
| 140 |
| 141 ash::UpdateInfo initial_info; |
| 142 ash::WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo( |
| 143 &initial_info); |
| 144 EXPECT_FALSE(initial_info.update_required); |
| 145 |
| 146 // When no update is pending, the item isn't visible. |
| 147 EXPECT_FALSE(tray_update->tray_view()->visible()); |
| 148 |
| 149 chromeos::SystemTrayDelegateChromeOS::instance()->SetFlashUpdateAvailable(); |
| 150 |
| 151 ash::UpdateInfo post_info; |
| 152 ash::WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&post_info); |
| 153 EXPECT_TRUE(post_info.update_required); |
| 154 |
| 155 // Tray item is now visible. |
| 156 EXPECT_TRUE(tray_update->tray_view()->visible()); |
| 157 } |
| 158 |
132 } // namespace chromeos | 159 } // namespace chromeos |
OLD | NEW |