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

Side by Side Diff: ash/system/web_notification/web_notification_tray_unittest.cc

Issue 10824153: Change Ash web notification behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix clang Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/system/status_area_widget.h" 9 #include "ash/system/status_area_widget.h"
10 #include "ash/system/tray/system_tray_item.h" 10 #include "ash/system/tray/system_tray_item.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 TEST_F(WebNotificationTrayTest, WebNotifications) { 76 TEST_F(WebNotificationTrayTest, WebNotifications) {
77 WebNotificationTray* tray = GetWebNotificationTray(); 77 WebNotificationTray* tray = GetWebNotificationTray();
78 scoped_ptr<TestDelegate> delegate(new TestDelegate); 78 scoped_ptr<TestDelegate> delegate(new TestDelegate);
79 tray->SetDelegate(delegate.get()); 79 tray->SetDelegate(delegate.get());
80 80
81 ASSERT_TRUE(tray->GetWidget()); 81 ASSERT_TRUE(tray->GetWidget());
82 82
83 // Adding a notification should show the bubble. 83 // Adding a notification should show the bubble.
84 delegate->AddNotification(tray, "test_id1"); 84 delegate->AddNotification(tray, "test_id1");
85 EXPECT_TRUE(tray->bubble() != NULL); 85 EXPECT_TRUE(tray->notification_bubble() != NULL);
86 EXPECT_EQ(1, tray->GetNotificationCount()); 86 EXPECT_EQ(1, tray->GetNotificationCount());
87 delegate->AddNotification(tray, "test_id2"); 87 delegate->AddNotification(tray, "test_id2");
88 delegate->AddNotification(tray, "test_id2"); 88 delegate->AddNotification(tray, "test_id2");
89 EXPECT_EQ(2, tray->GetNotificationCount()); 89 EXPECT_EQ(2, tray->GetNotificationCount());
90 // Ensure that removing a notification removes it from the tray, and signals 90 // Ensure that removing a notification removes it from the tray, and signals
91 // the delegate. 91 // the delegate.
92 EXPECT_TRUE(delegate->HasNotificationId("test_id2")); 92 EXPECT_TRUE(delegate->HasNotificationId("test_id2"));
93 delegate->RemoveNotification(tray, "test_id2"); 93 delegate->RemoveNotification(tray, "test_id2");
94 EXPECT_FALSE(delegate->HasNotificationId("test_id2")); 94 EXPECT_FALSE(delegate->HasNotificationId("test_id2"));
95 EXPECT_EQ(1, tray->GetNotificationCount()); 95 EXPECT_EQ(1, tray->GetNotificationCount());
96 96
97 // Removing the last notification should hide the bubble. 97 // Removing the last notification should hide the bubble.
98 delegate->RemoveNotification(tray, "test_id1"); 98 delegate->RemoveNotification(tray, "test_id1");
99 EXPECT_EQ(0, tray->GetNotificationCount()); 99 EXPECT_EQ(0, tray->GetNotificationCount());
100 EXPECT_TRUE(tray->bubble() == NULL); 100 EXPECT_TRUE(tray->notification_bubble() == NULL);
101 } 101 }
102 102
103 } // namespace ash 103 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/web_notification/web_notification_tray.cc ('k') | ui/resources/default_100_percent/ash/statusbar_notifications.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698