Index: chrome/browser/notifications/platform_notification_service_browsertest.cc |
diff --git a/chrome/browser/notifications/platform_notification_service_browsertest.cc b/chrome/browser/notifications/platform_notification_service_browsertest.cc |
index 3ea3b1cb5863958d558c0afa1e33310ca4ebf38e..4b63c2f8e9dc8f193983776471a3f1b2cd69a7d6 100644 |
--- a/chrome/browser/notifications/platform_notification_service_browsertest.cc |
+++ b/chrome/browser/notifications/platform_notification_service_browsertest.cc |
@@ -7,6 +7,7 @@ |
#include "base/command_line.h" |
#include "base/files/file_path.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/infobars/infobar_service.h" |
#include "chrome/browser/notifications/notification_test_util.h" |
#include "chrome/browser/notifications/platform_notification_service_impl.h" |
@@ -105,6 +106,8 @@ class PlatformNotificationServiceBrowserTest : public InProcessBrowserTest { |
// will be returned, indicating whether the script was executed successfully. |
bool RunScript(const std::string& script, std::string* result) const; |
+ net::HostPortPair ServerHostPort() const; |
+ |
private: |
scoped_ptr<StubNotificationUIManager> ui_manager_; |
scoped_ptr<net::SpawnedTestServer> https_server_; |
@@ -164,6 +167,11 @@ bool PlatformNotificationServiceBrowserTest::RunScript( |
result); |
} |
+net::HostPortPair PlatformNotificationServiceBrowserTest::ServerHostPort() |
+ const { |
+ return https_server_->host_port_pair(); |
+} |
+ |
// ----------------------------------------------------------------------------- |
// TODO(peter): Move PlatformNotificationService-related tests over from |
@@ -230,3 +238,21 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
ASSERT_EQ(0u, ui_manager()->GetNotificationCount()); |
} |
+ |
+IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
+ TestDisplayOriginContextMessage) { |
+ std::string script_result; |
+ |
+ // Creates a simple notification. |
+ InfoBarResponder accepting_responder(browser(), true); |
+ ASSERT_TRUE(RunScript("RequestPermission()", &script_result)); |
+ ASSERT_EQ("granted", script_result); |
+ ASSERT_TRUE(RunScript("DisplayPersistentNotification()", &script_result)); |
+ |
+ net::HostPortPair host_port = ServerHostPort(); |
+ |
+ const Notification& notification = ui_manager()->GetNotificationAt(0); |
+ |
+ EXPECT_EQ(base::UTF8ToUTF16(host_port.ToString()), |
+ notification.context_message()); |
+} |