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 "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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 protected: | 54 protected: |
55 // Currently NotificationListTest doesn't care about some fields like title or | 55 // Currently NotificationListTest doesn't care about some fields like title or |
56 // message, so put a simple template on it. Returns the id of the new | 56 // message, so put a simple template on it. Returns the id of the new |
57 // notification. | 57 // notification. |
58 std::string AddNotification(const base::DictionaryValue* optional_fields) { | 58 std::string AddNotification(const base::DictionaryValue* optional_fields) { |
59 std::string new_id = base::StringPrintf(kIdFormat, counter_); | 59 std::string new_id = base::StringPrintf(kIdFormat, counter_); |
60 notification_list_->AddNotification( | 60 notification_list_->AddNotification( |
61 message_center::NOTIFICATION_TYPE_SIMPLE, new_id, | 61 message_center::NOTIFICATION_TYPE_SIMPLE, new_id, |
62 UTF8ToUTF16(StringPrintf(kTitleFormat, counter_)), | 62 UTF8ToUTF16(base::StringPrintf(kTitleFormat, counter_)), |
63 UTF8ToUTF16(StringPrintf(kMessageFormat, counter_)), | 63 UTF8ToUTF16(base::StringPrintf(kMessageFormat, counter_)), |
64 UTF8ToUTF16(kDisplaySource), kExtensionId, | 64 UTF8ToUTF16(kDisplaySource), kExtensionId, |
65 optional_fields); | 65 optional_fields); |
66 counter_++; | 66 counter_++; |
67 return new_id; | 67 return new_id; |
68 } | 68 } |
69 | 69 |
70 // Utility methods of AddNotification. | 70 // Utility methods of AddNotification. |
71 std::string AddPriorityNotification(int priority) { | 71 std::string AddPriorityNotification(int priority) { |
72 base::DictionaryValue optional; | 72 base::DictionaryValue optional; |
73 optional.SetInteger(message_center::kPriorityKey, priority); | 73 optional.SetInteger(message_center::kPriorityKey, priority); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 notification_list()->SetQuietMode(false); | 400 notification_list()->SetQuietMode(false); |
401 AddNotification(NULL); | 401 AddNotification(NULL); |
402 EXPECT_EQ(4u, notification_list()->NotificationCount()); | 402 EXPECT_EQ(4u, notification_list()->NotificationCount()); |
403 EXPECT_EQ(1u, GetPopupCounts()); | 403 EXPECT_EQ(1u, GetPopupCounts()); |
404 | 404 |
405 // TODO(mukai): Add test of quiet mode with expiration. | 405 // TODO(mukai): Add test of quiet mode with expiration. |
406 } | 406 } |
407 | 407 |
408 } // namespace message_center | 408 } // namespace message_center |
OLD | NEW |