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

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: Disable test for chrome_frame_net_tests Created 8 years, 1 month 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 | « webkit/tools/test_shell/test_shell_request_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0ab98393f94b0bab9a08be5a19e7e1b40bf96dac..d15ea1280db64688f8e96aae9277cef64c589e8f 100644
--- a/webkit/tools/test_shell/test_shell_request_context.cc
+++ b/webkit/tools/test_shell/test_shell_request_context.cc
@@ -23,6 +23,7 @@
#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_service.h"
+#include "net/url_request/http_user_agent_settings.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h"
@@ -34,6 +35,27 @@
#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
#include "webkit/user_agent/user_agent.h"
+class TestShellHttpUserAgentSettings : public net::HttpUserAgentSettings {
+ public:
+ TestShellHttpUserAgentSettings() {}
+ virtual ~TestShellHttpUserAgentSettings() {}
+
+ // hard-code A-L and A-C for test shells
+ virtual std::string GetAcceptLanguage() const OVERRIDE {
+ return "en-us,en";
+ }
+ virtual std::string GetAcceptCharset() const OVERRIDE {
+ return "iso-8859-1,*,utf-8";
+ }
+
+ virtual std::string GetUserAgent(const GURL& url) const 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 +78,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.
@@ -132,8 +152,3 @@ void TestShellRequestContext::Init(
TestShellRequestContext::~TestShellRequestContext() {
}
-
-const std::string& TestShellRequestContext::GetUserAgent(
- const GURL& url) const {
- return webkit_glue::GetUserAgent(url);
-}
« no previous file with comments | « webkit/tools/test_shell/test_shell_request_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698