OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 base::UTF8ToUTF16("display source"), | 137 base::UTF8ToUTF16("display source"), |
138 NotifierId(NotifierId::APPLICATION, "extension_id"), | 138 NotifierId(NotifierId::APPLICATION, "extension_id"), |
139 message_center::RichNotificationData(), | 139 message_center::RichNotificationData(), |
140 NULL); | 140 NULL); |
141 | 141 |
142 // ...and a list for it. | 142 // ...and a list for it. |
143 NotificationList::Notifications notifications; | 143 NotificationList::Notifications notifications; |
144 notifications.insert(¬ification); | 144 notifications.insert(¬ification); |
145 | 145 |
146 // Then create a new MessageCenterView with that single notification. | 146 // Then create a new MessageCenterView with that single notification. |
| 147 base::string16 title; |
147 message_center_view_.reset(new MessageCenterView( | 148 message_center_view_.reset(new MessageCenterView( |
148 &message_center_, NULL, 100, false, /*top_down =*/false)); | 149 &message_center_, NULL, 100, false, /*top_down =*/false, title)); |
149 message_center_view_->SetNotifications(notifications); | 150 message_center_view_->SetNotifications(notifications); |
150 | 151 |
151 // Remove and delete the NotificationView now owned by the MessageCenterView's | 152 // Remove and delete the NotificationView now owned by the MessageCenterView's |
152 // MessageListView and replace it with an instrumented MockNotificationView | 153 // MessageListView and replace it with an instrumented MockNotificationView |
153 // that will become owned by the MessageListView. | 154 // that will become owned by the MessageListView. |
154 MockNotificationView* mock; | 155 MockNotificationView* mock; |
155 mock = new MockNotificationView(this, notification, this); | 156 mock = new MockNotificationView(this, notification, this); |
156 message_center_view_->notification_views_[notification.id()] = mock; | 157 message_center_view_->notification_views_[notification.id()] = mock; |
157 message_center_view_->SetNotificationViewForTest(mock); | 158 message_center_view_->SetNotificationViewForTest(mock); |
158 } | 159 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very | 233 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very |
233 // large number corresponding to the current reality. That number will be | 234 // large number corresponding to the current reality. That number will be |
234 // ratcheted down over time as the code improves. | 235 // ratcheted down over time as the code improves. |
235 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); | 236 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); |
236 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + | 237 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + |
237 GetCallCount(GET_HEIGHT_FOR_WIDTH), | 238 GetCallCount(GET_HEIGHT_FOR_WIDTH), |
238 GetNotificationCount() * 20); | 239 GetNotificationCount() * 20); |
239 } | 240 } |
240 | 241 |
241 } // namespace message_center | 242 } // namespace message_center |
OLD | NEW |