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

Unified Diff: content/child/notifications/pending_notifications_tracker_unittest.cc

Issue 1750083004: Add badge to web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/child/notifications/pending_notifications_tracker_unittest.cc
diff --git a/content/child/notifications/pending_notifications_tracker_unittest.cc b/content/child/notifications/pending_notifications_tracker_unittest.cc
index 18cee87f20f06a09c42922ee95b6a6b17c3e8690..10846172052ec3a2c22dd4c0c5748e5dfd996e69 100644
--- a/content/child/notifications/pending_notifications_tracker_unittest.cc
+++ b/content/child/notifications/pending_notifications_tracker_unittest.cc
@@ -37,6 +37,7 @@ namespace content {
namespace {
const char kBaseUrl[] = "http://test.com/";
+const char kIcon48x48[] = "48x48.png";
const char kIcon100x100[] = "100x100.png";
const char kIcon110x110[] = "110x110.png";
const char kIcon120x120[] = "120x120.png";
@@ -141,6 +142,7 @@ class PendingNotificationsTrackerTest : public testing::Test {
TEST_F(PendingNotificationsTrackerTest, OneNotificationMultipleResources) {
blink::WebNotificationData notification_data;
notification_data.icon = RegisterMockedURL(kIcon100x100);
+ notification_data.smallIcon = RegisterMockedURL(kIcon48x48);
notification_data.actions =
blink::WebVector<blink::WebNotificationAction>(static_cast<size_t>(2));
notification_data.actions[0].icon = RegisterMockedURL(kIcon110x110);
@@ -163,6 +165,9 @@ TEST_F(PendingNotificationsTrackerTest, OneNotificationMultipleResources) {
ASSERT_FALSE(GetResources(0u)->notification_icon.drawsNothing());
ASSERT_EQ(100, GetResources(0u)->notification_icon.width());
+ ASSERT_FALSE(GetResources(0u)->small_icon.drawsNothing());
Peter Beverloo 2016/03/03 17:55:39 nit: would it make sense to have the following in
Michael van Ouwerkerk 2016/03/09 18:28:25 Done.
+ ASSERT_EQ(48, GetResources(0u)->small_icon.width());
+
ASSERT_EQ(2u, GetResources(0u)->action_icons.size());
ASSERT_FALSE(GetResources(0u)->action_icons[0].drawsNothing());
ASSERT_EQ(110, GetResources(0u)->action_icons[0].width());
@@ -173,6 +178,7 @@ TEST_F(PendingNotificationsTrackerTest, OneNotificationMultipleResources) {
TEST_F(PendingNotificationsTrackerTest, LargeIconsAreScaledDown) {
blink::WebNotificationData notification_data;
notification_data.icon = RegisterMockedURL(kIcon500x500);
+ notification_data.smallIcon = notification_data.icon;
notification_data.actions =
blink::WebVector<blink::WebNotificationAction>(static_cast<size_t>(1));
notification_data.actions[0].icon = notification_data.icon;
@@ -197,6 +203,12 @@ TEST_F(PendingNotificationsTrackerTest, LargeIconsAreScaledDown) {
ASSERT_EQ(kPlatformNotificationMaxIconSizePx,
GetResources(0u)->notification_icon.height());
+ ASSERT_FALSE(GetResources(0u)->small_icon.drawsNothing());
+ ASSERT_EQ(kPlatformNotificationMaxSmallIconSizePx,
+ GetResources(0u)->small_icon.width());
+ ASSERT_EQ(kPlatformNotificationMaxSmallIconSizePx,
+ GetResources(0u)->small_icon.height());
+
ASSERT_EQ(1u, GetResources(0u)->action_icons.size());
ASSERT_FALSE(GetResources(0u)->action_icons[0].drawsNothing());
ASSERT_EQ(kPlatformNotificationMaxActionIconSizePx,

Powered by Google App Engine
This is Rietveld 408576698