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

Unified Diff: content/shell/shell_url_request_context_getter.cc

Issue 11053007: Make content shell support some testing flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove switch from chrome_switches.h and add CONTENT_EXPORT Created 8 years, 2 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 | « content/shell/shell_url_request_context_getter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/shell_url_request_context_getter.cc
diff --git a/content/shell/shell_url_request_context_getter.cc b/content/shell/shell_url_request_context_getter.cc
index b8a6f03f483daa35956892dd848d5864a307839c..f612fa56a61f9e4d043da2a31e1daf151306c072 100644
--- a/content/shell/shell_url_request_context_getter.cc
+++ b/content/shell/shell_url_request_context_getter.cc
@@ -6,13 +6,16 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/threading/worker_pool.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/common/content_switches.h"
#include "content/shell/shell_network_delegate.h"
#include "net/base/cert_verifier.h"
#include "net/base/default_server_bound_cert_store.h"
#include "net/base/host_resolver.h"
+#include "net/base/mapped_host_resolver.h"
#include "net/base/server_bound_cert_service.h"
#include "net/base/ssl_config_service_defaults.h"
#include "net/cookies/cookie_monster.h"
@@ -54,6 +57,8 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (!url_request_context_.get()) {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+
url_request_context_.reset(new net::URLRequestContext());
network_delegate_.reset(new ShellNetworkDelegate);
url_request_context_->set_network_delegate(network_delegate_.get());
@@ -111,6 +116,25 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
url_request_context_->http_server_properties();
network_session_params.ignore_certificate_errors =
ignore_certificate_errors_;
+ if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
+ int value;
+ base::StringToInt(command_line.GetSwitchValueASCII(
+ switches::kTestingFixedHttpPort), &value);
+ network_session_params.testing_fixed_http_port = value;
+ }
+ if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
+ int value;
+ base::StringToInt(command_line.GetSwitchValueASCII(
+ switches::kTestingFixedHttpsPort), &value);
+ network_session_params.testing_fixed_https_port = value;
+ }
+ if (command_line.HasSwitch(switches::kHostResolverRules)) {
+ mapped_host_resolver_.reset(
+ new net::MappedHostResolver(network_session_params.host_resolver));
szym 2012/10/10 17:21:04 IMPORTANT: this will cause double-free! The Mapped
+ mapped_host_resolver_->SetRulesFromString(
+ command_line.GetSwitchValueASCII(switches::kHostResolverRules));
+ network_session_params.host_resolver = mapped_host_resolver_.get();
+ }
net::HttpCache* main_cache = new net::HttpCache(
network_session_params, main_backend);
« no previous file with comments | « content/shell/shell_url_request_context_getter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698