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

Unified Diff: ash/common/system/tray/system_tray_unittest.cc

Issue 2557593009: Fix Chrome crashes on calling OnTrayVisibilityChange (Closed)
Patch Set: address comments Created 4 years 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/common/system/tray/system_tray_unittest.cc
diff --git a/ash/common/system/tray/system_tray_unittest.cc b/ash/common/system/tray/system_tray_unittest.cc
index 6a9c270fc2058a587173a9288d6ebcbb172f8e0a..abdd347651cce32ff0aead7bcda7f804493bf01c 100644
--- a/ash/common/system/tray/system_tray_unittest.cc
+++ b/ash/common/system/tray/system_tray_unittest.cc
@@ -60,7 +60,18 @@ class ModalWidgetDelegate : public views::WidgetDelegateView {
} // namespace
-typedef AshTestBase SystemTrayTest;
+class SystemTrayTest : public AshTestBase {
+ public:
+ SystemTrayTest() {}
+ ~SystemTrayTest() override {}
+
+ void ShutDownLogoutButtonTray(StatusAreaWidget* widget) {
varkha 2016/12/13 17:34:54 nit: I think we usually prefer Shutdown over ShutD
+ widget->logout_button_tray_ = nullptr;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SystemTrayTest);
+};
// Verifies only the visible default views are recorded in the
// "Ash.SystemMenu.DefaultView.VisibleItems" histogram.
@@ -664,6 +675,15 @@ TEST_F(SystemTrayTest, SystemTrayHeightWithBubble) {
EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test());
}
+
+// Calling OnVisibilityChange on StatusAreaWidget that has been Shutdown, see
+// crbug.com/671293. Test if crash is mitigated.
+TEST_F(SystemTrayTest, SystemTrayInitialization) {
+ StatusAreaWidget* widget = StatusAreaWidgetTestHelper::GetStatusAreaWidget();
+ ShutDownLogoutButtonTray(widget);
varkha 2016/12/13 17:34:54 I am still confused if the bad scenario is a resul
+ WebNotificationTray* notification_tray = widget->web_notification_tray();
+ widget->OnTrayVisibilityChanged(notification_tray);
+}
#endif // OS_CHROMEOS
} // namespace test
« ash/common/system/status_area_widget.cc ('K') | « ash/common/system/status_area_widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698