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

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

Issue 2261283002: Add Notification images (Blink + desktop implementation) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check IPC drawsNothing rather than isNull Created 4 years, 3 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 &script_result)); 260 &script_result));
261 EXPECT_EQ("ok", script_result); 261 EXPECT_EQ("ok", script_result);
262 262
263 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); 263 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
264 264
265 // We don't use or check the notification's direction and language. 265 // We don't use or check the notification's direction and language.
266 const Notification& default_notification = ui_manager()->GetNotificationAt(0); 266 const Notification& default_notification = ui_manager()->GetNotificationAt(0);
267 EXPECT_EQ("Some title", base::UTF16ToUTF8(default_notification.title())); 267 EXPECT_EQ("Some title", base::UTF16ToUTF8(default_notification.title()));
268 EXPECT_EQ("", base::UTF16ToUTF8(default_notification.message())); 268 EXPECT_EQ("", base::UTF16ToUTF8(default_notification.message()));
269 EXPECT_EQ("", default_notification.tag()); 269 EXPECT_EQ("", default_notification.tag());
270 EXPECT_TRUE(default_notification.image().IsEmpty());
270 EXPECT_TRUE(default_notification.icon().IsEmpty()); 271 EXPECT_TRUE(default_notification.icon().IsEmpty());
271 EXPECT_TRUE(default_notification.small_image().IsEmpty()); 272 EXPECT_TRUE(default_notification.small_image().IsEmpty());
272 EXPECT_FALSE(default_notification.renotify()); 273 EXPECT_FALSE(default_notification.renotify());
273 EXPECT_FALSE(default_notification.silent()); 274 EXPECT_FALSE(default_notification.silent());
274 EXPECT_FALSE(default_notification.never_timeout()); 275 EXPECT_FALSE(default_notification.never_timeout());
275 EXPECT_EQ(0u, default_notification.buttons().size()); 276 EXPECT_EQ(0u, default_notification.buttons().size());
276 277
277 // Verifies that the notification's default timestamp is set in the last 30 278 // Verifies that the notification's default timestamp is set in the last 30
278 // seconds. This number has no significance, but it needs to be significantly 279 // seconds. This number has no significance, but it needs to be significantly
279 // high to avoid flakiness in the test. 280 // high to avoid flakiness in the test.
280 EXPECT_NEAR(default_notification.timestamp().ToJsTime(), 281 EXPECT_NEAR(default_notification.timestamp().ToJsTime(),
281 base::Time::Now().ToJsTime(), 30 * 1000); 282 base::Time::Now().ToJsTime(), 30 * 1000);
282 283
283 // Now, test the non-default values. 284 // Now, test the non-default values.
284 285
285 ASSERT_TRUE(RunScript("DisplayPersistentAllOptionsNotification()", 286 ASSERT_TRUE(RunScript("DisplayPersistentAllOptionsNotification()",
286 &script_result)); 287 &script_result));
287 EXPECT_EQ("ok", script_result); 288 EXPECT_EQ("ok", script_result);
288 289
289 ASSERT_EQ(2u, ui_manager()->GetNotificationCount()); 290 ASSERT_EQ(2u, ui_manager()->GetNotificationCount());
290 291
291 // We don't use or check the notification's direction and language. 292 // We don't use or check the notification's direction and language.
292 const Notification& all_options_notification = 293 const Notification& all_options_notification =
293 ui_manager()->GetNotificationAt(1); 294 ui_manager()->GetNotificationAt(1);
294 EXPECT_EQ("Title", base::UTF16ToUTF8(all_options_notification.title())); 295 EXPECT_EQ("Title", base::UTF16ToUTF8(all_options_notification.title()));
295 EXPECT_EQ("Contents", base::UTF16ToUTF8(all_options_notification.message())); 296 EXPECT_EQ("Contents", base::UTF16ToUTF8(all_options_notification.message()));
296 EXPECT_EQ("replace-id", all_options_notification.tag()); 297 EXPECT_EQ("replace-id", all_options_notification.tag());
298 EXPECT_FALSE(all_options_notification.image().IsEmpty());
299 EXPECT_EQ(kIconWidth, all_options_notification.image().Width());
300 EXPECT_EQ(kIconHeight, all_options_notification.image().Height());
297 EXPECT_FALSE(all_options_notification.icon().IsEmpty()); 301 EXPECT_FALSE(all_options_notification.icon().IsEmpty());
298 EXPECT_EQ(kIconWidth, all_options_notification.icon().Width()); 302 EXPECT_EQ(kIconWidth, all_options_notification.icon().Width());
299 EXPECT_EQ(kIconHeight, all_options_notification.icon().Height()); 303 EXPECT_EQ(kIconHeight, all_options_notification.icon().Height());
300 EXPECT_TRUE(all_options_notification.small_image().IsEmpty()); 304 EXPECT_TRUE(all_options_notification.small_image().IsEmpty());
301 EXPECT_TRUE(all_options_notification.renotify()); 305 EXPECT_TRUE(all_options_notification.renotify());
302 EXPECT_TRUE(all_options_notification.silent()); 306 EXPECT_TRUE(all_options_notification.silent());
303 EXPECT_TRUE(all_options_notification.never_timeout()); 307 EXPECT_TRUE(all_options_notification.never_timeout());
304 EXPECT_DOUBLE_EQ(kNotificationTimestamp, 308 EXPECT_DOUBLE_EQ(kNotificationTimestamp,
305 all_options_notification.timestamp().ToJsTime()); 309 all_options_notification.timestamp().ToJsTime());
306 EXPECT_EQ(1u, all_options_notification.buttons().size()); 310 EXPECT_EQ(1u, all_options_notification.buttons().size());
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title)); 523 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title));
520 524
521 notification.delegate()->ButtonClick(0); 525 notification.delegate()->ButtonClick(0);
522 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 526 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
523 EXPECT_EQ("action_button_click actionId1", script_result); 527 EXPECT_EQ("action_button_click actionId1", script_result);
524 528
525 notification.delegate()->ButtonClick(1); 529 notification.delegate()->ButtonClick(1);
526 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 530 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
527 EXPECT_EQ("action_button_click actionId2", script_result); 531 EXPECT_EQ("action_button_click actionId2", script_result);
528 } 532 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698