mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02: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:
@@ -8,10 +8,12 @@
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/origin_whitelist_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/net/scheme_registration.h"
|
||||
#include "libcef/common/net_service/net_service_util.h"
|
||||
|
||||
#include "base/barrier_closure.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "components/safe_browsing/core/common/safebrowsing_constants.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
@@ -52,6 +54,14 @@ void CreateProxyHelper(
|
||||
std::move(request_handler));
|
||||
}
|
||||
|
||||
bool DisableRequestHandlingForTesting() {
|
||||
static bool disabled([]() -> bool {
|
||||
return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisableRequestHandlingForTesting);
|
||||
}());
|
||||
return disabled;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// Owns all of the ProxyURLLoaderFactorys for a given BrowserContext. Since
|
||||
@@ -1302,8 +1312,7 @@ void ProxyURLLoaderFactory::CreateLoaderAndStart(
|
||||
return;
|
||||
}
|
||||
|
||||
bool pass_through = false;
|
||||
if (pass_through) {
|
||||
if (DisableRequestHandlingForTesting()) {
|
||||
// This is the so-called pass-through, no-op option.
|
||||
if (target_factory_) {
|
||||
target_factory_->CreateLoaderAndStart(std::move(receiver), request_id,
|
||||
|
Reference in New Issue
Block a user