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

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

Issue 14631005: Enable users of NotificationUIManager to specify binary images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase for relanding. Created 7 years, 6 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/message_center_notifications_browsertest.cc
diff --git a/chrome/browser/notifications/message_center_notifications_browsertest.cc b/chrome/browser/notifications/message_center_notifications_browsertest.cc
index 71cc0a66d3b2f866ba527e7969011521340bbe12..6c1d9c574f9be6f4f03c1c219033d8c41e5ac331 100644
--- a/chrome/browser/notifications/message_center_notifications_browsertest.cc
+++ b/chrome/browser/notifications/message_center_notifications_browsertest.cc
@@ -79,13 +79,35 @@ class MessageCenterNotificationsTest : public InProcessBrowserTest {
new_delegate->AddRef();
}
- return Notification(GURL(),
+ return Notification(GURL("chrome-test://testing/"),
GURL(),
ASCIIToUTF16("title"),
ASCIIToUTF16("message"),
WebKit::WebTextDirectionDefault,
- EmptyString16(),
- EmptyString16(),
+ UTF8ToUTF16("chrome-test://testing/"),
+ UTF8ToUTF16("REPLACE-ME"),
+ new_delegate);
+ }
+
+ Notification CreateRichTestNotification(const std::string& id,
+ TestDelegate** delegate = NULL) {
+ TestDelegate* new_delegate = new TestDelegate(id);
+ if (delegate) {
+ *delegate = new_delegate;
+ new_delegate->AddRef();
+ }
+
+ message_center::RichNotificationData data;
+
+ return Notification(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
+ GURL("chrome-test://testing/"),
+ ASCIIToUTF16("title"),
+ ASCIIToUTF16("message"),
+ gfx::Image(),
+ WebKit::WebTextDirectionDefault,
+ UTF8ToUTF16("chrome-test://testing/"),
+ UTF8ToUTF16("REPLACE-ME"),
+ data,
new_delegate);
}
};
@@ -154,4 +176,27 @@ IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest,
delegate->Release();
}
+// MessaceCenter-specific test.
+#if defined(RUN_MESSAGE_CENTER_TESTS)
+#define MAYBE_UpdateExistingNotification UpdateExistingNotification
+#else
+#define MAYBE_UpdateExistingNotification DISABLED_UpdateExistingNotification
+#endif
+
+IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest,
+ MAYBE_UpdateExistingNotification) {
+ EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter());
+ TestDelegate* delegate;
+ manager()->Add(CreateTestNotification("n", &delegate), profile());
+ TestDelegate* delegate2;
+ manager()->Add(CreateRichTestNotification("n", &delegate2), profile());
+
+ manager()->CancelById("n");
+ EXPECT_EQ("Display_Close_programmatically_", delegate->log());
+ EXPECT_EQ("Close_programmatically_", delegate2->log());
+
+ delegate->Release();
+ delegate2->Release();
+}
+
#endif // !defined(OS_MACOSX)
« no previous file with comments | « chrome/browser/notifications/message_center_notification_manager.cc ('k') | chrome/browser/notifications/notification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698