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

Unified Diff: content/shell/browser/layout_test/layout_test_notification_manager.h

Issue 789523002: Enable writing layout tests for persistent notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-sw-contentclient-persistent
Patch Set: rebase Created 6 years 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
« no previous file with comments | « no previous file | content/shell/browser/layout_test/layout_test_notification_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/layout_test/layout_test_notification_manager.h
diff --git a/content/shell/browser/layout_test/layout_test_notification_manager.h b/content/shell/browser/layout_test/layout_test_notification_manager.h
index 7792a7a108e7c9cb5a5fe9ce6e5280c7698fd119..db6525a0819401209fca545f379e90ce1189cde5 100644
--- a/content/shell/browser/layout_test/layout_test_notification_manager.h
+++ b/content/shell/browser/layout_test/layout_test_notification_manager.h
@@ -11,12 +11,12 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/platform_notification_service.h"
+#include "content/public/common/show_desktop_notification_params.h"
#include "third_party/WebKit/public/platform/WebNotificationPermission.h"
#include "url/gurl.h"
namespace content {
-struct ShowDesktopNotificationHostMsgParams;
class DesktopNotificationDelegate;
// Responsible for tracking active notifications and allowed origins for the
@@ -66,11 +66,27 @@ class LayoutTestNotificationManager : public PlatformNotificationService {
// Closes the notification titled |title|. Must be called on the UI thread.
void Close(const std::string& title);
- typedef std::map<GURL, blink::WebNotificationPermission>
- NotificationPermissionMap;
- NotificationPermissionMap permission_map_;
+ // Fakes replacing the notification identified by |params| when it has a tag
+ // and a previous notification has been displayed using the same tag. All
+ // notifications, both page and persistent ones, will be considered for this.
+ void ReplaceNotificationIfNeeded(
+ const ShowDesktopNotificationHostMsgParams& params);
+
+ // Structure to represent the information of a persistent notification.
+ struct PersistentNotification {
+ PersistentNotification();
+
+ BrowserContext* browser_context;
+ int64 service_worker_registration_id;
+ ShowDesktopNotificationHostMsgParams notification_data;
+ std::string persistent_id;
+ };
+
+ std::map<GURL, blink::WebNotificationPermission> permission_map_;
+
+ std::map<std::string, DesktopNotificationDelegate*> page_notifications_;
+ std::map<std::string, PersistentNotification> persistent_notifications_;
- std::map<std::string, DesktopNotificationDelegate*> notifications_;
std::map<std::string, std::string> replacements_;
base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_;
« no previous file with comments | « no previous file | content/shell/browser/layout_test/layout_test_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698