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

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

Issue 2969603003: Implement new-style image notification resizing. (Closed)
Patch Set: Fix nits. Created 3 years, 4 months 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
« no previous file with comments | « ui/message_center/views/notification_view_md.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "ui/message_center/views/notification_view_md.h" 5 #include "ui/message_center/views/notification_view_md.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // * TestLineLimits 274 // * TestLineLimits
275 // * TestImageSizing 275 // * TestImageSizing
276 // * SettingsButtonTest 276 // * SettingsButtonTest
277 // * ViewOrderingTest 277 // * ViewOrderingTest
278 // * FormatContextMessageTest 278 // * FormatContextMessageTest
279 279
280 TEST_F(NotificationViewMDTest, CreateOrUpdateTest) { 280 TEST_F(NotificationViewMDTest, CreateOrUpdateTest) {
281 EXPECT_NE(nullptr, notification_view()->title_view_); 281 EXPECT_NE(nullptr, notification_view()->title_view_);
282 EXPECT_NE(nullptr, notification_view()->message_view_); 282 EXPECT_NE(nullptr, notification_view()->message_view_);
283 EXPECT_NE(nullptr, notification_view()->icon_view_); 283 EXPECT_NE(nullptr, notification_view()->icon_view_);
284 EXPECT_NE(nullptr, notification_view()->image_view_); 284 EXPECT_NE(nullptr, notification_view()->image_container_view_);
285 285
286 notification()->set_image(gfx::Image()); 286 notification()->set_image(gfx::Image());
287 notification()->set_title(base::string16()); 287 notification()->set_title(base::string16());
288 notification()->set_message(base::string16()); 288 notification()->set_message(base::string16());
289 notification()->set_icon(gfx::Image()); 289 notification()->set_icon(gfx::Image());
290 290
291 notification_view()->CreateOrUpdateViews(*notification()); 291 notification_view()->CreateOrUpdateViews(*notification());
292 292
293 EXPECT_EQ(nullptr, notification_view()->title_view_); 293 EXPECT_EQ(nullptr, notification_view()->title_view_);
294 EXPECT_EQ(nullptr, notification_view()->message_view_); 294 EXPECT_EQ(nullptr, notification_view()->message_view_);
295 EXPECT_EQ(nullptr, notification_view()->image_view_); 295 EXPECT_EQ(nullptr, notification_view()->image_container_view_);
296 // We still expect an icon view for all layouts. 296 // We still expect an icon view for all layouts.
297 EXPECT_NE(nullptr, notification_view()->icon_view_); 297 EXPECT_NE(nullptr, notification_view()->icon_view_);
298 } 298 }
299 299
300 TEST_F(NotificationViewMDTest, TestIconSizing) { 300 TEST_F(NotificationViewMDTest, TestIconSizing) {
301 // TODO(tetsui): Remove duplicated integer literal in CreateOrUpdateIconView. 301 // TODO(tetsui): Remove duplicated integer literal in CreateOrUpdateIconView.
302 const int kNotificationIconSize = 30; 302 const int kNotificationIconSize = 30;
303 303
304 notification()->set_type(NOTIFICATION_TYPE_SIMPLE); 304 notification()->set_type(NOTIFICATION_TYPE_SIMPLE);
305 ProportionalImageView* view = notification_view()->icon_view_; 305 ProportionalImageView* view = notification_view()->icon_view_;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 notification_view()->GetPreferredSize().height()); 526 notification_view()->GetPreferredSize().height());
527 527
528 notification_view()->ToggleExpanded(); 528 notification_view()->ToggleExpanded();
529 EXPECT_FALSE(notification_view()->expanded_); 529 EXPECT_FALSE(notification_view()->expanded_);
530 EXPECT_EQ(collapsed_height, notification_view()->message_view_->height()); 530 EXPECT_EQ(collapsed_height, notification_view()->message_view_->height());
531 EXPECT_EQ(collapsed_preferred_height, 531 EXPECT_EQ(collapsed_preferred_height,
532 notification_view()->GetPreferredSize().height()); 532 notification_view()->GetPreferredSize().height());
533 } 533 }
534 534
535 } // namespace message_center 535 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_view_md.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698