| 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/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 [builder setSubTitle:@"https://www.miguel.com"]; | 47 [builder setSubTitle:@"https://www.miguel.com"]; |
| 48 [builder setOrigin:@"https://www.miguel.com/"]; | 48 [builder setOrigin:@"https://www.miguel.com/"]; |
| 49 [builder setContextMessage:@""]; | 49 [builder setContextMessage:@""]; |
| 50 [builder setButtons:@"Button1" secondaryButton:@"Button2"]; | 50 [builder setButtons:@"Button1" secondaryButton:@"Button2"]; |
| 51 [builder setTag:@"tag1"]; | 51 [builder setTag:@"tag1"]; |
| 52 [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]]; | 52 [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]]; |
| 53 [builder setNotificationId:@"notification_id"]; | 53 [builder setNotificationId:@"notification_id"]; |
| 54 [builder setProfileId:@"profile_id"]; | 54 [builder setProfileId:@"profile_id"]; |
| 55 [builder setIncognito:false]; | 55 [builder setIncognito:false]; |
| 56 [builder setNotificationType:@(NotificationCommon::PERSISTENT)]; | 56 [builder setNotificationType:@(NotificationCommon::PERSISTENT)]; |
| 57 [builder setShowSettingsButton:true]; |
| 57 | 58 |
| 58 return [builder buildUserNotification]; | 59 return [builder buildUserNotification]; |
| 59 } | 60 } |
| 60 | 61 |
| 61 static void StoreNotificationCount( | 62 static void StoreNotificationCount( |
| 62 int* out_notification_count, | 63 int* out_notification_count, |
| 63 std::unique_ptr<std::set<std::string>> notifications, | 64 std::unique_ptr<std::set<std::string>> notifications, |
| 64 bool supports_synchronization) { | 65 bool supports_synchronization) { |
| 65 DCHECK(out_notification_count); | 66 DCHECK(out_notification_count); |
| 66 DCHECK(notifications); | 67 DCHECK(notifications); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 bridge->Display(NotificationCommon::PERSISTENT, "notification_id2", | 386 bridge->Display(NotificationCommon::PERSISTENT, "notification_id2", |
| 386 "profile_id", false, *alert); | 387 "profile_id", false, *alert); |
| 387 EXPECT_EQ(1u, [[notification_center() deliveredNotifications] count]); | 388 EXPECT_EQ(1u, [[notification_center() deliveredNotifications] count]); |
| 388 EXPECT_EQ(1u, [[alert_dispatcher() alerts] count]); | 389 EXPECT_EQ(1u, [[alert_dispatcher() alerts] count]); |
| 389 } | 390 } |
| 390 | 391 |
| 391 // The destructor of the bridge should close all notifications. | 392 // The destructor of the bridge should close all notifications. |
| 392 EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); | 393 EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); |
| 393 EXPECT_EQ(0u, [[alert_dispatcher() alerts] count]); | 394 EXPECT_EQ(0u, [[alert_dispatcher() alerts] count]); |
| 394 } | 395 } |
| OLD | NEW |