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

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

Issue 12326091: Made notification center notifications collapsed and expandable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, which led to many changes. Created 7 years, 9 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 "ui/message_center/notification_list.h" 5 #include "ui/message_center/notification_list.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/message_center/notification_types.h" 13 #include "ui/message_center/notification_types.h"
14 14
15 namespace message_center { 15 namespace message_center {
16 namespace { 16 namespace {
17 17
18 class MockNotificationListDelegate : public NotificationList::Delegate { 18 class MockNotificationListDelegate : public NotificationList::Delegate {
19 public: 19 public:
20 MockNotificationListDelegate() : send_remove_count_(0) {} 20 MockNotificationListDelegate() : send_remove_count_(0) {}
21 virtual ~MockNotificationListDelegate() {} 21 virtual ~MockNotificationListDelegate() {}
22 22
23 size_t GetSendRemoveCountAndReset() { 23 size_t GetSendRemoveCountAndReset() {
24 size_t result = send_remove_count_; 24 size_t result = send_remove_count_;
25 send_remove_count_ = 0; 25 send_remove_count_ = 0;
26 return result; 26 return result;
27 } 27 }
28 28
29 private: 29 private:
30 // NotificationList::Delegate overrides: 30 // Overridden from NotificationList::Delegate:
31 virtual void SendRemoveNotification(const std::string& id, 31 virtual void SendRemoveNotification(const std::string& id,
32 bool by_user) OVERRIDE { 32 bool by_user) OVERRIDE {
33 send_remove_count_++; 33 send_remove_count_++;
34 } 34 }
35 35
36 virtual void SendRemoveAllNotifications(bool by_user) OVERRIDE { 36 virtual void SendRemoveAllNotifications(bool by_user) OVERRIDE {
37 } 37 }
38 38
39 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE { 39 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE {
40 } 40 }
(...skipping 11 matching lines...) Expand all
52 virtual void OnNotificationClicked(const std::string& id) OVERRIDE { 52 virtual void OnNotificationClicked(const std::string& id) OVERRIDE {
53 } 53 }
54 54
55 virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE { 55 virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE {
56 } 56 }
57 57
58 virtual void OnButtonClicked(const std::string& id, 58 virtual void OnButtonClicked(const std::string& id,
59 int button_index) OVERRIDE { 59 int button_index) OVERRIDE {
60 } 60 }
61 61
62 virtual NotificationList* GetNotificationList() OVERRIDE {
63 return NULL;
64 }
65
66 size_t send_remove_count_; 62 size_t send_remove_count_;
67 DISALLOW_COPY_AND_ASSIGN(MockNotificationListDelegate); 63 DISALLOW_COPY_AND_ASSIGN(MockNotificationListDelegate);
68 }; 64 };
69 65
70 class NotificationListTest : public testing::Test { 66 class NotificationListTest : public testing::Test {
71 public: 67 public:
72 NotificationListTest() {} 68 NotificationListTest() {}
73 virtual ~NotificationListTest() {} 69 virtual ~NotificationListTest() {}
74 70
75 virtual void SetUp() { 71 virtual void SetUp() {
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 422
427 notification_list()->SetQuietMode(false); 423 notification_list()->SetQuietMode(false);
428 AddNotification(NULL); 424 AddNotification(NULL);
429 EXPECT_EQ(4u, notification_list()->NotificationCount()); 425 EXPECT_EQ(4u, notification_list()->NotificationCount());
430 EXPECT_EQ(1u, GetPopupCounts()); 426 EXPECT_EQ(1u, GetPopupCounts());
431 427
432 // TODO(mukai): Add test of quiet mode with expiration. 428 // TODO(mukai): Add test of quiet mode with expiration.
433 } 429 }
434 430
435 } // namespace message_center 431 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698