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

Side by Side Diff: ui/message_center/message_center_impl_unittest.cc

Issue 264123002: Google Now Message Center Stats (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename Created 6 years, 7 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
« no previous file with comments | « ui/message_center/message_center_impl.cc ('k') | ui/message_center/message_center_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/message_center/message_center_impl.h" 5 #include "ui/message_center/message_center_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 message_center()->AddNotification( 736 message_center()->AddNotification(
737 scoped_ptr<Notification>(CreateSimpleNotification("id3"))); 737 scoped_ptr<Notification>(CreateSimpleNotification("id3")));
738 ASSERT_EQ(3u, message_center()->UnreadNotificationCount()); 738 ASSERT_EQ(3u, message_center()->UnreadNotificationCount());
739 739
740 // Mark 'displayed' on all notifications by using for-loop. This shouldn't 740 // Mark 'displayed' on all notifications by using for-loop. This shouldn't
741 // recreate |notifications| inside of the loop. 741 // recreate |notifications| inside of the loop.
742 const NotificationList::Notifications& notifications = 742 const NotificationList::Notifications& notifications =
743 message_center()->GetVisibleNotifications(); 743 message_center()->GetVisibleNotifications();
744 for (NotificationList::Notifications::const_iterator iter = 744 for (NotificationList::Notifications::const_iterator iter =
745 notifications.begin(); iter != notifications.end(); ++iter) { 745 notifications.begin(); iter != notifications.end(); ++iter) {
746 message_center()->DisplayedNotification((*iter)->id()); 746 message_center()->DisplayedNotification(
747 (*iter)->id(), message_center::DISPLAY_SOURCE_MESSAGE_CENTER);
747 } 748 }
748 EXPECT_EQ(0u, message_center()->UnreadNotificationCount()); 749 EXPECT_EQ(0u, message_center()->UnreadNotificationCount());
749 750
750 // Imitate the timeout, which recovers the unread count. Again, this shouldn't 751 // Imitate the timeout, which recovers the unread count. Again, this shouldn't
751 // recreate |notifications| inside of the loop. 752 // recreate |notifications| inside of the loop.
752 for (NotificationList::Notifications::const_iterator iter = 753 for (NotificationList::Notifications::const_iterator iter =
753 notifications.begin(); iter != notifications.end(); ++iter) { 754 notifications.begin(); iter != notifications.end(); ++iter) {
754 message_center()->MarkSinglePopupAsShown((*iter)->id(), false); 755 message_center()->MarkSinglePopupAsShown((*iter)->id(), false);
755 } 756 }
756 EXPECT_EQ(3u, message_center()->UnreadNotificationCount()); 757 EXPECT_EQ(3u, message_center()->UnreadNotificationCount());
757 758
758 // Opening the message center will reset the unread count. 759 // Opening the message center will reset the unread count.
759 message_center()->SetVisibility(VISIBILITY_MESSAGE_CENTER); 760 message_center()->SetVisibility(VISIBILITY_MESSAGE_CENTER);
760 EXPECT_EQ(0u, message_center()->UnreadNotificationCount()); 761 EXPECT_EQ(0u, message_center()->UnreadNotificationCount());
761 } 762 }
762 763
763 } // namespace internal 764 } // namespace internal
764 } // namespace message_center 765 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/message_center_impl.cc ('k') | ui/message_center/message_center_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698