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

Side by Side Diff: net/http/http_proxy_client_socket_pool_spdy2_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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/http/http_proxy_client_socket_pool.h" 5 #include "net/http/http_proxy_client_socket_pool.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 29 matching lines...) Expand all
40 }; 40 };
41 41
42 typedef ::testing::TestWithParam<HttpProxyType> TestWithHttpParam; 42 typedef ::testing::TestWithParam<HttpProxyType> TestWithHttpParam;
43 43
44 } // namespace 44 } // namespace
45 45
46 class HttpProxyClientSocketPoolSpdy2Test : public TestWithHttpParam { 46 class HttpProxyClientSocketPoolSpdy2Test : public TestWithHttpParam {
47 protected: 47 protected:
48 HttpProxyClientSocketPoolSpdy2Test() 48 HttpProxyClientSocketPoolSpdy2Test()
49 : ssl_config_(), 49 : ssl_config_(),
50 ignored_transport_socket_params_(new TransportSocketParams( 50 ignored_transport_socket_params_(
51 HostPortPair("proxy", 80), LOWEST, false, false, 51 new TransportSocketParams(HostPortPair("proxy", 80),
52 OnHostResolutionCallback())), 52 LOWEST,
53 ignored_ssl_socket_params_(new SSLSocketParams( 53 false,
54 ignored_transport_socket_params_, NULL, NULL, 54 false,
55 ProxyServer::SCHEME_DIRECT, HostPortPair("www.google.com", 443), 55 OnHostResolutionCallback())),
56 ssl_config_, 0, false, false)), 56 ignored_ssl_socket_params_(
57 new SSLSocketParams(ignored_transport_socket_params_,
58 NULL,
59 NULL,
60 ProxyServer::SCHEME_DIRECT,
61 HostPortPair("www.google.com", 443),
62 ssl_config_,
63 0,
64 false,
65 false)),
57 tcp_histograms_("MockTCP"), 66 tcp_histograms_("MockTCP"),
58 transport_socket_pool_( 67 transport_socket_pool_(
59 kMaxSockets, kMaxSocketsPerGroup, 68 kMaxSockets,
69 kMaxSocketsPerGroup,
60 &tcp_histograms_, 70 &tcp_histograms_,
61 session_deps_.deterministic_socket_factory.get()), 71 session_deps_.deterministic_socket_factory.get()),
62 ssl_histograms_("MockSSL"), 72 ssl_histograms_("MockSSL"),
63 ssl_socket_pool_(kMaxSockets, kMaxSocketsPerGroup, 73 ssl_socket_pool_(kMaxSockets,
74 kMaxSocketsPerGroup,
64 &ssl_histograms_, 75 &ssl_histograms_,
65 session_deps_.host_resolver.get(), 76 session_deps_.host_resolver.get(),
66 session_deps_.cert_verifier.get(), 77 session_deps_.cert_verifier.get(),
67 NULL /* server_bound_cert_store */, 78 NULL /* server_bound_cert_store */,
68 NULL /* transport_security_state */, 79 NULL /* transport_security_state */,
69 "" /* ssl_session_cache_shard */, 80 std::string() /* ssl_session_cache_shard */,
70 session_deps_.deterministic_socket_factory.get(), 81 session_deps_.deterministic_socket_factory.get(),
71 &transport_socket_pool_, 82 &transport_socket_pool_,
72 NULL, 83 NULL,
73 NULL, 84 NULL,
74 session_deps_.ssl_config_service.get(), 85 session_deps_.ssl_config_service.get(),
75 BoundNetLog().net_log()), 86 BoundNetLog().net_log()),
76 session_(CreateNetworkSession()), 87 session_(CreateNetworkSession()),
77 http_proxy_histograms_("HttpProxyUnitTest"), 88 http_proxy_histograms_("HttpProxyUnitTest"),
78 ssl_data_(NULL), 89 ssl_data_(NULL),
79 data_(NULL), 90 data_(NULL),
80 pool_(kMaxSockets, kMaxSocketsPerGroup, 91 pool_(kMaxSockets,
92 kMaxSocketsPerGroup,
81 &http_proxy_histograms_, 93 &http_proxy_histograms_,
82 NULL, 94 NULL,
83 &transport_socket_pool_, 95 &transport_socket_pool_,
84 &ssl_socket_pool_, 96 &ssl_socket_pool_,
85 NULL) { 97 NULL) {}
86 }
87 98
88 virtual ~HttpProxyClientSocketPoolSpdy2Test() { 99 virtual ~HttpProxyClientSocketPoolSpdy2Test() {
89 } 100 }
90 101
91 void AddAuthToCache() { 102 void AddAuthToCache() {
92 const base::string16 kFoo(ASCIIToUTF16("foo")); 103 const base::string16 kFoo(ASCIIToUTF16("foo"));
93 const base::string16 kBar(ASCIIToUTF16("bar")); 104 const base::string16 kBar(ASCIIToUTF16("bar"));
94 GURL proxy_url(GetParam() == HTTP ? "http://proxy" : "https://proxy:80"); 105 GURL proxy_url(GetParam() == HTTP ? "http://proxy" : "https://proxy:80");
95 session_->http_auth_cache()->Add(proxy_url, 106 session_->http_auth_cache()->Add(proxy_url,
96 "MyRealm1", 107 "MyRealm1",
(...skipping 11 matching lines...) Expand all
108 119
109 scoped_refptr<SSLSocketParams> GetSslParams() { 120 scoped_refptr<SSLSocketParams> GetSslParams() {
110 if (GetParam() == HTTP) 121 if (GetParam() == HTTP)
111 return scoped_refptr<SSLSocketParams>(); 122 return scoped_refptr<SSLSocketParams>();
112 return ignored_ssl_socket_params_; 123 return ignored_ssl_socket_params_;
113 } 124 }
114 125
115 // Returns the a correctly constructed HttpProxyParms 126 // Returns the a correctly constructed HttpProxyParms
116 // for the HTTP or HTTPS proxy. 127 // for the HTTP or HTTPS proxy.
117 scoped_refptr<HttpProxySocketParams> GetParams(bool tunnel) { 128 scoped_refptr<HttpProxySocketParams> GetParams(bool tunnel) {
118 return scoped_refptr<HttpProxySocketParams>( 129 return scoped_refptr<HttpProxySocketParams>(new HttpProxySocketParams(
119 new HttpProxySocketParams( 130 GetTcpParams(),
120 GetTcpParams(), 131 GetSslParams(),
121 GetSslParams(), 132 GURL(tunnel ? "https://www.google.com/" : "http://www.google.com"),
122 GURL(tunnel ? "https://www.google.com/" : "http://www.google.com"), 133 std::string(),
123 "", 134 HostPortPair("www.google.com", tunnel ? 443 : 80),
124 HostPortPair("www.google.com", tunnel ? 443 : 80), 135 session_->http_auth_cache(),
125 session_->http_auth_cache(), 136 session_->http_auth_handler_factory(),
126 session_->http_auth_handler_factory(), 137 session_->spdy_session_pool(),
127 session_->spdy_session_pool(), 138 tunnel));
128 tunnel));
129 } 139 }
130 140
131 scoped_refptr<HttpProxySocketParams> GetTunnelParams() { 141 scoped_refptr<HttpProxySocketParams> GetTunnelParams() {
132 return GetParams(true); 142 return GetParams(true);
133 } 143 }
134 144
135 scoped_refptr<HttpProxySocketParams> GetNoTunnelParams() { 145 scoped_refptr<HttpProxySocketParams> GetNoTunnelParams() {
136 return GetParams(false); 146 return GetParams(false);
137 } 147 }
138 148
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // Make sure Location header was included and correct. 599 // Make sure Location header was included and correct.
590 std::string location; 600 std::string location;
591 EXPECT_TRUE(headers->IsRedirect(&location)); 601 EXPECT_TRUE(headers->IsRedirect(&location));
592 EXPECT_EQ(location, redirectTarget); 602 EXPECT_EQ(location, redirectTarget);
593 } 603 }
594 } 604 }
595 605
596 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. 606 // It would be nice to also test the timeouts in HttpProxyClientSocketPool.
597 607
598 } // namespace net 608 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_spdy3_unittest.cc ('k') | net/http/http_proxy_client_socket_pool_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698