OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/views/message_popup_collection.h" | 5 #include "ui/message_center/views/message_popup_collection.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 collection_->toasts_.begin(); | 61 collection_->toasts_.begin(); |
62 iter != collection_->toasts_.end(); ++iter) { | 62 iter != collection_->toasts_.end(); ++iter) { |
63 if ((*iter)->id() == id) | 63 if ((*iter)->id() == id) |
64 return *iter; | 64 return *iter; |
65 } | 65 } |
66 return NULL; | 66 return NULL; |
67 } | 67 } |
68 | 68 |
69 std::string AddNotification() { | 69 std::string AddNotification() { |
70 std::string id = base::IntToString(id_++); | 70 std::string id = base::IntToString(id_++); |
71 MessageCenter::Get()->AddNotification(NOTIFICATION_TYPE_BASE_FORMAT, | 71 scoped_ptr<Notification> notification( |
72 id, | 72 new Notification(NOTIFICATION_TYPE_BASE_FORMAT, |
73 UTF8ToUTF16("test title"), | 73 id, |
74 UTF8ToUTF16("test message"), | 74 UTF8ToUTF16("test title"), |
75 string16() /* display_source */, | 75 UTF8ToUTF16("test message"), |
76 "" /* extension_id */, | 76 gfx::Image(), |
77 NULL /* optional_fields */, | 77 string16() /* display_source */, |
78 NULL /* delegate */); | 78 "" /* extension_id */, |
| 79 NULL /* optional_fields */, |
| 80 NULL /* delegate */)); |
| 81 MessageCenter::Get()->AddNotification(notification.Pass()); |
79 return id; | 82 return id; |
80 } | 83 } |
81 | 84 |
82 // Assumes there is non-zero pending work. | 85 // Assumes there is non-zero pending work. |
83 void WaitForTransitionsDone() { | 86 void WaitForTransitionsDone() { |
84 collection_->RunLoopForTest(); | 87 collection_->RunLoopForTest(); |
85 } | 88 } |
86 | 89 |
87 void CloseAllToastsAndWait() { | 90 void CloseAllToastsAndWait() { |
88 // Assumes there is at least one toast to close. | 91 // Assumes there is at least one toast to close. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 174 |
172 CloseAllToastsAndWait(); | 175 CloseAllToastsAndWait(); |
173 EXPECT_EQ(0u, GetToastCounts()); | 176 EXPECT_EQ(0u, GetToastCounts()); |
174 } | 177 } |
175 | 178 |
176 // TODO(dimich): Test repositioning - both normal one and when user is closing | 179 // TODO(dimich): Test repositioning - both normal one and when user is closing |
177 // the toasts. | 180 // the toasts. |
178 | 181 |
179 } // namespace test | 182 } // namespace test |
180 } // namespace message_center | 183 } // namespace message_center |
OLD | NEW |