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

Unified Diff: net/proxy/proxy_script_fetcher_impl_unittest.cc

Issue 6402002: Simplify HttpCache/HttpNetworkLayer/HttpNetworkSession interaction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 9 years, 11 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 | « net/http/http_network_layer_unittest.cc ('k') | net/spdy/spdy_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_script_fetcher_impl_unittest.cc
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc
index 4a96071c45b72bd09a9db5b61c61d5ecd7ea434a..ae751eb2f74b7ad7dd302787462122028f377a56 100644
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -15,14 +15,21 @@
#include "net/base/test_completion_callback.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_cache.h"
+#include "net/http/http_network_session.h"
+#include "net/socket/client_socket_factory.h"
+#include "net/spdy/spdy_session_pool.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
+namespace net {
+
// TODO(eroman):
// - Test canceling an outstanding request.
// - Test deleting ProxyScriptFetcher while a request is in progress.
+namespace {
+
const FilePath::CharType kDocRoot[] =
FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest");
@@ -32,23 +39,34 @@ struct FetchResult {
};
// A non-mock URL request which can access http:// and file:// urls.
-class RequestContext : public net::URLRequestContext {
+class RequestContext : public URLRequestContext {
public:
RequestContext() {
- net::ProxyConfig no_proxy;
+ ProxyConfig no_proxy;
host_resolver_ =
- net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism,
+ CreateSystemHostResolver(HostResolver::kDefaultParallelism,
NULL, NULL);
- cert_verifier_ = new net::CertVerifier;
- proxy_service_ = net::ProxyService::CreateFixed(no_proxy);
- ssl_config_service_ = new net::SSLConfigServiceDefaults;
-
- http_transaction_factory_ = new net::HttpCache(
- net::HttpNetworkLayer::CreateFactory(host_resolver_, cert_verifier_,
- NULL, NULL, NULL, proxy_service_, ssl_config_service_, NULL, NULL,
- NULL),
- NULL,
- net::HttpCache::DefaultBackend::InMemory(0));
+ cert_verifier_ = new CertVerifier;
+ proxy_service_ = ProxyService::CreateFixed(no_proxy);
+ ssl_config_service_ = new SSLConfigServiceDefaults;
+
+ scoped_refptr<HttpNetworkSession> network_session(
+ new HttpNetworkSession(
+ host_resolver_,
+ cert_verifier_,
+ NULL /* dnsrr_resolver */,
+ NULL /* dns_cert_checker */,
+ NULL /* ssl_host_info_factory */,
+ proxy_service_,
+ ClientSocketFactory::GetDefaultFactory(),
+ ssl_config_service_,
+ new SpdySessionPool(NULL),
+ NULL,
+ NULL,
+ NULL));
+ http_transaction_factory_ = new HttpCache(
+ network_session,
+ HttpCache::DefaultBackend::InMemory(0));
}
private:
@@ -59,9 +77,6 @@ class RequestContext : public net::URLRequestContext {
}
};
-// Required to be in net namespace by FRIEND_TEST.
-namespace net {
-
// Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest.
GURL GetTestFileUrl(const std::string& relpath) {
FilePath path;
@@ -73,6 +88,8 @@ GURL GetTestFileUrl(const std::string& relpath) {
return GURL(base_url.spec() + "/" + relpath);
}
+} // namespace
+
class ProxyScriptFetcherImplTest : public PlatformTest {
public:
ProxyScriptFetcherImplTest()
« no previous file with comments | « net/http/http_network_layer_unittest.cc ('k') | net/spdy/spdy_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698