| 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 MessageCenterViewTest::MessageCenterViewTest() { | 122 MessageCenterViewTest::MessageCenterViewTest() { |
| 123 } | 123 } |
| 124 | 124 |
| 125 MessageCenterViewTest::~MessageCenterViewTest() { | 125 MessageCenterViewTest::~MessageCenterViewTest() { |
| 126 } | 126 } |
| 127 | 127 |
| 128 void MessageCenterViewTest::SetUp() { | 128 void MessageCenterViewTest::SetUp() { |
| 129 // Create a dummy notification. | 129 // Create a dummy notification. |
| 130 Notification notification( | 130 Notification notification(NOTIFICATION_TYPE_SIMPLE, |
| 131 NOTIFICATION_TYPE_SIMPLE, | 131 std::string("notification id"), |
| 132 std::string("notification id"), | 132 UTF8ToUTF16("title"), |
| 133 UTF8ToUTF16("title"), | 133 UTF8ToUTF16("message"), |
| 134 UTF8ToUTF16("message"), | 134 UTF8ToUTF16("display source"), |
| 135 UTF8ToUTF16("display source"), | 135 std::string("extension id"), |
| 136 std::string("extension id"), | 136 NULL, |
| 137 NULL); | 137 NULL); |
| 138 | 138 |
| 139 // ...and a list for it. | 139 // ...and a list for it. |
| 140 NotificationList::Notifications notifications; | 140 NotificationList::Notifications notifications; |
| 141 notifications.insert(¬ification); | 141 notifications.insert(¬ification); |
| 142 | 142 |
| 143 // Then create a new MessageCenterView with that single notification. | 143 // Then create a new MessageCenterView with that single notification. |
| 144 message_center_view_.reset(new MessageCenterView(&message_center_, 100)); | 144 message_center_view_.reset(new MessageCenterView(&message_center_, 100)); |
| 145 message_center_view_->SetNotifications(notifications); | 145 message_center_view_->SetNotifications(notifications); |
| 146 | 146 |
| 147 // Remove and delete the NotificationView now owned by the MessageCenterView's | 147 // Remove and delete the NotificationView now owned by the MessageCenterView's |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very | 195 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very |
| 196 // large number corresponding to the current reality. That number will be | 196 // large number corresponding to the current reality. That number will be |
| 197 // ratcheted down over time as the code improves. | 197 // ratcheted down over time as the code improves. |
| 198 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); | 198 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); |
| 199 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + | 199 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + |
| 200 GetCallCount(GET_HEIGHT_FOR_WIDTH), | 200 GetCallCount(GET_HEIGHT_FOR_WIDTH), |
| 201 GetNotificationCount() * 20); | 201 GetNotificationCount() * 20); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace message_center | 204 } // namespace message_center |
| OLD | NEW |