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

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, 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_browsertest.cc
diff --git a/chrome/browser/notifications/platform_notification_service_browsertest.cc b/chrome/browser/notifications/platform_notification_service_browsertest.cc
index 0cf8fa190745a180bc3410ba5cc359529bdbf093..1493b00422332cb5e25a09bbd498abcacb0279f1 100644
--- a/chrome/browser/notifications/platform_notification_service_browsertest.cc
+++ b/chrome/browser/notifications/platform_notification_service_browsertest.cc
@@ -87,6 +87,7 @@ void InfoBarResponder::Respond(ConfirmInfoBarDelegate* delegate) {
// Dimensions of the icon.png resource in the notification test data directory.
const int kIconWidth = 100;
const int kIconHeight = 100;
+const unsigned kNotificationVibrate[] = { 100, 200, 300 };
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.
class PlatformNotificationServiceBrowserTest : public InProcessBrowserTest {
public:
@@ -271,6 +272,29 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
}
IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
+ WebNotificationOptionsVibrate) {
Peter Beverloo 2015/04/21 17:58:23 Could we include this in the WebNotificationOption
Sanghyun Park 2015/04/23 11:08:26 I cannot use WebNotificationOptionsReflection test
Peter Beverloo 2015/04/26 23:26:41 I see! Thanks :-)
+ std::string script_result;
+
+ InfoBarResponder accepting_responder(browser(), 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()));
+
+ ASSERT_EQ(arraysize(kNotificationVibrate), notification.vibrate().size());
+ for (size_t i = 0; i < arraysize(kNotificationVibrate); ++i)
+ EXPECT_EQ(kNotificationVibrate[i], notification.vibrate()[i]);
+}
+
+IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
CloseDisplayedPersistentNotification) {
std::string script_result;

Powered by Google App Engine
This is Rietveld 408576698