OLD | NEW |
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/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest); | 150 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest); |
151 }; | 151 }; |
152 | 152 |
153 TEST_F(WebNotificationTrayTest, WebNotifications) { | 153 TEST_F(WebNotificationTrayTest, WebNotifications) { |
154 // TODO(mukai): move this test case to ui/message_center. | 154 // TODO(mukai): move this test case to ui/message_center. |
155 ASSERT_TRUE(GetWidget()); | 155 ASSERT_TRUE(GetWidget()); |
156 | 156 |
157 // Add a notification. | 157 // Add a notification. |
158 AddNotification("test_id1"); | 158 AddNotification("test_id1"); |
159 EXPECT_EQ(1u, GetMessageCenter()->NotificationCount()); | 159 EXPECT_EQ(1u, GetMessageCenter()->NotificationCount()); |
160 EXPECT_TRUE(GetMessageCenter()->HasNotification("test_id1")); | 160 EXPECT_TRUE(GetMessageCenter()->FindVisibleNotificationById("test_id1")); |
161 AddNotification("test_id2"); | 161 AddNotification("test_id2"); |
162 AddNotification("test_id2"); | 162 AddNotification("test_id2"); |
163 EXPECT_EQ(2u, GetMessageCenter()->NotificationCount()); | 163 EXPECT_EQ(2u, GetMessageCenter()->NotificationCount()); |
164 EXPECT_TRUE(GetMessageCenter()->HasNotification("test_id2")); | 164 EXPECT_TRUE(GetMessageCenter()->FindVisibleNotificationById("test_id2")); |
165 | 165 |
166 // Ensure that updating a notification does not affect the count. | 166 // Ensure that updating a notification does not affect the count. |
167 UpdateNotification("test_id2", "test_id3"); | 167 UpdateNotification("test_id2", "test_id3"); |
168 UpdateNotification("test_id3", "test_id3"); | 168 UpdateNotification("test_id3", "test_id3"); |
169 EXPECT_EQ(2u, GetMessageCenter()->NotificationCount()); | 169 EXPECT_EQ(2u, GetMessageCenter()->NotificationCount()); |
170 EXPECT_FALSE(GetMessageCenter()->HasNotification("test_id2")); | 170 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id2")); |
171 | 171 |
172 // Ensure that Removing the first notification removes it from the tray. | 172 // Ensure that Removing the first notification removes it from the tray. |
173 RemoveNotification("test_id1"); | 173 RemoveNotification("test_id1"); |
174 EXPECT_FALSE(GetMessageCenter()->HasNotification("test_id1")); | 174 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id1")); |
175 EXPECT_EQ(1u, GetMessageCenter()->NotificationCount()); | 175 EXPECT_EQ(1u, GetMessageCenter()->NotificationCount()); |
176 | 176 |
177 // Remove the remianing notification. | 177 // Remove the remianing notification. |
178 RemoveNotification("test_id3"); | 178 RemoveNotification("test_id3"); |
179 EXPECT_EQ(0u, GetMessageCenter()->NotificationCount()); | 179 EXPECT_EQ(0u, GetMessageCenter()->NotificationCount()); |
180 EXPECT_FALSE(GetMessageCenter()->HasNotification("test_id3")); | 180 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id3")); |
181 } | 181 } |
182 | 182 |
183 TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) { | 183 TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) { |
184 // TODO(mukai): move this test case to ui/message_center. | 184 // TODO(mukai): move this test case to ui/message_center. |
185 ASSERT_TRUE(GetWidget()); | 185 ASSERT_TRUE(GetWidget()); |
186 | 186 |
187 // Adding a notification should show the popup bubble. | 187 // Adding a notification should show the popup bubble. |
188 AddNotification("test_id1"); | 188 AddNotification("test_id1"); |
189 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 189 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
190 | 190 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 469 |
470 // System tray is created on the primary display. The popups in the secondary | 470 // System tray is created on the primary display. The popups in the secondary |
471 // tray aren't affected. | 471 // tray aren't affected. |
472 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); | 472 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); |
473 EXPECT_GT(work_area.size().GetArea(), GetPopupWorkArea().size().GetArea()); | 473 EXPECT_GT(work_area.size().GetArea(), GetPopupWorkArea().size().GetArea()); |
474 EXPECT_EQ(work_area_second.ToString(), | 474 EXPECT_EQ(work_area_second.ToString(), |
475 GetPopupWorkAreaForTray(GetSecondaryTray()).ToString()); | 475 GetPopupWorkAreaForTray(GetSecondaryTray()).ToString()); |
476 } | 476 } |
477 | 477 |
478 } // namespace ash | 478 } // namespace ash |
OLD | NEW |