| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/system/tray_update.h" | 5 #include "ash/system/tray_update.h" |
| 6 | 6 |
| 7 #include "ash/common/system/tray/system_tray_delegate.h" | 7 #include "ash/common/system/tray/wm_system_tray_notifier.h" |
| 8 #include "ash/common/wm_shell.h" |
| 8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 9 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| 10 #include "ash/system/tray/system_tray_notifier.h" | |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/test/test_system_tray_delegate.h" | 12 #include "ash/test/test_system_tray_delegate.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 | 16 |
| 17 using TrayUpdateTest = test::AshTestBase; | 17 using TrayUpdateTest = test::AshTestBase; |
| 18 | 18 |
| 19 // Tests that the update icon becomes visible when an update becomes | 19 // Tests that the update icon becomes visible when an update becomes |
| 20 // available. | 20 // available. |
| 21 TEST_F(TrayUpdateTest, VisibilityAfterUpdate) { | 21 TEST_F(TrayUpdateTest, VisibilityAfterUpdate) { |
| 22 TrayUpdate* tray_update = | 22 TrayUpdate* tray_update = |
| 23 Shell::GetInstance()->GetPrimarySystemTray()->GetTrayUpdateForTesting(); | 23 Shell::GetInstance()->GetPrimarySystemTray()->GetTrayUpdateForTesting(); |
| 24 | 24 |
| 25 // The system starts with no update pending. | 25 // The system starts with no update pending. |
| 26 test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); | 26 test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); |
| 27 UpdateInfo initial_info; | 27 UpdateInfo initial_info; |
| 28 tray_delegate->GetSystemUpdateInfo(&initial_info); | 28 tray_delegate->GetSystemUpdateInfo(&initial_info); |
| 29 EXPECT_FALSE(initial_info.update_required); | 29 EXPECT_FALSE(initial_info.update_required); |
| 30 | 30 |
| 31 // When no update is pending, the item isn't visible. | 31 // When no update is pending, the item isn't visible. |
| 32 EXPECT_FALSE(tray_update->tray_view()->visible()); | 32 EXPECT_FALSE(tray_update->tray_view()->visible()); |
| 33 | 33 |
| 34 // Simulate an update. | 34 // Simulate an update. |
| 35 UpdateInfo info; | 35 UpdateInfo info; |
| 36 info.update_required = true; | 36 info.update_required = true; |
| 37 Shell::GetInstance()->system_tray_notifier()->NotifyUpdateRecommended(info); | 37 WmShell::Get()->system_tray_notifier()->NotifyUpdateRecommended(info); |
| 38 | 38 |
| 39 // Tray item is now visible. | 39 // Tray item is now visible. |
| 40 EXPECT_TRUE(tray_update->tray_view()->visible()); | 40 EXPECT_TRUE(tray_update->tray_view()->visible()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace ash | 43 } // namespace ash |
| OLD | NEW |