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

Unified Diff: chrome/browser/notifications/stub_notification_center_mac.h

Issue 2458703003: Create a stub NSUserNotificationCenter and make tests use it. (Closed)
Patch Set: Robert's review Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/stub_notification_center_mac.h
diff --git a/chrome/browser/notifications/stub_notification_center_mac.h b/chrome/browser/notifications/stub_notification_center_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..f817d5d8cabb0bb223226ae5293df4b06c565978
--- /dev/null
+++ b/chrome/browser/notifications/stub_notification_center_mac.h
@@ -0,0 +1,25 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_CENTER_MAC_H_
+#define CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_CENTER_MAC_H_
+
+#import <AppKit/AppKit.h>
+
+@class NSUserNotificationCenterDelegate;
Robert Sesek 2016/11/01 17:09:01 Not needed with AppKit.h?
Miguel Garcia 2016/11/07 14:18:41 Peter asked the same thing. I swear it does not co
Robert Sesek 2016/11/07 16:16:50 Oh, try Cocoa/Cocoa.h instead. NSUserNotificationC
Miguel Garcia 2016/11/07 18:22:25 Done, (NSUserNotificationCenterDelegate is a proto
+
+// Stubs NSUserNotificationCenter so it can be used in tests without actually
+// displaying
+// notifications.
Robert Sesek 2016/11/01 17:09:01 Join with previous line.
Miguel Garcia 2016/11/07 14:18:41 Done.
+// Unlike the real class this is not a singleton and the lifecycle needs to be
+// handled
+// by the caller.
Robert Sesek 2016/11/01 17:09:01 Join with previous line.
Miguel Garcia 2016/11/07 14:18:41 Done.
+// See notification_platform_bridge_mac_unittest.mm for an example.
+@interface StubNotificationCenter : NSUserNotificationCenter
+- (instancetype)init;
+- (void)setDelegate:(NSUserNotificationCenterDelegate*)delegate;
+
+@end
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_CENTER_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698