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

Unified Diff: chrome/browser/notifications/platform_notification_service_browsertest.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_browsertest.cc
diff --git a/chrome/browser/notifications/platform_notification_service_browsertest.cc b/chrome/browser/notifications/platform_notification_service_browsertest.cc
index 335e838873a49bf4ec492cb315af61f420244d9c..587f545f1903047a4ba702defdc389ca9f5b528d 100644
--- a/chrome/browser/notifications/platform_notification_service_browsertest.cc
+++ b/chrome/browser/notifications/platform_notification_service_browsertest.cc
@@ -23,6 +23,7 @@
#include "content/public/test/browser_test_utils.h"
#include "net/base/filename_util.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "testing/gmock/include/gmock/gmock.h"
// -----------------------------------------------------------------------------
@@ -30,6 +31,8 @@
const int kIconWidth = 100;
const int kIconHeight = 100;
+const int kNotificationVibrationPattern[] = { 100, 200, 300 };
+
class PlatformNotificationServiceBrowserTest : public InProcessBrowserTest {
public:
PlatformNotificationServiceBrowserTest();
@@ -219,6 +222,28 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
}
IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
+ WebNotificationOptionsVibrationPattern) {
+ std::string script_result;
+
+ InfoBarResponder accepting_responder(GetInfoBarService(), true);
+ ASSERT_TRUE(RunScript("RequestPermission()", &script_result));
+ EXPECT_EQ("granted", script_result);
+
+ ASSERT_TRUE(RunScript("DisplayPersistentNotificationVibrate()",
+ &script_result));
+ EXPECT_EQ("ok", script_result);
+
+ ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
+
+ const Notification& notification = ui_manager()->GetNotificationAt(0);
+ EXPECT_EQ("Title", base::UTF16ToUTF8(notification.title()));
+ EXPECT_EQ("Contents", base::UTF16ToUTF8(notification.message()));
+
+ EXPECT_THAT(notification.vibration_pattern(),
+ testing::ElementsAreArray(kNotificationVibrationPattern));
+}
+
+IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
CloseDisplayedPersistentNotification) {
std::string script_result;

Powered by Google App Engine
This is Rietveld 408576698