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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |