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

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

Issue 661643002: Adds a context message of the security origin for web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses comments and adds some unit tests. Created 6 years, 2 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/notification_browsertest.cc
diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc
index f189feac7d352bde2d31999643effd8d72da25b0..d1a2323f877c0b12b0b5bee26565de5307da3d35 100644
--- a/chrome/browser/notifications/notification_browsertest.cc
+++ b/chrome/browser/notifications/notification_browsertest.cc
@@ -839,3 +839,22 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest,
ASSERT_EQ(1, GetNotificationPopupCount());
}
+
+IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDisplayOriginContextMessage) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ // Creates a simple notification.
+ AllowAllOrigins();
+ ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
+
+ std::string result = CreateSimpleNotification(browser(), true);
+
+ ASSERT_EQ(1, GetNotificationCount());
+ message_center::NotificationList::Notifications notifications =
+ message_center::MessageCenter::Get()->GetVisibleNotifications();
+ GURL base_url = embedded_test_server()->base_url();
+ std::string expected_display_origin = base::StringPrintf(
+ "%s:%s", base_url.host().c_str(), base_url.port().c_str());
+ EXPECT_EQ(base::UTF8ToUTF16(expected_display_origin),
+ (*notifications.rbegin())->context_message());
+}

Powered by Google App Engine
This is Rietveld 408576698