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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc

Issue 2876603004: Linux native notifications: Add attribution (Closed)
Patch Set: Address comments Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc
diff --git a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc
index 96021e143c7f3dd26e22ea10f9128f65f49f519a..712eb6bf4fb9ae03396857a3453de8b941222bfa 100644
--- a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc
@@ -61,11 +61,21 @@ class NotificationBuilder {
return *this;
}
+ NotificationBuilder& SetMessage(const base::string16& message) {
+ notification_.set_message(message);
+ return *this;
+ }
+
NotificationBuilder& SetNeverTimeout(bool never_timeout) {
notification_.set_never_timeout(never_timeout);
return *this;
}
+ NotificationBuilder& SetOriginUrl(const GURL& origin_url) {
+ notification_.set_origin_url(origin_url);
+ return *this;
+ }
+
NotificationBuilder& SetProgress(int progress) {
notification_.set_progress(progress);
return *this;
@@ -218,8 +228,8 @@ class NotificationPlatformBridgeLinuxTest : public testing::Test {
EXPECT_CALL(*mock_notification_proxy_.get(),
MockCallMethodAndBlock(Calls("GetCapabilities"), _))
- .WillOnce(
- OnGetCapabilities(std::vector<std::string>{"body", "body-images"}));
+ .WillOnce(OnGetCapabilities(std::vector<std::string>{
+ "body", "body-hyperlinks", "body-images", "body-markup"}));
EXPECT_CALL(*mock_notification_proxy_.get(),
MockCallMethodAndBlock(Calls("GetServerInformation"), _))
@@ -311,7 +321,7 @@ TEST_F(NotificationPlatformBridgeLinuxTest, NotificationListItemsInBody) {
MockCallMethodAndBlock(Calls("Notify"), _))
.WillOnce(OnNotify(
[](const NotificationRequest& request) {
- EXPECT_EQ("abc - 123\ndef - 456", request.body);
+ EXPECT_EQ("<b>abc</b> 123\n<b>def</b> 456", request.body);
},
1));
@@ -390,3 +400,24 @@ TEST_F(NotificationPlatformBridgeLinuxTest, NotificationImages) {
.SetImage(original_image)
.GetResult());
}
+
+TEST_F(NotificationPlatformBridgeLinuxTest, NotificationAttribution) {
+ EXPECT_CALL(*mock_notification_proxy_.get(),
+ MockCallMethodAndBlock(Calls("Notify"), _))
+ .WillOnce(OnNotify(
+ [](const NotificationRequest& request) {
+ EXPECT_EQ(
+ "<a href=\"https%3A//google.com/"
+ "search%3Fq=test&ie=UTF8\">google.com</a>\nBody text",
+ request.body);
+ },
+ 1));
+
+ CreateNotificationBridgeLinux();
+ notification_bridge_linux_->Display(
+ NotificationCommon::PERSISTENT, "", "", false,
+ NotificationBuilder("")
+ .SetMessage(base::ASCIIToUTF16("Body text"))
+ .SetOriginUrl(GURL("https://google.com/search?q=test&ie=UTF8"))
+ .GetResult());
+}
« no previous file with comments | « chrome/browser/notifications/notification_platform_bridge_linux.cc ('k') | ui/message_center/notification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698