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

Unified Diff: webkit/tools/test_shell/test_shell_request_context.cc

Issue 10918279: Provide mutable members of UrlRequestContext via pure-virtual interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address erikwright's second round of comments. Created 8 years, 3 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
Index: webkit/tools/test_shell/test_shell_request_context.cc
diff --git a/webkit/tools/test_shell/test_shell_request_context.cc b/webkit/tools/test_shell/test_shell_request_context.cc
index 80ce41074c7af77fd26b83636c38a36a1bcf40eb..1eba3282ee4845fb7a5a36f2ba345b250ff84aa7 100644
--- a/webkit/tools/test_shell/test_shell_request_context.cc
+++ b/webkit/tools/test_shell/test_shell_request_context.cc
@@ -34,6 +34,22 @@
#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
#include "webkit/user_agent/user_agent.h"
+class TestShellHttpUserAgentSettings
+ : public net::ConstHttpAcceptLanguageAndCharset {
mmenke 2012/09/26 16:28:20 4-space indent
+ public:
+ TestShellHttpUserAgentSettings()
+ // hard-code A-L and A-C for test shells
+ : ConstHttpAcceptLanguageAndCharset("en-us,en", "iso-8859-1,*,utf-8") {}
+ virtual ~TestShellHttpUserAgentSettings() {}
+
+ virtual const std::string& GetUserAgent(const GURL& url) OVERRIDE {
+ return webkit_glue::GetUserAgent(url);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestShellHttpUserAgentSettings);
+};
+
TestShellRequestContext::TestShellRequestContext()
: ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) {
Init(FilePath(), net::HttpCache::NORMAL, false);
@@ -56,9 +72,7 @@ void TestShellRequestContext::Init(
new net::DefaultServerBoundCertStore(NULL),
base::WorkerPool::GetTaskRunner(true)));
- // hard-code A-L and A-C for test shells
- set_accept_language("en-us,en");
- set_accept_charset("iso-8859-1,*,utf-8");
+ storage_.set_http_user_agent_settings(new TestShellHttpUserAgentSettings);
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Use no proxy to avoid ProxyConfigServiceLinux.
@@ -134,8 +148,3 @@ void TestShellRequestContext::Init(
TestShellRequestContext::~TestShellRequestContext() {
}
-
-const std::string& TestShellRequestContext::GetUserAgent(
- const GURL& url) const {
- return webkit_glue::GetUserAgent(url);
-}

Powered by Google App Engine
This is Rietveld 408576698