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

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, 7 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..d3cfdeb8d2bb78bf84bdd21a237144e407ac6218 100644
--- a/chrome/browser/notifications/platform_notification_service_unittest.cc
+++ b/chrome/browser/notifications/platform_notification_service_unittest.cc
@@ -17,6 +17,8 @@
namespace {
+const int kNotificationVibrationPattern[] = { 100, 200, 300 };
+
#if !defined(OS_ANDROID)
const int64_t kPersistentNotificationId = 42;
#endif
@@ -157,9 +159,14 @@ TEST_F(PlatformNotificationServiceTest, PersistentNotificationDisplay) {
#endif // !defined(OS_ANDROID)
TEST_F(PlatformNotificationServiceTest, DisplayPageNotificationMatches) {
+ std::vector<int> vibration_pattern(
+ kNotificationVibrationPattern,
+ kNotificationVibrationPattern + arraysize(kNotificationVibrationPattern));
+
content::PlatformNotificationData notification_data;
notification_data.title = base::ASCIIToUTF16("My notification's title");
notification_data.body = base::ASCIIToUTF16("Hello, world!");
+ notification_data.vibration_pattern = vibration_pattern;
notification_data.silent = true;
MockDesktopNotificationDelegate* delegate
@@ -179,6 +186,11 @@ TEST_F(PlatformNotificationServiceTest, DisplayPageNotificationMatches) {
base::UTF16ToUTF8(notification.title()));
EXPECT_EQ("Hello, world!",
base::UTF16ToUTF8(notification.message()));
+
+ ASSERT_EQ(vibration_pattern.size(), notification.vibration_pattern().size());
+ for (size_t i = 0; i < vibration_pattern.size(); ++i)
+ EXPECT_EQ(vibration_pattern[i], notification.vibration_pattern()[i]);
+
EXPECT_TRUE(notification.silent());
}

Powered by Google App Engine
This is Rietveld 408576698