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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <deque> 5 #include <deque>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 (*notifications.rbegin())->id()); 832 (*notifications.rbegin())->id());
833 833
834 ASSERT_EQ(0, GetNotificationPopupCount()); 834 ASSERT_EQ(0, GetNotificationPopupCount());
835 835
836 result = CreateNotification( 836 result = CreateNotification(
837 browser(), true, "abc.png", "Title2", "Body2", "chat"); 837 browser(), true, "abc.png", "Title2", "Body2", "chat");
838 EXPECT_NE("-1", result); 838 EXPECT_NE("-1", result);
839 839
840 ASSERT_EQ(1, GetNotificationPopupCount()); 840 ASSERT_EQ(1, GetNotificationPopupCount());
841 } 841 }
842
843 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDisplayOriginContextMessage) {
844 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
845
846 // Creates a simple notification.
847 AllowAllOrigins();
848 ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
849
850 std::string result = CreateSimpleNotification(browser(), true);
851
852 ASSERT_EQ(1, GetNotificationCount());
853 message_center::NotificationList::Notifications notifications =
854 message_center::MessageCenter::Get()->GetVisibleNotifications();
855 GURL base_url = embedded_test_server()->base_url();
856 std::string expected_display_origin = base::StringPrintf(
857 "%s:%s", base_url.host().c_str(), base_url.port().c_str());
858 EXPECT_EQ(base::UTF8ToUTF16(expected_display_origin),
859 (*notifications.rbegin())->context_message());
860 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698