| OLD | NEW |
| 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 EXPECT_EQ(1u, [[notification_center() deliveredNotifications] count]); | 415 EXPECT_EQ(1u, [[notification_center() deliveredNotifications] count]); |
| 416 EXPECT_EQ(1u, [[alert_dispatcher() alerts] count]); | 416 EXPECT_EQ(1u, [[alert_dispatcher() alerts] count]); |
| 417 } | 417 } |
| 418 | 418 |
| 419 // The destructor of the bridge should close all notifications. | 419 // The destructor of the bridge should close all notifications. |
| 420 EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); | 420 EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); |
| 421 EXPECT_EQ(0u, [[alert_dispatcher() alerts] count]); | 421 EXPECT_EQ(0u, [[alert_dispatcher() alerts] count]); |
| 422 } | 422 } |
| 423 | 423 |
| 424 TEST_F(NotificationPlatformBridgeMacTest, TestDisplayETLDPlusOne) { | 424 TEST_F(NotificationPlatformBridgeMacTest, TestDisplayETLDPlusOne) { |
| 425 std::unique_ptr<Notification> notification = | 425 std::unique_ptr<Notification> notification = CreateBanner( |
| 426 CreateBanner("Title", "Context", "https://hello.world.test.co.uk", | 426 "Title", "Context", "https://overthelimit.hello.world.test.co.uk", |
| 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 bridge->Display(NotificationCommon::PERSISTENT, "notification_id2", | 437 bridge->Display(NotificationCommon::PERSISTENT, "notification_id2", |
| (...skipping 29 matching lines...) Expand all Loading... |
| 467 EXPECT_NSEQ(@"mail.appspot.com", [delivered_notification subtitle]); | 467 EXPECT_NSEQ(@"mail.appspot.com", [delivered_notification subtitle]); |
| 468 delivered_notification = [notifications objectAtIndex:2]; | 468 delivered_notification = [notifications objectAtIndex:2]; |
| 469 EXPECT_NSEQ(@"tests.peter.sh", [delivered_notification subtitle]); | 469 EXPECT_NSEQ(@"tests.peter.sh", [delivered_notification subtitle]); |
| 470 delivered_notification = [notifications objectAtIndex:3]; | 470 delivered_notification = [notifications objectAtIndex:3]; |
| 471 EXPECT_NSEQ(@"peter.sh", [delivered_notification subtitle]); | 471 EXPECT_NSEQ(@"peter.sh", [delivered_notification subtitle]); |
| 472 delivered_notification = [notifications objectAtIndex:4]; | 472 delivered_notification = [notifications objectAtIndex:4]; |
| 473 EXPECT_NSEQ(@"localhost:8080", [delivered_notification subtitle]); | 473 EXPECT_NSEQ(@"localhost:8080", [delivered_notification subtitle]); |
| 474 delivered_notification = [notifications objectAtIndex:5]; | 474 delivered_notification = [notifications objectAtIndex:5]; |
| 475 EXPECT_NSEQ(@"93.186.186.172", [delivered_notification subtitle]); | 475 EXPECT_NSEQ(@"93.186.186.172", [delivered_notification subtitle]); |
| 476 } | 476 } |
| OLD | NEW |