mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-08 08:08:45 +01:00
Add --disable-request-handling-for-testing option
Add a command-line option to bypass request handling in CEF to faciliate debugging of network-related issues.
This commit is contained in:
parent
de46befc18
commit
430895168d
@ -8,10 +8,12 @@
|
|||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/origin_whitelist_impl.h"
|
#include "libcef/browser/origin_whitelist_impl.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/net/scheme_registration.h"
|
#include "libcef/common/net/scheme_registration.h"
|
||||||
#include "libcef/common/net_service/net_service_util.h"
|
#include "libcef/common/net_service/net_service_util.h"
|
||||||
|
|
||||||
#include "base/barrier_closure.h"
|
#include "base/barrier_closure.h"
|
||||||
|
#include "base/command_line.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "components/safe_browsing/core/common/safebrowsing_constants.h"
|
#include "components/safe_browsing/core/common/safebrowsing_constants.h"
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
@ -52,6 +54,14 @@ void CreateProxyHelper(
|
|||||||
std::move(request_handler));
|
std::move(request_handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DisableRequestHandlingForTesting() {
|
||||||
|
static bool disabled([]() -> bool {
|
||||||
|
return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||||
|
switches::kDisableRequestHandlingForTesting);
|
||||||
|
}());
|
||||||
|
return disabled;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// Owns all of the ProxyURLLoaderFactorys for a given BrowserContext. Since
|
// Owns all of the ProxyURLLoaderFactorys for a given BrowserContext. Since
|
||||||
@ -1302,8 +1312,7 @@ void ProxyURLLoaderFactory::CreateLoaderAndStart(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pass_through = false;
|
if (DisableRequestHandlingForTesting()) {
|
||||||
if (pass_through) {
|
|
||||||
// This is the so-called pass-through, no-op option.
|
// This is the so-called pass-through, no-op option.
|
||||||
if (target_factory_) {
|
if (target_factory_) {
|
||||||
target_factory_->CreateLoaderAndStart(std::move(receiver), request_id,
|
target_factory_->CreateLoaderAndStart(std::move(receiver), request_id,
|
||||||
|
@ -129,6 +129,11 @@ const char kDisableChromeLoginPrompt[] = "disable-chrome-login-prompt";
|
|||||||
// Override the product component of the default User-Agent string.
|
// Override the product component of the default User-Agent string.
|
||||||
const char kUserAgentProductAndVersion[] = "user-agent-product";
|
const char kUserAgentProductAndVersion[] = "user-agent-product";
|
||||||
|
|
||||||
|
// Disable request handling in CEF to faciliate debugging of network-related
|
||||||
|
// issues.
|
||||||
|
const char kDisableRequestHandlingForTesting[] =
|
||||||
|
"disable-request-handling-for-testing";
|
||||||
|
|
||||||
#if defined(OS_MAC)
|
#if defined(OS_MAC)
|
||||||
// Path to the framework directory.
|
// Path to the framework directory.
|
||||||
const char kFrameworkDirPath[] = "framework-dir-path";
|
const char kFrameworkDirPath[] = "framework-dir-path";
|
||||||
|
@ -56,6 +56,7 @@ extern const char kDevToolsProtocolLogFile[];
|
|||||||
extern const char kEnableChromeRuntime[];
|
extern const char kEnableChromeRuntime[];
|
||||||
extern const char kDisableChromeLoginPrompt[];
|
extern const char kDisableChromeLoginPrompt[];
|
||||||
extern const char kUserAgentProductAndVersion[];
|
extern const char kUserAgentProductAndVersion[];
|
||||||
|
extern const char kDisableRequestHandlingForTesting[];
|
||||||
|
|
||||||
#if defined(OS_MAC)
|
#if defined(OS_MAC)
|
||||||
extern const char kFrameworkDirPath[];
|
extern const char kFrameworkDirPath[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user