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

Side by Side Diff: net/proxy/proxy_script_fetcher_impl_unittest.cc

Issue 10408067: [net] Switch TestURLRequestContext to use MockCachingHostResolver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to trunk. Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/proxy/proxy_script_fetcher_impl.h" 5 #include "net/proxy/proxy_script_fetcher_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "net/base/mock_cert_verifier.h" 13 #include "net/base/mock_cert_verifier.h"
14 #include "net/base/mock_host_resolver.h"
14 #include "net/base/net_util.h" 15 #include "net/base/net_util.h"
15 #include "net/base/load_flags.h" 16 #include "net/base/load_flags.h"
16 #include "net/base/ssl_config_service_defaults.h" 17 #include "net/base/ssl_config_service_defaults.h"
17 #include "net/base/test_completion_callback.h" 18 #include "net/base/test_completion_callback.h"
18 #include "net/disk_cache/disk_cache.h" 19 #include "net/disk_cache/disk_cache.h"
19 #include "net/http/http_cache.h" 20 #include "net/http/http_cache.h"
20 #include "net/http/http_network_session.h" 21 #include "net/http/http_network_session.h"
21 #include "net/http/http_server_properties_impl.h" 22 #include "net/http/http_server_properties_impl.h"
22 #include "net/test/test_server.h" 23 #include "net/test/test_server.h"
23 #include "net/url_request/url_request_context_storage.h" 24 #include "net/url_request/url_request_context_storage.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const OVERRIDE{ 64 const OVERRIDE{
64 return NULL; 65 return NULL;
65 } 66 }
66 }; 67 };
67 68
68 // A non-mock URL request which can access http:// and file:// urls. 69 // A non-mock URL request which can access http:// and file:// urls.
69 class RequestContext : public URLRequestContext { 70 class RequestContext : public URLRequestContext {
70 public: 71 public:
71 RequestContext() : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { 72 RequestContext() : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) {
72 ProxyConfig no_proxy; 73 ProxyConfig no_proxy;
73 storage_.set_host_resolver( 74 storage_.set_host_resolver(new MockHostResolver);
74 CreateSystemHostResolver(HostResolver::kDefaultParallelism,
75 HostResolver::kDefaultRetryAttempts,
76 NULL));
77 storage_.set_cert_verifier(new MockCertVerifier); 75 storage_.set_cert_verifier(new MockCertVerifier);
78 storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy)); 76 storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy));
79 storage_.set_ssl_config_service(new SSLConfigServiceDefaults); 77 storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
80 storage_.set_http_server_properties(new HttpServerPropertiesImpl); 78 storage_.set_http_server_properties(new HttpServerPropertiesImpl);
81 79
82 HttpNetworkSession::Params params; 80 HttpNetworkSession::Params params;
83 params.host_resolver = host_resolver(); 81 params.host_resolver = host_resolver();
84 params.cert_verifier = cert_verifier(); 82 params.cert_verifier = cert_verifier();
85 params.proxy_service = proxy_service(); 83 params.proxy_service = proxy_service();
86 params.ssl_config_service = ssl_config_service(); 84 params.ssl_config_service = ssl_config_service();
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 { 473 {
476 GURL url(kEncodedUrlBroken); 474 GURL url(kEncodedUrlBroken);
477 string16 text; 475 string16 text;
478 TestCompletionCallback callback; 476 TestCompletionCallback callback;
479 int result = pac_fetcher.Fetch(url, &text, callback.callback()); 477 int result = pac_fetcher.Fetch(url, &text, callback.callback());
480 EXPECT_EQ(ERR_FAILED, result); 478 EXPECT_EQ(ERR_FAILED, result);
481 } 479 }
482 } 480 }
483 481
484 } // namespace net 482 } // namespace net
OLDNEW
« no previous file with comments | « jingle/notifier/communicator/single_login_attempt_unittest.cc ('k') | net/socket/transport_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698