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

Unified Diff: ash/test/test_system_tray_item.h

Issue 2162153002: Added Ash.SystemMenu.DefaultView.VisibleItems histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits from patch set 6. Created 4 years, 5 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
Index: ash/test/test_system_tray_item.h
diff --git a/ash/test/test_system_tray_item.h b/ash/test/test_system_tray_item.h
new file mode 100644
index 0000000000000000000000000000000000000000..888e249f4da58b04761724beb814017ce876db72
--- /dev/null
+++ b/ash/test/test_system_tray_item.h
@@ -0,0 +1,56 @@
+// 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.
+
+#ifndef ASH_COMMON_SYSTEM_TRAY_TEST_TEST_SYSTEM_TRAY_ITEM_H_
+#define ASH_COMMON_SYSTEM_TRAY_TEST_TEST_SYSTEM_TRAY_ITEM_H_
+
+#include "ash/common/system/tray/system_tray_item.h"
+
+namespace ash {
+namespace test {
+
+// Trivial item implementation that tracks its views for testing. By default
+// views are created and returned by the Create*View() methods and they are
+// configured to be visible. Use set_has_views() and set_views_are_visible() to
+// change this behavior.
+class TestSystemTrayItem : public SystemTrayItem {
+ public:
+ TestSystemTrayItem();
+ explicit TestSystemTrayItem(SystemTrayItem::UmaType uma_type);
+ ~TestSystemTrayItem() override;
+
+ void set_has_views(bool has_views) { has_views_ = has_views; }
+ void set_views_are_visible(bool visible) { views_are_visible_ = visible; }
+
+ views::View* tray_view() const { return tray_view_; }
+ views::View* default_view() const { return default_view_; }
+ views::View* detailed_view() const { return detailed_view_; }
+ views::View* notification_view() const { return notification_view_; }
+
+ // SystemTrayItem:
+ views::View* CreateTrayView(LoginStatus status) override;
+ views::View* CreateDefaultView(LoginStatus status) override;
+ views::View* CreateDetailedView(LoginStatus status) override;
+ views::View* CreateNotificationView(LoginStatus status) override;
+ void DestroyTrayView() override;
+ void DestroyDefaultView() override;
+ void DestroyDetailedView() override;
+ void DestroyNotificationView() override;
+ void UpdateAfterLoginStatusChange(LoginStatus status) override;
+
+ private:
+ bool has_views_;
+ bool views_are_visible_;
+ views::View* tray_view_;
+ views::View* default_view_;
+ views::View* detailed_view_;
+ views::View* notification_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestSystemTrayItem);
+};
+
+} // namespace test
+} // namespace ash
+
+#endif // ASH_COMMON_SYSTEM_TRAY_TEST_TEST_SYSTEM_TRAY_ITEM_H_

Powered by Google App Engine
This is Rietveld 408576698