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

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

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
« no previous file with comments | « chrome/browser/ui/website_settings/permission_bubble_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/website_settings/permission_bubble_manager.cc
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.cc b/chrome/browser/ui/website_settings/permission_bubble_manager.cc
index b8a53e5f08765fb3e7b7617707defa9c23b538b6..03051d613117afca83df390ed890aedfe6c3ab2a 100644
--- a/chrome/browser/ui/website_settings/permission_bubble_manager.cc
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager.cc
@@ -78,12 +78,14 @@ bool PermissionBubbleManager::Enabled() {
PermissionBubbleManager::PermissionBubbleManager(
content::WebContents* web_contents)
- : content::WebContentsObserver(web_contents),
- require_user_gesture_(false),
- bubble_showing_(false),
- view_(NULL),
- request_url_has_loaded_(false),
- weak_factory_(this) {}
+ : content::WebContentsObserver(web_contents),
+ require_user_gesture_(false),
+ bubble_showing_(false),
+ view_(NULL),
+ request_url_has_loaded_(false),
+ auto_response_for_test_(NONE),
+ weak_factory_(this) {
+}
PermissionBubbleManager::~PermissionBubbleManager() {
if (view_ != NULL)
@@ -346,6 +348,10 @@ void PermissionBubbleManager::TriggerShowBubble() {
// case we may do in-line calling of finalization.
bubble_showing_ = true;
view_->Show(requests_, accept_states_);
+
+ // If in testing mode, automatically respond to the bubble that was shown.
+ if (auto_response_for_test_ != NONE)
+ DoAutoResponseForTesting();
}
void PermissionBubbleManager::FinalizeBubble() {
@@ -414,3 +420,18 @@ bool PermissionBubbleManager::HasUserGestureRequest(
return false;
}
+void PermissionBubbleManager::DoAutoResponseForTesting() {
+ switch (auto_response_for_test_) {
+ case ACCEPT_ALL:
+ Accept();
+ break;
+ case DENY_ALL:
+ Deny();
+ break;
+ case DISMISS:
+ Closing();
+ break;
+ case NONE:
+ NOTREACHED();
+ }
+}
« no previous file with comments | « chrome/browser/ui/website_settings/permission_bubble_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698