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

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

Issue 1054573002: Implement support for notification.vibrate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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_unittest.cc
diff --git a/chrome/browser/notifications/platform_notification_service_unittest.cc b/chrome/browser/notifications/platform_notification_service_unittest.cc
index 40a8eec1f28bd88a040c72e566404bb9522caf33..4c717f8d70121ed27ed6fb0c899dc31b109dce2f 100644
--- a/chrome/browser/notifications/platform_notification_service_unittest.cc
+++ b/chrome/browser/notifications/platform_notification_service_unittest.cc
@@ -17,6 +17,7 @@
namespace {
+const unsigned kNotificationVibrate[] = { 100, 200, 300 };
Peter Beverloo 2015/04/21 17:58:23 nit: blank line
Peter Beverloo 2015/04/21 17:58:23 Please use either int or int64_t here.
Sanghyun Park 2015/04/23 11:08:26 Done.
#if !defined(OS_ANDROID)
const int64_t kPersistentNotificationId = 42;
#endif
@@ -157,9 +158,14 @@ TEST_F(PlatformNotificationServiceTest, PersistentNotificationDisplay) {
#endif // !defined(OS_ANDROID)
TEST_F(PlatformNotificationServiceTest, DisplayPageNotificationMatches) {
+ std::vector<unsigned> vibrate_pattern(
Peter Beverloo 2015/04/21 17:58:23 int/int64_t (whatever you choose to use in the //c
Sanghyun Park 2015/04/23 11:08:26 Done.
+ kNotificationVibrate,
+ kNotificationVibrate + arraysize(kNotificationVibrate));
+
content::PlatformNotificationData notification_data;
notification_data.title = base::ASCIIToUTF16("My notification's title");
notification_data.body = base::ASCIIToUTF16("Hello, world!");
+ notification_data.vibrate = vibrate_pattern;
notification_data.silent = true;
MockDesktopNotificationDelegate* delegate
@@ -179,6 +185,11 @@ TEST_F(PlatformNotificationServiceTest, DisplayPageNotificationMatches) {
base::UTF16ToUTF8(notification.title()));
EXPECT_EQ("Hello, world!",
base::UTF16ToUTF8(notification.message()));
+
+ ASSERT_EQ(vibrate_pattern.size(), notification.vibrate().size());
+ for (size_t i = 0; i < vibrate_pattern.size(); ++i)
+ EXPECT_EQ(vibrate_pattern[i], notification.vibrate()[i]);
+
EXPECT_TRUE(notification.silent());
}

Powered by Google App Engine
This is Rietveld 408576698