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

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: Style nit 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"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 optional_fields.progress = 50; 50 optional_fields.progress = 50;
51 51
52 NotificationDelegate* delegate(new MockNotificationDelegate("id1")); 52 NotificationDelegate* delegate(new MockNotificationDelegate("id1"));
53 53
54 SkBitmap bitmap; 54 SkBitmap bitmap;
55 bitmap.allocN32Pixels(1, 1); 55 bitmap.allocN32Pixels(1, 1);
56 bitmap.eraseColor(SkColorSetRGB(1, 2, 3)); 56 bitmap.eraseColor(SkColorSetRGB(1, 2, 3));
57 gfx::Image icon = gfx::Image::CreateFrom1xBitmap(bitmap); 57 gfx::Image icon = gfx::Image::CreateFrom1xBitmap(bitmap);
58 58
59 scoped_ptr<Notification> notification(new Notification( 59 scoped_ptr<Notification> notification(new Notification(
60 type, 60 type, base::UTF8ToUTF16("Title"),
61 GURL(), 61 base::UTF8ToUTF16("This is a message."), icon,
62 base::UTF8ToUTF16("Title"),
63 base::UTF8ToUTF16("This is a message."),
64 icon,
65 message_center::NotifierId(message_center::NotifierId::APPLICATION, 62 message_center::NotifierId(message_center::NotifierId::APPLICATION,
66 "Notifier 1"), 63 "Notifier 1"),
67 base::UTF8ToUTF16("Notifier's Name"), 64 base::UTF8ToUTF16("Notifier's Name"), GURL(), "id1", optional_fields,
68 "id1",
69 optional_fields,
70 delegate)); 65 delegate));
71 66
72 return notification.Pass(); 67 return notification.Pass();
73 } 68 }
74 69
75 private: 70 private:
76 DISALLOW_COPY_AND_ASSIGN(NotificationConversionHelperTest); 71 DISALLOW_COPY_AND_ASSIGN(NotificationConversionHelperTest);
77 }; 72 };
78 73
79 TEST_F(NotificationConversionHelperTest, NotificationToNotificationOptions) { 74 TEST_F(NotificationConversionHelperTest, NotificationToNotificationOptions) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( 111 scoped_ptr<extensions::api::notifications::NotificationOptions> options3(
117 new extensions::api::notifications::NotificationOptions()); 112 new extensions::api::notifications::NotificationOptions());
118 NotificationConversionHelper::NotificationToNotificationOptions( 113 NotificationConversionHelper::NotificationToNotificationOptions(
119 *(notification3), options3.get()); 114 *(notification3), options3.get());
120 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); 115 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST);
121 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); 116 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title");
122 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); 117 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message");
123 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); 118 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title");
124 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); 119 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message");
125 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698