OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |