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

Unified Diff: content/test/mock_platform_notification_service.h

Issue 2672313004: Test the platform notification context synchronize operation (Closed)
Patch Set: - Created 3 years, 10 months 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: content/test/mock_platform_notification_service.h
diff --git a/content/shell/browser/layout_test/layout_test_notification_manager.h b/content/test/mock_platform_notification_service.h
similarity index 84%
copy from content/shell/browser/layout_test/layout_test_notification_manager.h
copy to content/test/mock_platform_notification_service.h
index b7108d1aac8ebef67356d55795c472005a040251..29b612defe35c63af0048492794a71d6c5a1e619 100644
--- a/content/shell/browser/layout_test/layout_test_notification_manager.h
+++ b/content/test/mock_platform_notification_service.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_
-#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_
+#ifndef CONTENT_TEST_MOCK_PLATFORM_NOTIFICATION_SERVICE_H_
+#define CONTENT_TEST_MOCK_PLATFORM_NOTIFICATION_SERVICE_H_
#include <stdint.h>
#include <string>
@@ -23,11 +23,11 @@ struct NotificationResources;
struct PlatformNotificationData;
// Responsible for tracking active notifications and allowed origins for the
-// Web Notification API when running layout tests.
-class LayoutTestNotificationManager : public PlatformNotificationService {
+// Web Notification API when running layout and content tests.
+class MockPlatformNotificationService : public PlatformNotificationService {
public:
- LayoutTestNotificationManager();
- ~LayoutTestNotificationManager() override;
+ MockPlatformNotificationService();
+ ~MockPlatformNotificationService() override;
// Simulates a click on the notification titled |title|. |action_index|
// indicates which action was clicked, or -1 if the main notification body was
@@ -71,6 +71,11 @@ class LayoutTestNotificationManager : public PlatformNotificationService {
BrowserContext* browser_context,
std::set<std::string>* displayed_notifications) override;
+ protected:
+ // Checks if |origin| has permission to display notifications. May be called
+ // on both the IO and the UI threads.
+ virtual blink::mojom::PermissionStatus CheckPermission(const GURL& origin);
+
private:
// Structure to represent the information of a persistent notification.
struct PersistentNotification {
@@ -85,10 +90,6 @@ class LayoutTestNotificationManager : public PlatformNotificationService {
// persistent and non-persistent notifications will be considered for this.
void ReplaceNotificationIfNeeded(const std::string& notification_id);
- // Checks if |origin| has permission to display notifications. May be called
- // on both the IO and the UI threads.
- blink::mojom::PermissionStatus CheckPermission(const GURL& origin);
-
std::unordered_map<std::string, PersistentNotification>
persistent_notifications_;
std::unordered_map<std::string, std::unique_ptr<DesktopNotificationDelegate>>
@@ -97,11 +98,11 @@ class LayoutTestNotificationManager : public PlatformNotificationService {
// Mapping of titles to notification ids giving test a usable identifier.
std::unordered_map<std::string, std::string> notification_id_map_;
- base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_;
+ base::WeakPtrFactory<MockPlatformNotificationService> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager);
+ DISALLOW_COPY_AND_ASSIGN(MockPlatformNotificationService);
};
} // content
-#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_
+#endif // CONTENT_TEST_MOCK_PLATFORM_NOTIFICATION_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698