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

Side by Side Diff: chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm

Issue 2882663002: Only resort to etl+1 when the full domain does not fit. (Closed)
Patch Set: Created 3 years, 7 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/notification_platform_bridge_mac.mm ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import <AppKit/AppKit.h> 5 #import <AppKit/AppKit.h>
6 #import <objc/runtime.h> 6 #import <objc/runtime.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/i18n/number_formatting.h" 9 #include "base/i18n/number_formatting.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 "Button 1", nullptr); 427 "Button 1", nullptr);
428 428
429 std::unique_ptr<NotificationPlatformBridgeMac> bridge( 429 std::unique_ptr<NotificationPlatformBridgeMac> bridge(
430 new NotificationPlatformBridgeMac(notification_center(), 430 new NotificationPlatformBridgeMac(notification_center(),
431 alert_dispatcher())); 431 alert_dispatcher()));
432 bridge->Display(NotificationCommon::PERSISTENT, "notification_id1", 432 bridge->Display(NotificationCommon::PERSISTENT, "notification_id1",
433 "profile_id", false, *notification); 433 "profile_id", false, *notification);
434 434
435 notification = CreateBanner("Title", "Context", "https://mail.appspot.com", 435 notification = CreateBanner("Title", "Context", "https://mail.appspot.com",
436 "Button 1", nullptr); 436 "Button 1", nullptr);
437
438 bridge->Display(NotificationCommon::PERSISTENT, "notification_id2", 437 bridge->Display(NotificationCommon::PERSISTENT, "notification_id2",
439 "profile_id", false, *notification); 438 "profile_id", false, *notification);
439
440 notification = CreateBanner("Title", "Context", "https://tests.peter.sh", 440 notification = CreateBanner("Title", "Context", "https://tests.peter.sh",
441 "Button 1", nullptr); 441 "Button 1", nullptr);
442 bridge->Display(NotificationCommon::PERSISTENT, "notification_id3",
443 "profile_id", false, *notification);
442 444
443 bridge->Display(NotificationCommon::PERSISTENT, "notification_id3", 445 notification = CreateBanner(
446 "Title", "Context",
447 "https://somereallylongsubdomainthatactuallyisanaliasfortests.peter.sh/",
448 "Button 1", nullptr);
449 bridge->Display(NotificationCommon::PERSISTENT, "notification_id4",
444 "profile_id", false, *notification); 450 "profile_id", false, *notification);
445 451
446 notification = CreateBanner("Title", "Context", "http://localhost:8080", 452 notification = CreateBanner("Title", "Context", "http://localhost:8080",
447 "Button 1", nullptr); 453 "Button 1", nullptr);
448 454 bridge->Display(NotificationCommon::PERSISTENT, "notification_id5",
449 bridge->Display(NotificationCommon::PERSISTENT, "notification_id4",
450 "profile_id", false, *notification); 455 "profile_id", false, *notification);
451 456
452 notification = CreateBanner("Title", "Context", "https://93.186.186.172", 457 notification = CreateBanner("Title", "Context", "https://93.186.186.172",
453 "Button 1", nullptr); 458 "Button 1", nullptr);
454 459 bridge->Display(NotificationCommon::PERSISTENT, "notification_id6",
455 bridge->Display(NotificationCommon::PERSISTENT, "notification_id5",
456 "profile_id", false, *notification); 460 "profile_id", false, *notification);
457 461
458 NSArray* notifications = [notification_center() deliveredNotifications]; 462 NSArray* notifications = [notification_center() deliveredNotifications];
459 EXPECT_EQ(5u, [notifications count]); 463 EXPECT_EQ(6u, [notifications count]);
460 NSUserNotification* delivered_notification = [notifications objectAtIndex:0]; 464 NSUserNotification* delivered_notification = [notifications objectAtIndex:0];
461 EXPECT_NSEQ(@"test.co.uk", [delivered_notification subtitle]); 465 EXPECT_NSEQ(@"test.co.uk", [delivered_notification subtitle]);
462 delivered_notification = [notifications objectAtIndex:1]; 466 delivered_notification = [notifications objectAtIndex:1];
463 EXPECT_NSEQ(@"mail.appspot.com", [delivered_notification subtitle]); 467 EXPECT_NSEQ(@"mail.appspot.com", [delivered_notification subtitle]);
464 delivered_notification = [notifications objectAtIndex:2]; 468 delivered_notification = [notifications objectAtIndex:2];
469 EXPECT_NSEQ(@"tests.peter.sh", [delivered_notification subtitle]);
470 delivered_notification = [notifications objectAtIndex:3];
465 EXPECT_NSEQ(@"peter.sh", [delivered_notification subtitle]); 471 EXPECT_NSEQ(@"peter.sh", [delivered_notification subtitle]);
466 delivered_notification = [notifications objectAtIndex:3]; 472 delivered_notification = [notifications objectAtIndex:4];
467 EXPECT_NSEQ(@"localhost:8080", [delivered_notification subtitle]); 473 EXPECT_NSEQ(@"localhost:8080", [delivered_notification subtitle]);
468 delivered_notification = [notifications objectAtIndex:4]; 474 delivered_notification = [notifications objectAtIndex:5];
469 EXPECT_NSEQ(@"93.186.186.172", [delivered_notification subtitle]); 475 EXPECT_NSEQ(@"93.186.186.172", [delivered_notification subtitle]);
470 } 476 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_platform_bridge_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698