| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 MessageCenterViewTest::MessageCenterViewTest() { | 124 MessageCenterViewTest::MessageCenterViewTest() { |
| 125 } | 125 } |
| 126 | 126 |
| 127 MessageCenterViewTest::~MessageCenterViewTest() { | 127 MessageCenterViewTest::~MessageCenterViewTest() { |
| 128 } | 128 } |
| 129 | 129 |
| 130 void MessageCenterViewTest::SetUp() { | 130 void MessageCenterViewTest::SetUp() { |
| 131 // Create a dummy notification. | 131 // Create a dummy notification. |
| 132 Notification notification(NOTIFICATION_TYPE_SIMPLE, | 132 Notification notification( |
| 133 std::string("notification id"), | 133 NOTIFICATION_TYPE_SIMPLE, std::string("notification id"), |
| 134 base::UTF8ToUTF16("title"), | 134 base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), gfx::Image(), |
| 135 base::UTF8ToUTF16("message"), | 135 base::UTF8ToUTF16("display source"), GURL(), |
| 136 gfx::Image(), | 136 NotifierId(NotifierId::APPLICATION, "extension_id"), |
| 137 base::UTF8ToUTF16("display source"), | 137 message_center::RichNotificationData(), NULL); |
| 138 NotifierId(NotifierId::APPLICATION, "extension_id"), | |
| 139 message_center::RichNotificationData(), | |
| 140 NULL); | |
| 141 | 138 |
| 142 // ...and a list for it. | 139 // ...and a list for it. |
| 143 NotificationList::Notifications notifications; | 140 NotificationList::Notifications notifications; |
| 144 notifications.insert(¬ification); | 141 notifications.insert(¬ification); |
| 145 | 142 |
| 146 // Then create a new MessageCenterView with that single notification. | 143 // Then create a new MessageCenterView with that single notification. |
| 147 base::string16 title; | 144 base::string16 title; |
| 148 message_center_view_.reset(new MessageCenterView( | 145 message_center_view_.reset(new MessageCenterView( |
| 149 &message_center_, NULL, 100, false, /*top_down =*/false, title)); | 146 &message_center_, NULL, 100, false, /*top_down =*/false, title)); |
| 150 message_center_view_->SetNotifications(notifications); | 147 message_center_view_->SetNotifications(notifications); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very | 230 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very |
| 234 // large number corresponding to the current reality. That number will be | 231 // large number corresponding to the current reality. That number will be |
| 235 // ratcheted down over time as the code improves. | 232 // ratcheted down over time as the code improves. |
| 236 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); | 233 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); |
| 237 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + | 234 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + |
| 238 GetCallCount(GET_HEIGHT_FOR_WIDTH), | 235 GetCallCount(GET_HEIGHT_FOR_WIDTH), |
| 239 GetNotificationCount() * 20); | 236 GetNotificationCount() * 20); |
| 240 } | 237 } |
| 241 | 238 |
| 242 } // namespace message_center | 239 } // namespace message_center |
| OLD | NEW |