| Index: chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm
|
| diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm b/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm
|
| index 84ed1b17b6771aab4941db1d1ab88c1ff35c06d5..f9b0a665f1db9fe148908e82262bb4ec5213dac4 100644
|
| --- a/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm
|
| +++ b/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm
|
| @@ -132,8 +132,8 @@ TEST_F(NotificationPlatformBridgeMacTest, TestDisplayNoButtons) {
|
| [[toast actionButtonTitle] isEqualToString:@"Settings"] &&
|
| [[toast otherButtonTitle] isEqualToString:@"Close"];
|
| }]];
|
| - bridge->Display(NotificationCommon::PERSISTENT,
|
| - "notification_id", "profile_id", false, *notification);
|
| + bridge->Display(NotificationCommon::PERSISTENT, "notification_id",
|
| + "profile_id", false, *notification);
|
| [notificationCenter verify];
|
| }
|
|
|
| @@ -155,7 +155,59 @@ TEST_F(NotificationPlatformBridgeMacTest, TestDisplayOneButton) {
|
| [[toast actionButtonTitle] isEqualToString:@"Options"] &&
|
| [[toast otherButtonTitle] isEqualToString:@"Close"];
|
| }]];
|
| - bridge->Display(NotificationCommon::PERSISTENT,
|
| - "notification_id", "profile_id", false, *notification);
|
| + bridge->Display(NotificationCommon::PERSISTENT, "notification_id",
|
| + "profile_id", false, *notification);
|
| + [notificationCenter verify];
|
| +}
|
| +
|
| +// FAILURE: Uses a nice mock instead of a mock which *should* not
|
| +// not care about uncalled methods.
|
| +// Crashes with : *** -[NSProxy doesNotRecognizeSelector:setDelegate:] called!
|
| +TEST_F(NotificationPlatformBridgeMacTest, TestDisplayNiceMock) {
|
| + std::unique_ptr<Notification> notification =
|
| + NotificationGenerator::CreateNotification(
|
| + "Title", "Context", "https://gmail.com", "Button 1", "",
|
| + message_center::NOTIFICATION_TYPE_SIMPLE);
|
| +
|
| + id notificationCenter =
|
| + [OCMockObject niceMockForClass:[NSUserNotificationCenter class]];
|
| + NotificationPlatformBridgeMac* bridge =
|
| + new NotificationPlatformBridgeMac(notificationCenter);
|
| + [[notificationCenter expect]
|
| + deliverNotification:[OCMArg checkWithBlock:^BOOL(id toast) {
|
| + return [[toast title] isEqualToString:@"Title"] &&
|
| + [[toast informativeText] isEqualToString:@"Context"] &&
|
| + [[toast subtitle] isEqualToString:@"https://gmail.com"] &&
|
| + [[toast actionButtonTitle] isEqualToString:@"Options"] &&
|
| + [[toast otherButtonTitle] isEqualToString:@"Close"];
|
| + }]];
|
| + bridge->Display(NotificationCommon::PERSISTENT, "notification_id",
|
| + "profile_id", false, *notification);
|
| + [notificationCenter verify];
|
| +}
|
| +
|
| +// Close: Set the property as if it was a method.
|
| +// Fails with
|
| +// [NSProxy doesNotRecognizeSelector:deliveredNotifications] called!
|
| +TEST_F(NotificationPlatformBridgeMacTest, TestCloseOneWay) {
|
| + id notificationCenter =
|
| + [OCMockObject niceMockForClass:[NSUserNotificationCenter class]];
|
| + NotificationPlatformBridgeMac* bridge =
|
| + new NotificationPlatformBridgeMac(notificationCenter, false);
|
| + [[notificationCenter expect] deliveredNotifications];
|
| + bridge->Close("profile_id", "notification_id");
|
| + [notificationCenter verify];
|
| +}
|
| +
|
| +// Close: Set the property as a key value pair in the documentation.
|
| +// Fails with
|
| +// [NSProxy doesNotRecognizeSelector:deliveredNotifications] called!
|
| +TEST_F(NotificationPlatformBridgeMacTest, TestCloseAnotherWay) {
|
| + id notificationCenter =
|
| + [OCMockObject niceMockForClass:[NSUserNotificationCenter class]];
|
| + NotificationPlatformBridgeMac* bridge =
|
| + new NotificationPlatformBridgeMac(notificationCenter, false);
|
| + [[(id)notificationCenter expect] deliveredNotifications];
|
| + bridge->Close("profile_id", "notification_id");
|
| [notificationCenter verify];
|
| }
|
|
|