| 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 25ce88f2cef5425a6c0f57cc5a93cef463dd5e32..790053badd1bb331feedb20ccc4bc867f1b0a76e 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>
|
| @@ -17,7 +17,7 @@
|
| #include "url/gurl.h"
|
|
|
| namespace base {
|
| -class NullableString16;
|
| + class NullableString16;
|
| }
|
|
|
| namespace content {
|
| @@ -27,11 +27,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
|
| @@ -75,6 +75,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 {
|
| @@ -89,10 +94,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>>
|
| @@ -101,11 +102,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_
|
|
|