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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 virtual void TearDown() OVERRIDE; | 91 virtual void TearDown() OVERRIDE; |
92 | 92 |
93 MessageCenterView* GetMessageCenterView(); | 93 MessageCenterView* GetMessageCenterView(); |
94 int GetNotificationCount(); | 94 int GetNotificationCount(); |
95 int GetCallCount(CallType type); | 95 int GetCallCount(CallType type); |
96 | 96 |
97 // Overridden from MessageCenterController: | 97 // Overridden from MessageCenterController: |
98 virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; | 98 virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; |
99 virtual void RemoveNotification(const std::string& notification_id, | 99 virtual void RemoveNotification(const std::string& notification_id, |
100 bool by_user) OVERRIDE; | 100 bool by_user) OVERRIDE; |
101 virtual void DisableNotificationsFromThisSource( | 101 virtual scoped_ptr<ui::MenuModel> CreateMenuModel( |
102 const NotifierId& notifier_id) OVERRIDE; | 102 const NotifierId& notifier_id, |
103 virtual void ShowNotifierSettingsBubble() OVERRIDE; | 103 const base::string16& display_source) OVERRIDE; |
104 virtual bool HasClickedListener(const std::string& notification_id) OVERRIDE; | 104 virtual bool HasClickedListener(const std::string& notification_id) OVERRIDE; |
105 virtual void ClickOnNotificationButton(const std::string& notification_id, | 105 virtual void ClickOnNotificationButton(const std::string& notification_id, |
106 int button_index) OVERRIDE; | 106 int button_index) OVERRIDE; |
107 virtual void ExpandNotification(const std::string& notification_id) OVERRIDE; | 107 virtual void ExpandNotification(const std::string& notification_id) OVERRIDE; |
108 virtual void GroupBodyClicked(const std::string& last_notification_id) | 108 virtual void GroupBodyClicked(const std::string& last_notification_id) |
109 OVERRIDE; | 109 OVERRIDE; |
110 virtual void ExpandGroup(const NotifierId& notifier_id) OVERRIDE; | 110 virtual void ExpandGroup(const NotifierId& notifier_id) OVERRIDE; |
111 virtual void RemoveGroup(const NotifierId& notifier_id) OVERRIDE; | 111 virtual void RemoveGroup(const NotifierId& notifier_id) OVERRIDE; |
112 | 112 |
113 // Overridden from MockNotificationView::Test | 113 // Overridden from MockNotificationView::Test |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 NOTREACHED(); | 184 NOTREACHED(); |
185 } | 185 } |
186 | 186 |
187 void MessageCenterViewTest::RemoveNotification( | 187 void MessageCenterViewTest::RemoveNotification( |
188 const std::string& notification_id, | 188 const std::string& notification_id, |
189 bool by_user) { | 189 bool by_user) { |
190 // For this test, this method should not be invoked. | 190 // For this test, this method should not be invoked. |
191 NOTREACHED(); | 191 NOTREACHED(); |
192 } | 192 } |
193 | 193 |
194 void MessageCenterViewTest::DisableNotificationsFromThisSource( | 194 scoped_ptr<ui::MenuModel> MessageCenterViewTest::CreateMenuModel( |
195 const NotifierId& notifier_id) { | 195 const NotifierId& notifier_id, |
| 196 const base::string16& display_source) { |
196 // For this test, this method should not be invoked. | 197 // For this test, this method should not be invoked. |
197 NOTREACHED(); | 198 NOTREACHED(); |
198 } | 199 return scoped_ptr<ui::MenuModel>(); |
199 | |
200 void MessageCenterViewTest::ShowNotifierSettingsBubble() { | |
201 // For this test, this method should not be invoked. | |
202 NOTREACHED(); | |
203 } | 200 } |
204 | 201 |
205 bool MessageCenterViewTest::HasClickedListener( | 202 bool MessageCenterViewTest::HasClickedListener( |
206 const std::string& notification_id) { | 203 const std::string& notification_id) { |
207 return true; | 204 return true; |
208 } | 205 } |
209 | 206 |
210 void MessageCenterViewTest::ClickOnNotificationButton( | 207 void MessageCenterViewTest::ClickOnNotificationButton( |
211 const std::string& notification_id, | 208 const std::string& notification_id, |
212 int button_index) { | 209 int button_index) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very | 259 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very |
263 // large number corresponding to the current reality. That number will be | 260 // large number corresponding to the current reality. That number will be |
264 // ratcheted down over time as the code improves. | 261 // ratcheted down over time as the code improves. |
265 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); | 262 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); |
266 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + | 263 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + |
267 GetCallCount(GET_HEIGHT_FOR_WIDTH), | 264 GetCallCount(GET_HEIGHT_FOR_WIDTH), |
268 GetNotificationCount() * 20); | 265 GetNotificationCount() * 20); |
269 } | 266 } |
270 | 267 |
271 } // namespace message_center | 268 } // namespace message_center |
OLD | NEW |