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

Unified Diff: ash/system/tray_update_unittest.cc

Issue 2060003002: ash: Add a unit test for the system update tray item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movetraydelegate
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/tray_update.h ('k') | ash/test/ash_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray_update_unittest.cc
diff --git a/ash/system/tray_update_unittest.cc b/ash/system/tray_update_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b32d817bf81fb9653fe2e9a79cc92a6b1ec17914
--- /dev/null
+++ b/ash/system/tray_update_unittest.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/system/tray_update.h"
+
+#include "ash/common/system/tray/system_tray_delegate.h"
+#include "ash/shell.h"
+#include "ash/system/tray/system_tray.h"
+#include "ash/system/tray/system_tray_notifier.h"
+#include "ash/test/ash_test_base.h"
+#include "ash/test/test_system_tray_delegate.h"
+#include "base/macros.h"
+
+namespace ash {
+
+using TrayUpdateTest = test::AshTestBase;
+
+// Tests that the update icon becomes visible when an update becomes
+// available.
+TEST_F(TrayUpdateTest, VisibilityAfterUpdate) {
+ TrayUpdate* tray_update =
+ Shell::GetInstance()->GetPrimarySystemTray()->GetTrayUpdateForTesting();
+
+ // The system starts with no update pending.
+ test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate();
+ UpdateInfo initial_info;
+ tray_delegate->GetSystemUpdateInfo(&initial_info);
+ EXPECT_FALSE(initial_info.update_required);
+
+ // When no update is pending, the item isn't visible.
+ EXPECT_FALSE(tray_update->tray_view()->visible());
+
+ // Simulate an update.
+ UpdateInfo info;
+ info.update_required = true;
+ Shell::GetInstance()->system_tray_notifier()->NotifyUpdateRecommended(info);
+
+ // Tray item is now visible.
+ EXPECT_TRUE(tray_update->tray_view()->visible());
+}
+
+} // namespace ash
« no previous file with comments | « ash/system/tray_update.h ('k') | ash/test/ash_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698