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

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

Issue 2816253002: Display "Restart to update Adobe Flash Player" for Flash updates. (Closed)
Patch Set: Add test for Flash player update Created 3 years, 8 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
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/update/tray_update.h" 5 #include "ash/system/update/tray_update.h"
6 6
7 #include "ash/public/interfaces/update.mojom.h" 7 #include "ash/public/interfaces/update.mojom.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/system/tray/system_tray.h" 9 #include "ash/system/tray/system_tray.h"
10 #include "ash/system/tray/system_tray_controller.h" 10 #include "ash/system/tray/system_tray_controller.h"
11 #include "ash/test/ash_test.h" 11 #include "ash/test/ash_test.h"
12 #include "base/strings/utf_string_conversions.h"
13 #include "ui/events/event.h"
12 14
13 namespace ash { 15 namespace ash {
14 16
15 using TrayUpdateTest = AshTest; 17 using TrayUpdateTest = AshTest;
16 18
17 // Tests that the update icon becomes visible when an update becomes 19 // Tests that the update icon becomes visible when an update becomes
18 // available. 20 // available.
19 TEST_F(TrayUpdateTest, VisibilityAfterUpdate) { 21 TEST_F(TrayUpdateTest, VisibilityAfterUpdate) {
20 TrayUpdate* tray_update = GetPrimarySystemTray()->tray_update(); 22 SystemTray* tray = GetPrimarySystemTray();
23 TrayUpdate* tray_update = tray->tray_update();
21 24
22 // The system starts with no update pending, so the icon isn't visible. 25 // The system starts with no update pending, so the icon isn't visible.
23 EXPECT_FALSE(tray_update->tray_view()->visible()); 26 EXPECT_FALSE(tray_update->tray_view()->visible());
24 27
25 // Simulate an update. 28 // Simulate an update.
26 Shell::Get()->system_tray_controller()->ShowUpdateIcon( 29 Shell::Get()->system_tray_controller()->ShowUpdateIcon(
27 mojom::UpdateSeverity::LOW, false); 30 mojom::UpdateSeverity::LOW, false, mojom::UpdateType::SYSTEM);
28 31
29 // Tray item is now visible. 32 // Tray item is now visible.
30 EXPECT_TRUE(tray_update->tray_view()->visible()); 33 EXPECT_TRUE(tray_update->tray_view()->visible());
34
35 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
36 base::string16 label = tray_update->GetLabelForTesting();
37 EXPECT_EQ("Restart to update", base::UTF16ToUTF8(label));
38 }
39
40 TEST_F(TrayUpdateTest, VisibilityAfterFlashUpdate) {
41 SystemTray* tray = GetPrimarySystemTray();
42 TrayUpdate* tray_update = tray->tray_update();
43
44 // Simulate an update.
45 Shell::Get()->system_tray_controller()->ShowUpdateIcon(
46 mojom::UpdateSeverity::LOW, false, mojom::UpdateType::FLASH);
47
48 // Tray item is now visible.
49 EXPECT_TRUE(tray_update->tray_view()->visible());
50
51 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
52 base::string16 label = tray_update->GetLabelForTesting();
53 EXPECT_EQ("Restart to update Adobe Flash Player", base::UTF16ToUTF8(label));
31 } 54 }
32 55
33 } // namespace ash 56 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698