OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_INTERACTIVE_UITEST_SUPPORT_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_INTERACTIVE_UITEST_SUPPORT_H_ |
| 7 |
| 8 #include "base/test/scoped_feature_list.h" |
| 9 #include "chrome/browser/permissions/permission_request_manager.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" |
| 11 #include "components/content_settings/core/common/content_settings.h" |
| 12 |
| 13 class MessageCenterChangeObserver { |
| 14 public: |
| 15 MessageCenterChangeObserver(); |
| 16 ~MessageCenterChangeObserver(); |
| 17 |
| 18 bool Wait(); |
| 19 |
| 20 private: |
| 21 class Impl; |
| 22 std::unique_ptr<Impl> impl_; |
| 23 |
| 24 DISALLOW_COPY_AND_ASSIGN(MessageCenterChangeObserver); |
| 25 }; |
| 26 |
| 27 class NotificationsTest : public InProcessBrowserTest { |
| 28 public: |
| 29 NotificationsTest() {} |
| 30 |
| 31 protected: |
| 32 int GetNotificationCount(); |
| 33 int GetNotificationPopupCount(); |
| 34 |
| 35 void CloseBrowserWindow(Browser* browser); |
| 36 void CrashTab(Browser* browser, int index); |
| 37 |
| 38 void DenyOrigin(const GURL& origin); |
| 39 void AllowOrigin(const GURL& origin); |
| 40 void AllowAllOrigins(); |
| 41 void SetDefaultContentSetting(ContentSetting setting); |
| 42 |
| 43 std::string CreateNotification(Browser* browser, |
| 44 bool wait_for_new_balloon, |
| 45 const char* icon, |
| 46 const char* title, |
| 47 const char* body, |
| 48 const char* replace_id, |
| 49 const char* onclick = ""); |
| 50 std::string CreateSimpleNotification(Browser* browser, |
| 51 bool wait_for_new_balloon); |
| 52 bool RequestAndAcceptPermission(Browser* browser); |
| 53 bool RequestAndDenyPermission(Browser* browser); |
| 54 bool RequestAndDismissPermission(Browser* browser); |
| 55 bool RequestPermissionAndWait(Browser* browser); |
| 56 bool CancelNotification(const char* notification_id, Browser* browser); |
| 57 void GetPrefsByContentSetting(ContentSetting setting, |
| 58 ContentSettingsForOneType* settings); |
| 59 bool CheckOriginInSetting(const ContentSettingsForOneType& settings, |
| 60 const GURL& origin); |
| 61 |
| 62 GURL GetTestPageURLForFile(const std::string& file) const; |
| 63 GURL GetTestPageURL() const; |
| 64 content::WebContents* GetActiveWebContents(Browser* browser); |
| 65 |
| 66 protected: |
| 67 void EnableFullscreenNotifications(); |
| 68 void DisableFullscreenNotifications(); |
| 69 |
| 70 private: |
| 71 void DropOriginPreference(const GURL& origin); |
| 72 std::string RequestAndRespondToPermission( |
| 73 Browser* browser, |
| 74 PermissionRequestManager::AutoResponseType bubble_response); |
| 75 |
| 76 base::test::ScopedFeatureList feature_list_; |
| 77 }; |
| 78 |
| 79 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_INTERACTIVE_UITEST_SUPPORT_
H_ |
OLD | NEW |