Commit 7c1ef68c authored by Timothy Loh's avatar Timothy Loh Committed by Commit Bot

Add --deny-permission-prompts switch for suppressing permission prompts

This patch adds a command-line switch, --deny-permission-prompts, which
will suppress all permission prompts. This is intended for testing
purposes, where prompts (in particular modal prompts on Android) may
be irrelevant to but get in the way of tests. This is necessary for
telemetry tests, which currently fallback to infobar prompts on Android.

Bug: 762335
Change-Id: I6ad36b81ce6404da2c5e141b5fdca2692f37af35
Reviewed-on: https://chromium-review.googlesource.com/773768
Commit-Queue: Timothy Loh <timloh@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517260}
parent 56e0c61a
......@@ -145,6 +145,13 @@ PermissionRequestManager::~PermissionRequestManager() {
void PermissionRequestManager::AddRequest(PermissionRequest* request) {
DCHECK(!vr::VrTabHelper::IsInVr(web_contents()));
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDenyPermissionPrompts)) {
request->PermissionDenied();
request->RequestFinished();
return;
}
// TODO(tsergeant): change the UMA to no longer mention bubbles.
base::RecordAction(base::UserMetricsAction("PermissionBubbleRequest"));
......
......@@ -162,6 +162,10 @@ const char kDebugEnableFrameToggle[] = "debug-enable-frame-toggle";
// apps.
const char kDebugPackedApps[] = "debug-packed-apps";
// Prevents permission prompts from appearing by denying instead of showing
// prompts.
const char kDenyPermissionPrompts[] = "deny-permission-prompts";
// Passes command line parameters to the DevTools front-end.
const char kDevToolsFlags[] = "devtools-flags";
......
......@@ -65,6 +65,7 @@ extern const char kCreateBrowserOnStartupForTests[];
extern const char kCustomDevtoolsFrontend[];
extern const char kDebugEnableFrameToggle[];
extern const char kDebugPackedApps[];
extern const char kDenyPermissionPrompts[];
extern const char kDevToolsFlags[];
extern const char kDiagnostics[];
extern const char kDiagnosticsFormat[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment