Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Side by Side Diff: ui/message_center/views/message_center_view_unittest.cc

Issue 117983002: Prefix string16 with base:: in ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 void MessageCenterViewTest::RemoveGroup(const NotifierId& notifier_id) { 231 void MessageCenterViewTest::RemoveGroup(const NotifierId& notifier_id) {
232 // For this test, this method should not be invoked. 232 // For this test, this method should not be invoked.
233 NOTREACHED(); 233 NOTREACHED();
234 } 234 }
235 235
236 void MessageCenterViewTest::RegisterCall(CallType type) { 236 void MessageCenterViewTest::RegisterCall(CallType type) {
237 callCounts_[type] += 1; 237 callCounts_[type] += 1;
238 } 238 }
239 239
240 void MessageCenterViewTest::LogBounds(int depth, views::View* view) { 240 void MessageCenterViewTest::LogBounds(int depth, views::View* view) {
241 string16 inset; 241 base::string16 inset;
242 for (int i = 0; i < depth; ++i) 242 for (int i = 0; i < depth; ++i)
243 inset.append(UTF8ToUTF16(" ")); 243 inset.append(UTF8ToUTF16(" "));
244 gfx::Rect bounds = view->bounds(); 244 gfx::Rect bounds = view->bounds();
245 DVLOG(0) << inset << bounds.width() << " x " << bounds.height() 245 DVLOG(0) << inset << bounds.width() << " x " << bounds.height()
246 << " @ " << bounds.x() << ", " << bounds.y(); 246 << " @ " << bounds.x() << ", " << bounds.y();
247 for (int i = 0; i < view->child_count(); ++i) 247 for (int i = 0; i < view->child_count(); ++i)
248 LogBounds(depth + 1, view->child_at(i)); 248 LogBounds(depth + 1, view->child_at(i));
249 } 249 }
250 250
251 /* Unit tests *****************************************************************/ 251 /* Unit tests *****************************************************************/
252 252
253 TEST_F(MessageCenterViewTest, CallTest) { 253 TEST_F(MessageCenterViewTest, CallTest) {
254 // Exercise (with size values that just need to be large enough). 254 // Exercise (with size values that just need to be large enough).
255 GetMessageCenterView()->SetBounds(0, 0, 100, 100); 255 GetMessageCenterView()->SetBounds(0, 0, 100, 100);
256 256
257 // Verify that this didn't generate more than 2 Layout() call per descendant 257 // Verify that this didn't generate more than 2 Layout() call per descendant
258 // NotificationView or more than a total of 20 GetPreferredSize() and 258 // NotificationView or more than a total of 20 GetPreferredSize() and
259 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very 259 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very
260 // large number corresponding to the current reality. That number will be 260 // large number corresponding to the current reality. That number will be
261 // ratcheted down over time as the code improves. 261 // ratcheted down over time as the code improves.
262 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); 262 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2);
263 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + 263 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) +
264 GetCallCount(GET_HEIGHT_FOR_WIDTH), 264 GetCallCount(GET_HEIGHT_FOR_WIDTH),
265 GetNotificationCount() * 20); 265 GetNotificationCount() * 20);
266 } 266 }
267 267
268 } // namespace message_center 268 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/group_view.cc ('k') | ui/message_center/views/message_popup_collection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698