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

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

Issue 1151843002: DO NOT LAND Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More. Created 5 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
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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/base/proxy_delegate.h" 12 #include "net/base/proxy_delegate.h"
13 #include "net/base/test_completion_callback.h" 13 #include "net/base/test_completion_callback.h"
14 #include "net/http/http_network_session.h" 14 #include "net/http/http_network_session.h"
15 #include "net/http/http_proxy_client_socket.h" 15 #include "net/http/http_proxy_client_socket.h"
16 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
17 #include "net/socket/client_socket_handle.h" 17 #include "net/socket/client_socket_handle.h"
18 #include "net/socket/next_proto.h" 18 #include "net/socket/next_proto.h"
19 #include "net/socket/socket_test_util.h" 19 #include "net/socket/socket_test_util.h"
20 #include "net/spdy/spdy_protocol.h" 20 #include "net/spdy/spdy_protocol.h"
21 #include "net/spdy/spdy_test_util_common.h" 21 #include "net/spdy/spdy_test_util_common.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 #include "url/origin.h"
23 24
24 namespace net { 25 namespace net {
25 26
26 namespace { 27 namespace {
27 28
28 const int kMaxSockets = 32; 29 const int kMaxSockets = 32;
29 const int kMaxSocketsPerGroup = 6; 30 const int kMaxSocketsPerGroup = 6;
30 const char * const kAuthHeaders[] = { 31 const char * const kAuthHeaders[] = {
31 "proxy-authorization", "Basic Zm9vOmJhcg==" 32 "proxy-authorization", "Basic Zm9vOmJhcg=="
32 }; 33 };
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 184
184 virtual ~HttpProxyClientSocketPoolTest() { 185 virtual ~HttpProxyClientSocketPoolTest() {
185 } 186 }
186 187
187 void AddAuthToCache() { 188 void AddAuthToCache() {
188 const base::string16 kFoo(base::ASCIIToUTF16("foo")); 189 const base::string16 kFoo(base::ASCIIToUTF16("foo"));
189 const base::string16 kBar(base::ASCIIToUTF16("bar")); 190 const base::string16 kBar(base::ASCIIToUTF16("bar"));
190 GURL proxy_url(GetParam().proxy_type == HTTP ? 191 GURL proxy_url(GetParam().proxy_type == HTTP ?
191 (std::string("http://") + kHttpProxyHost) : 192 (std::string("http://") + kHttpProxyHost) :
192 (std::string("https://") + kHttpsProxyHost)); 193 (std::string("https://") + kHttpsProxyHost));
193 session_->http_auth_cache()->Add(proxy_url, 194 session_->http_auth_cache()->Add(
194 "MyRealm1", 195 url::Origin(proxy_url), "MyRealm1", HttpAuth::AUTH_SCHEME_BASIC,
195 HttpAuth::AUTH_SCHEME_BASIC, 196 "Basic realm=MyRealm1", AuthCredentials(kFoo, kBar), "/");
196 "Basic realm=MyRealm1",
197 AuthCredentials(kFoo, kBar),
198 "/");
199 } 197 }
200 198
201 scoped_refptr<TransportSocketParams> CreateHttpProxyParams() const { 199 scoped_refptr<TransportSocketParams> CreateHttpProxyParams() const {
202 if (GetParam().proxy_type != HTTP) 200 if (GetParam().proxy_type != HTTP)
203 return NULL; 201 return NULL;
204 return new TransportSocketParams( 202 return new TransportSocketParams(
205 HostPortPair(kHttpProxyHost, 80), 203 HostPortPair(kHttpProxyHost, 80),
206 false, 204 false,
207 false, 205 false,
208 OnHostResolutionCallback(), 206 OnHostResolutionCallback(),
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 EXPECT_TRUE(headers->IsRedirect(&location)); 826 EXPECT_TRUE(headers->IsRedirect(&location));
829 EXPECT_EQ(location, redirectTarget); 827 EXPECT_EQ(location, redirectTarget);
830 } 828 }
831 } 829 }
832 830
833 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. 831 // It would be nice to also test the timeouts in HttpProxyClientSocketPool.
834 832
835 } // namespace 833 } // namespace
836 834
837 } // namespace net 835 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698