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

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

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

Powered by Google App Engine
This is Rietveld 408576698