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

Unified Diff: chrome/browser/notifications/platform_notification_service_browsertest.cc

Issue 1750083004: Add badge to web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 9 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: chrome/browser/notifications/platform_notification_service_browsertest.cc
diff --git a/chrome/browser/notifications/platform_notification_service_browsertest.cc b/chrome/browser/notifications/platform_notification_service_browsertest.cc
index 329ff47287d362e8a528f5aefe31798f58ec59f8..07c9e984e6dfa1bd2e870a970074d9e8a29cb016 100644
--- a/chrome/browser/notifications/platform_notification_service_browsertest.cc
+++ b/chrome/browser/notifications/platform_notification_service_browsertest.cc
@@ -36,6 +36,10 @@
const int kIconWidth = 100;
const int kIconHeight = 100;
+// The maximum width and height of badges. Oversized images are scaled down to
+// these values.
+const int kMaxBadgeSize = 96;
+
const int kNotificationVibrationPattern[] = { 100, 200, 300 };
const double kNotificationTimestamp = 621046800000.;
@@ -106,6 +110,7 @@ PlatformNotificationServiceBrowserTest::PlatformNotificationServiceBrowserTest()
void PlatformNotificationServiceBrowserTest::SetUpCommandLine(
base::CommandLine* command_line) {
+ command_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures);
command_line->AppendSwitch(switches::kEnableNotificationActionIcons);
InProcessBrowserTest::SetUpCommandLine(command_line);
@@ -245,6 +250,7 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
EXPECT_EQ("", base::UTF16ToUTF8(default_notification.message()));
EXPECT_EQ("", default_notification.tag());
EXPECT_TRUE(default_notification.icon().IsEmpty());
+ EXPECT_TRUE(default_notification.small_image().IsEmpty());
EXPECT_FALSE(default_notification.renotify());
EXPECT_FALSE(default_notification.silent());
EXPECT_FALSE(default_notification.never_timeout());
@@ -273,6 +279,9 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
EXPECT_FALSE(all_options_notification.icon().IsEmpty());
EXPECT_EQ(kIconWidth, all_options_notification.icon().Width());
EXPECT_EQ(kIconHeight, all_options_notification.icon().Height());
+ EXPECT_FALSE(all_options_notification.small_image().IsEmpty());
+ EXPECT_EQ(kMaxBadgeSize, all_options_notification.small_image().Width());
+ EXPECT_EQ(kMaxBadgeSize, all_options_notification.small_image().Height());
EXPECT_TRUE(all_options_notification.renotify());
EXPECT_TRUE(all_options_notification.silent());
EXPECT_TRUE(all_options_notification.never_timeout());

Powered by Google App Engine
This is Rietveld 408576698