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 #include <utility> |
8 | 9 |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
14 #include "ui/events/event_constants.h" | 15 #include "ui/events/event_constants.h" |
15 #include "ui/events/event_utils.h" | 16 #include "ui/events/event_utils.h" |
16 #include "ui/gfx/display.h" | 17 #include "ui/gfx/display.h" |
17 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return NULL; | 93 return NULL; |
93 } | 94 } |
94 | 95 |
95 std::string AddNotification() { | 96 std::string AddNotification() { |
96 std::string id = base::IntToString(id_++); | 97 std::string id = base::IntToString(id_++); |
97 scoped_ptr<Notification> notification(new Notification( | 98 scoped_ptr<Notification> notification(new Notification( |
98 NOTIFICATION_TYPE_BASE_FORMAT, id, base::UTF8ToUTF16("test title"), | 99 NOTIFICATION_TYPE_BASE_FORMAT, id, base::UTF8ToUTF16("test title"), |
99 base::UTF8ToUTF16("test message"), gfx::Image(), | 100 base::UTF8ToUTF16("test message"), gfx::Image(), |
100 base::string16() /* display_source */, GURL(), NotifierId(), | 101 base::string16() /* display_source */, GURL(), NotifierId(), |
101 message_center::RichNotificationData(), new NotificationDelegate())); | 102 message_center::RichNotificationData(), new NotificationDelegate())); |
102 MessageCenter::Get()->AddNotification(notification.Pass()); | 103 MessageCenter::Get()->AddNotification(std::move(notification)); |
103 return id; | 104 return id; |
104 } | 105 } |
105 | 106 |
106 void PrepareForWait() { collection_->CreateRunLoopForTest(); } | 107 void PrepareForWait() { collection_->CreateRunLoopForTest(); } |
107 | 108 |
108 // Assumes there is non-zero pending work. | 109 // Assumes there is non-zero pending work. |
109 void WaitForTransitionsDone() { | 110 void WaitForTransitionsDone() { |
110 collection_->WaitForTest(); | 111 collection_->WaitForTest(); |
111 collection_->CreateRunLoopForTest(); | 112 collection_->CreateRunLoopForTest(); |
112 } | 113 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 } | 473 } |
473 EXPECT_FALSE(IsToastShown(ids[notifications_to_add - 1])); | 474 EXPECT_FALSE(IsToastShown(ids[notifications_to_add - 1])); |
474 | 475 |
475 CloseAllToasts(); | 476 CloseAllToasts(); |
476 WaitForTransitionsDone(); | 477 WaitForTransitionsDone(); |
477 } | 478 } |
478 | 479 |
479 | 480 |
480 } // namespace test | 481 } // namespace test |
481 } // namespace message_center | 482 } // namespace message_center |
OLD | NEW |