| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 collection_->toasts_.begin(); | 87 collection_->toasts_.begin(); |
| 88 iter != collection_->toasts_.end(); ++iter) { | 88 iter != collection_->toasts_.end(); ++iter) { |
| 89 if ((*iter)->id() == id) | 89 if ((*iter)->id() == id) |
| 90 return *iter; | 90 return *iter; |
| 91 } | 91 } |
| 92 return NULL; | 92 return NULL; |
| 93 } | 93 } |
| 94 | 94 |
| 95 std::string AddNotification() { | 95 std::string AddNotification() { |
| 96 std::string id = base::IntToString(id_++); | 96 std::string id = base::IntToString(id_++); |
| 97 scoped_ptr<Notification> notification( | 97 scoped_ptr<Notification> notification(new Notification( |
| 98 new Notification(NOTIFICATION_TYPE_BASE_FORMAT, | 98 NOTIFICATION_TYPE_BASE_FORMAT, id, base::UTF8ToUTF16("test title"), |
| 99 id, | 99 base::UTF8ToUTF16("test message"), gfx::Image(), |
| 100 base::UTF8ToUTF16("test title"), | 100 base::string16() /* display_source */, GURL(), NotifierId(), |
| 101 base::UTF8ToUTF16("test message"), | 101 message_center::RichNotificationData(), NULL /* delegate */)); |
| 102 gfx::Image(), | |
| 103 base::string16() /* display_source */, | |
| 104 NotifierId(), | |
| 105 message_center::RichNotificationData(), | |
| 106 NULL /* delegate */)); | |
| 107 MessageCenter::Get()->AddNotification(notification.Pass()); | 102 MessageCenter::Get()->AddNotification(notification.Pass()); |
| 108 return id; | 103 return id; |
| 109 } | 104 } |
| 110 | 105 |
| 111 void PrepareForWait() { collection_->CreateRunLoopForTest(); } | 106 void PrepareForWait() { collection_->CreateRunLoopForTest(); } |
| 112 | 107 |
| 113 // Assumes there is non-zero pending work. | 108 // Assumes there is non-zero pending work. |
| 114 void WaitForTransitionsDone() { | 109 void WaitForTransitionsDone() { |
| 115 collection_->WaitForTest(); | 110 collection_->WaitForTest(); |
| 116 collection_->CreateRunLoopForTest(); | 111 collection_->CreateRunLoopForTest(); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 views::WidgetDelegateView* toast2 = GetToast(id2); | 422 views::WidgetDelegateView* toast2 = GetToast(id2); |
| 428 EXPECT_TRUE(toast2 != NULL); | 423 EXPECT_TRUE(toast2 != NULL); |
| 429 | 424 |
| 430 CloseAllToasts(); | 425 CloseAllToasts(); |
| 431 WaitForTransitionsDone(); | 426 WaitForTransitionsDone(); |
| 432 } | 427 } |
| 433 | 428 |
| 434 | 429 |
| 435 } // namespace test | 430 } // namespace test |
| 436 } // namespace message_center | 431 } // namespace message_center |
| OLD | NEW |