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

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

Issue 1825913002: [Extensions] Convert APIs to use movable types [7] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Steven's Created 4 years, 8 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/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/notifications/notification.h" 9 #include "chrome/browser/notifications/notification.h"
10 #include "chrome/browser/notifications/notification_test_util.h" 10 #include "chrome/browser/notifications/notification_test_util.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 *(notification1), options1.get()); 82 *(notification1), options1.get());
83 83
84 EXPECT_EQ(options1->type, 84 EXPECT_EQ(options1->type,
85 extensions::api::notifications::TEMPLATE_TYPE_IMAGE); 85 extensions::api::notifications::TEMPLATE_TYPE_IMAGE);
86 EXPECT_EQ(*(options1->title), "Title"); 86 EXPECT_EQ(*(options1->title), "Title");
87 EXPECT_EQ(*(options1->message), "This is a message."); 87 EXPECT_EQ(*(options1->message), "This is a message.");
88 EXPECT_EQ(*(options1->priority), 1); 88 EXPECT_EQ(*(options1->priority), 1);
89 EXPECT_EQ(*(options1->context_message), "I am a context message."); 89 EXPECT_EQ(*(options1->context_message), "I am a context message.");
90 EXPECT_FALSE(*(options1->is_clickable)); 90 EXPECT_FALSE(*(options1->is_clickable));
91 EXPECT_EQ(*(options1->event_time), 12345678.9); 91 EXPECT_EQ(*(options1->event_time), 12345678.9);
92 EXPECT_EQ(options1->buttons->at(0)->title, "Button 1"); 92 EXPECT_EQ(options1->buttons->at(0).title, "Button 1");
93 EXPECT_EQ(options1->buttons->at(1)->title, "Button 2"); 93 EXPECT_EQ(options1->buttons->at(1).title, "Button 2");
94 94
95 EXPECT_EQ(options1->icon_bitmap->width, 1); 95 EXPECT_EQ(options1->icon_bitmap->width, 1);
96 EXPECT_EQ(options1->icon_bitmap->height, 1); 96 EXPECT_EQ(options1->icon_bitmap->height, 1);
97 97
98 // Create a notification of progress type 98 // Create a notification of progress type
99 scoped_ptr<Notification> notification2 = 99 scoped_ptr<Notification> notification2 =
100 CreateNotification(message_center::NOTIFICATION_TYPE_PROGRESS); 100 CreateNotification(message_center::NOTIFICATION_TYPE_PROGRESS);
101 scoped_ptr<extensions::api::notifications::NotificationOptions> options2( 101 scoped_ptr<extensions::api::notifications::NotificationOptions> options2(
102 new extensions::api::notifications::NotificationOptions()); 102 new extensions::api::notifications::NotificationOptions());
103 NotificationConversionHelper::NotificationToNotificationOptions( 103 NotificationConversionHelper::NotificationToNotificationOptions(
104 *(notification2), options2.get()); 104 *(notification2), options2.get());
105 EXPECT_EQ(options2->type, 105 EXPECT_EQ(options2->type,
106 extensions::api::notifications::TEMPLATE_TYPE_PROGRESS); 106 extensions::api::notifications::TEMPLATE_TYPE_PROGRESS);
107 EXPECT_EQ(*(options2->progress), 50); 107 EXPECT_EQ(*(options2->progress), 50);
108 108
109 // Create a notification of multiple type 109 // Create a notification of multiple type
110 scoped_ptr<Notification> notification3 = 110 scoped_ptr<Notification> notification3 =
111 CreateNotification(message_center::NOTIFICATION_TYPE_MULTIPLE); 111 CreateNotification(message_center::NOTIFICATION_TYPE_MULTIPLE);
112 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( 112 scoped_ptr<extensions::api::notifications::NotificationOptions> options3(
113 new extensions::api::notifications::NotificationOptions()); 113 new extensions::api::notifications::NotificationOptions());
114 NotificationConversionHelper::NotificationToNotificationOptions( 114 NotificationConversionHelper::NotificationToNotificationOptions(
115 *(notification3), options3.get()); 115 *(notification3), options3.get());
116 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); 116 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST);
117 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); 117 EXPECT_EQ(options3->items->at(0).title, "Item 1 Title");
118 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); 118 EXPECT_EQ(options3->items->at(0).message, "Item 1 Message");
119 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); 119 EXPECT_EQ(options3->items->at(1).title, "Item 2 Title");
120 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); 120 EXPECT_EQ(options3->items->at(1).message, "Item 2 Message");
121 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698