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

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

Issue 2729613006: When navigation focuses a web contents, also activate its window. (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: chrome/browser/notifications/notification_test_util.h
diff --git a/chrome/browser/notifications/notification_test_util.h b/chrome/browser/notifications/notification_test_util.h
index cbd6b82d4c9cc34e7ff68345e8e6b8c736370605..b764bf6ba8d43481b07913dce0c64820c4927c1b 100644
--- a/chrome/browser/notifications/notification_test_util.h
+++ b/chrome/browser/notifications/notification_test_util.h
@@ -12,8 +12,12 @@
#include "base/callback.h"
#include "base/macros.h"
+#include "base/test/scoped_feature_list.h"
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
+#include "chrome/browser/permissions/permission_request_manager.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "components/content_settings/core/common/content_settings.h"
class Browser;
class Profile;
@@ -95,4 +99,70 @@ class FullscreenStateWaiter {
DISALLOW_COPY_AND_ASSIGN(FullscreenStateWaiter);
};
+class MessageCenterChangeObserver {
+ public:
+ MessageCenterChangeObserver();
+ ~MessageCenterChangeObserver();
+
+ bool Wait();
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+
+ DISALLOW_COPY_AND_ASSIGN(MessageCenterChangeObserver);
+};
+
+class NotificationsTest : public InProcessBrowserTest {
+ public:
+ NotificationsTest() {}
+
+ protected:
+ int GetNotificationCount();
+ int GetNotificationPopupCount();
+
+ void CloseBrowserWindow(Browser* browser);
+ void CrashTab(Browser* browser, int index);
+
+ void DenyOrigin(const GURL& origin);
+ void AllowOrigin(const GURL& origin);
+ void AllowAllOrigins();
+ void SetDefaultContentSetting(ContentSetting setting);
+
+ std::string CreateNotification(Browser* browser,
+ bool wait_for_new_balloon,
+ const char* icon,
+ const char* title,
+ const char* body,
+ const char* replace_id,
+ const char* onclick = "");
+ std::string CreateSimpleNotification(Browser* browser,
+ bool wait_for_new_balloon);
+ bool RequestAndAcceptPermission(Browser* browser);
+ bool RequestAndDenyPermission(Browser* browser);
+ bool RequestAndDismissPermission(Browser* browser);
+ bool RequestPermissionAndWait(Browser* browser);
+ bool CancelNotification(const char* notification_id, Browser* browser);
+ void GetPrefsByContentSetting(ContentSetting setting,
+ ContentSettingsForOneType* settings);
+ bool CheckOriginInSetting(const ContentSettingsForOneType& settings,
+ const GURL& origin);
+
+ GURL GetTestPageURLForFile(const std::string& file) const;
+ GURL GetTestPageURL() const;
+ content::WebContents* GetActiveWebContents(Browser* browser);
+
+ protected:
+ void EnableFullscreenNotifications();
+ void DisableFullscreenNotifications();
+
+ private:
+ void DropOriginPreference(const GURL& origin);
+ std::string RequestAndRespondToPermission(
+ Browser* browser,
+ PermissionRequestManager::AutoResponseType bubble_response);
+
+ base::test::ScopedFeatureList feature_list_;
+};
+
#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698