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

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

Issue 1681123002: Plumb Notification action icons through to the UI layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ActionIconResourceFetching
Patch Set: Created 4 years, 10 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
« no previous file with comments | « chrome/browser/notifications/platform_notification_service_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 PlatformNotificationData notification_data; 225 PlatformNotificationData notification_data;
226 notification_data.title = base::ASCIIToUTF16("My notification's title"); 226 notification_data.title = base::ASCIIToUTF16("My notification's title");
227 notification_data.body = base::ASCIIToUTF16("Hello, world!"); 227 notification_data.body = base::ASCIIToUTF16("Hello, world!");
228 notification_data.vibration_pattern = vibration_pattern; 228 notification_data.vibration_pattern = vibration_pattern;
229 notification_data.silent = true; 229 notification_data.silent = true;
230 notification_data.actions.resize(2); 230 notification_data.actions.resize(2);
231 notification_data.actions[0].title = base::ASCIIToUTF16("Button 1"); 231 notification_data.actions[0].title = base::ASCIIToUTF16("Button 1");
232 notification_data.actions[1].title = base::ASCIIToUTF16("Button 2"); 232 notification_data.actions[1].title = base::ASCIIToUTF16("Button 2");
233 233
234 NotificationResources notification_resources;
235 notification_resources.action_icons.resize(notification_data.actions.size());
236
234 service()->DisplayPersistentNotification( 237 service()->DisplayPersistentNotification(
235 profile(), 0u /* persistent notification */, GURL("https://chrome.com/"), 238 profile(), 0u /* persistent notification */, GURL("https://chrome.com/"),
236 notification_data, NotificationResources()); 239 notification_data, notification_resources);
237 240
238 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); 241 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
239 242
240 const Notification& notification = ui_manager()->GetNotificationAt(0); 243 const Notification& notification = ui_manager()->GetNotificationAt(0);
241 EXPECT_EQ("https://chrome.com/", notification.origin_url().spec()); 244 EXPECT_EQ("https://chrome.com/", notification.origin_url().spec());
242 EXPECT_EQ("My notification's title", base::UTF16ToUTF8(notification.title())); 245 EXPECT_EQ("My notification's title", base::UTF16ToUTF8(notification.title()));
243 EXPECT_EQ("Hello, world!", base::UTF16ToUTF8(notification.message())); 246 EXPECT_EQ("Hello, world!", base::UTF16ToUTF8(notification.message()));
244 247
245 EXPECT_THAT(notification.vibration_pattern(), 248 EXPECT_THAT(notification.vibration_pattern(),
246 testing::ElementsAreArray(kNotificationVibrationPattern)); 249 testing::ElementsAreArray(kNotificationVibrationPattern));
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 notification = service()->CreateNotificationFromData( 396 notification = service()->CreateNotificationFromData(
394 profile(), 397 profile(),
395 GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"), 398 GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"),
396 notification_data, NotificationResources(), 399 notification_data, NotificationResources(),
397 new MockNotificationDelegate("hello")); 400 new MockNotificationDelegate("hello"));
398 EXPECT_EQ("NotificationTest", 401 EXPECT_EQ("NotificationTest",
399 base::UTF16ToUTF8(notification.context_message())); 402 base::UTF16ToUTF8(notification.context_message()));
400 } 403 }
401 404
402 #endif // defined(ENABLE_EXTENSIONS) 405 #endif // defined(ENABLE_EXTENSIONS)
OLDNEW
« no previous file with comments | « chrome/browser/notifications/platform_notification_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698