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

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..ee0e7c7848b666ead310d939173e7ccab5f5abe9 100644
--- a/chrome/browser/notifications/platform_notification_service_unittest.cc
+++ b/chrome/browser/notifications/platform_notification_service_unittest.cc
@@ -12,11 +12,14 @@
#include "content/public/browser/desktop_notification_delegate.h"
#include "content/public/common/platform_notification_data.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace {
+const int kNotificationVibrationPattern[] = { 100, 200, 300 };
+
#if !defined(OS_ANDROID)
const int64_t kPersistentNotificationId = 42;
#endif
@@ -157,9 +160,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 +187,10 @@ TEST_F(PlatformNotificationServiceTest, DisplayPageNotificationMatches) {
base::UTF16ToUTF8(notification.title()));
EXPECT_EQ("Hello, world!",
base::UTF16ToUTF8(notification.message()));
+
+ EXPECT_THAT(notification.vibration_pattern(),
+ testing::ElementsAreArray(kNotificationVibrationPattern));
+
EXPECT_TRUE(notification.silent());
}

Powered by Google App Engine
This is Rietveld 408576698