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

Side by Side Diff: ash/common/system/update/tray_update_unittest.cc

Issue 2059383002: mash: Move TrayUpdate to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ashconstants
Patch Set: rebase Created 4 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/common/system/update/tray_update.cc ('k') | ash/system/tray/system_tray.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 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/common/system/update/tray_update.h"
6 6
7 #include "ash/common/system/tray/wm_system_tray_notifier.h" 7 #include "ash/common/system/tray/wm_system_tray_notifier.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "ash/shell.h"
10 #include "ash/system/tray/system_tray.h" 9 #include "ash/system/tray/system_tray.h"
11 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
12 #include "ash/test/test_system_tray_delegate.h" 11 #include "ash/test/test_system_tray_delegate.h"
13 #include "base/macros.h" 12 #include "base/macros.h"
14 13
15 namespace ash { 14 namespace ash {
16 15
17 using TrayUpdateTest = test::AshTestBase; 16 using TrayUpdateTest = test::AshTestBase;
18 17
19 // Tests that the update icon becomes visible when an update becomes 18 // Tests that the update icon becomes visible when an update becomes
20 // available. 19 // available.
21 TEST_F(TrayUpdateTest, VisibilityAfterUpdate) { 20 TEST_F(TrayUpdateTest, VisibilityAfterUpdate) {
22 TrayUpdate* tray_update = 21 TrayUpdate* tray_update = GetPrimarySystemTray()->GetTrayUpdateForTesting();
23 Shell::GetInstance()->GetPrimarySystemTray()->GetTrayUpdateForTesting();
24 22
25 // The system starts with no update pending. 23 // The system starts with no update pending.
26 test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); 24 test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate();
27 UpdateInfo initial_info; 25 UpdateInfo initial_info;
28 tray_delegate->GetSystemUpdateInfo(&initial_info); 26 tray_delegate->GetSystemUpdateInfo(&initial_info);
29 EXPECT_FALSE(initial_info.update_required); 27 EXPECT_FALSE(initial_info.update_required);
30 28
31 // When no update is pending, the item isn't visible. 29 // When no update is pending, the item isn't visible.
32 EXPECT_FALSE(tray_update->tray_view()->visible()); 30 EXPECT_FALSE(tray_update->tray_view()->visible());
33 31
34 // Simulate an update. 32 // Simulate an update.
35 UpdateInfo info; 33 UpdateInfo info;
36 info.update_required = true; 34 info.update_required = true;
37 WmShell::Get()->system_tray_notifier()->NotifyUpdateRecommended(info); 35 WmShell::Get()->system_tray_notifier()->NotifyUpdateRecommended(info);
38 36
39 // Tray item is now visible. 37 // Tray item is now visible.
40 EXPECT_TRUE(tray_update->tray_view()->visible()); 38 EXPECT_TRUE(tray_update->tray_view()->visible());
41 } 39 }
42 40
43 } // namespace ash 41 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/update/tray_update.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698