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

Side by Side Diff: chrome/browser/notifications/notification_conversion_helper_unittest.cc

Issue 1292003004: Elide origins displayed on web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/notifications/notification_conversion_helper.h" 5 #include "chrome/browser/notifications/notification_conversion_helper.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/notifications/notification.h" 8 #include "chrome/browser/notifications/notification.h"
9 #include "chrome/browser/notifications/notification_test_util.h" 9 #include "chrome/browser/notifications/notification_test_util.h"
10 #include "chrome/common/extensions/api/notifications.h" 10 #include "chrome/common/extensions/api/notifications.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/message_center/notification.h" 13 #include "ui/message_center/notification.h"
14 #include "ui/message_center/notification_types.h" 14 #include "ui/message_center/notification_types.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 class NotificationConversionHelperTest : public testing::Test { 17 class NotificationConversionHelperTest : public testing::Test {
18 public: 18 public:
19 NotificationConversionHelperTest() {} 19 NotificationConversionHelperTest() {}
20 20
21 void SetUp() override {} 21 void SetUp() override {}
22 22
23 void TearDown() override {} 23 void TearDown() override {}
24 24
25 protected: 25 protected:
26 scoped_ptr<Notification> CreateNotification( 26 scoped_ptr<Notification> CreateNotification(
27 message_center::NotificationType type) { 27 message_center::NotificationType type) {
28 message_center::RichNotificationData optional_fields; 28 message_center::RichNotificationData optional_fields;
29 optional_fields.priority = 1; 29 optional_fields.priority = 1;
30 optional_fields.context_message = 30 optional_fields.context_message.message = "I am a context message.";
31 base::UTF8ToUTF16("I am a context message."); 31 optional_fields.context_message.is_origin = false;
32 optional_fields.timestamp = base::Time::FromDoubleT(12345678.9); 32 optional_fields.timestamp = base::Time::FromDoubleT(12345678.9);
33 optional_fields.buttons.push_back( 33 optional_fields.buttons.push_back(
34 message_center::ButtonInfo(base::UTF8ToUTF16("Button 1"))); 34 message_center::ButtonInfo(base::UTF8ToUTF16("Button 1")));
35 optional_fields.buttons.push_back( 35 optional_fields.buttons.push_back(
36 message_center::ButtonInfo(base::UTF8ToUTF16("Button 2"))); 36 message_center::ButtonInfo(base::UTF8ToUTF16("Button 2")));
37 optional_fields.clickable = false; 37 optional_fields.clickable = false;
38 38
39 if (type == message_center::NOTIFICATION_TYPE_IMAGE) 39 if (type == message_center::NOTIFICATION_TYPE_IMAGE)
40 optional_fields.image = gfx::Image(); 40 optional_fields.image = gfx::Image();
41 if (type == message_center::NOTIFICATION_TYPE_MULTIPLE) { 41 if (type == message_center::NOTIFICATION_TYPE_MULTIPLE) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( 116 scoped_ptr<extensions::api::notifications::NotificationOptions> options3(
117 new extensions::api::notifications::NotificationOptions()); 117 new extensions::api::notifications::NotificationOptions());
118 NotificationConversionHelper::NotificationToNotificationOptions( 118 NotificationConversionHelper::NotificationToNotificationOptions(
119 *(notification3), options3.get()); 119 *(notification3), options3.get());
120 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); 120 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST);
121 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); 121 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title");
122 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); 122 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message");
123 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); 123 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title");
124 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); 124 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message");
125 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698