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

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 peter's comments. Created 6 years, 1 month 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 (*notifications.rbegin())->id()); 830 (*notifications.rbegin())->id());
831 831
832 ASSERT_EQ(0, GetNotificationPopupCount()); 832 ASSERT_EQ(0, GetNotificationPopupCount());
833 833
834 result = CreateNotification( 834 result = CreateNotification(
835 browser(), true, "abc.png", "Title2", "Body2", "chat"); 835 browser(), true, "abc.png", "Title2", "Body2", "chat");
836 EXPECT_NE("-1", result); 836 EXPECT_NE("-1", result);
837 837
838 ASSERT_EQ(1, GetNotificationPopupCount()); 838 ASSERT_EQ(1, GetNotificationPopupCount());
839 } 839 }
840
841 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDisplayOriginContextMessage) {
842 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
843
844 // Creates a simple notification.
845 AllowAllOrigins();
846 ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
847
848 std::string result = CreateSimpleNotification(browser(), true);
849
850 ASSERT_EQ(1, GetNotificationCount());
851 message_center::NotificationList::Notifications notifications =
852 message_center::MessageCenter::Get()->GetVisibleNotifications();
853 GURL base_url = embedded_test_server()->base_url();
854 std::string expected_display_origin = base::StringPrintf(
855 "%s:%s", base_url.host().c_str(), base_url.port().c_str());
856 EXPECT_EQ(base::UTF8ToUTF16(expected_display_origin),
857 (*notifications.rbegin())->context_message());
858 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698