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

Unified Diff: chrome/browser/ui/website_settings/permission_bubble_manager.h

Issue 1154943008: Update push messaging tests to use both infobars and bubbles (w/ autoresponse) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from msw Created 5 years, 6 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/ui/website_settings/permission_bubble_manager.h
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.h b/chrome/browser/ui/website_settings/permission_bubble_manager.h
index 1c624b66f09a130df079e6db52d8a8e68d2960e0..72366d3d9d80320bd4cb6388c79d8fe2daf9337b 100644
--- a/chrome/browser/ui/website_settings/permission_bubble_manager.h
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager.h
@@ -30,6 +30,13 @@ class PermissionBubbleManager
public content::WebContentsUserData<PermissionBubbleManager>,
public PermissionBubbleView::Delegate {
public:
+ enum AutoResponseType {
+ NONE,
+ ACCEPT_ALL,
+ DENY_ALL,
+ DISMISS
+ };
+
// Return the enabled state of permissions bubbles.
// Controlled by a flag and FieldTrial.
static bool Enabled();
@@ -64,6 +71,14 @@ class PermissionBubbleManager
// comes in with a user gesture.
void RequireUserGesture(bool required);
+ // Do NOT use this methods in production code. Use this methods in browser
+ // tests that need to accept or deny permissions when requested in
+ // JavaScript. Your test needs to set this appropriately, and then the bubble
+ // will proceed as desired as soon as Show() is called.
+ void set_auto_response_for_test(AutoResponseType response) {
+ auto_response_for_test_ = response;
+ }
+
private:
friend class DownloadRequestLimiterTest;
friend class GeolocationBrowserTest;
@@ -119,6 +134,8 @@ class PermissionBubbleManager
bool HasUserGestureRequest(
const std::vector<PermissionBubbleRequest*>& queue);
+ void DoAutoResponseForTesting();
+
// Whether to delay displaying the bubble until a request with a user gesture.
// False by default, unless RequireUserGesture(bool) changes the value.
bool require_user_gesture_;
@@ -140,6 +157,8 @@ class PermissionBubbleManager
std::vector<bool> accept_states_;
+ AutoResponseType auto_response_for_test_;
+
base::WeakPtrFactory<PermissionBubbleManager> weak_factory_;
};

Powered by Google App Engine
This is Rietveld 408576698