OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "net/base/auth.h" | 8 #include "net/base/auth.h" |
9 #include "net/base/net_log_unittest.h" | 9 #include "net/base/net_log_unittest.h" |
10 #include "net/http/http_network_session_peer.h" | 10 #include "net/http/http_network_session_peer.h" |
(...skipping 4133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4144 // Verify that we consumed all test data. | 4144 // Verify that we consumed all test data. |
4145 helper.VerifyDataConsumed(); | 4145 helper.VerifyDataConsumed(); |
4146 } | 4146 } |
4147 | 4147 |
4148 // Test to make sure we can correctly connect through a proxy. | 4148 // Test to make sure we can correctly connect through a proxy. |
4149 TEST_P(SpdyNetworkTransactionTest, ProxyConnect) { | 4149 TEST_P(SpdyNetworkTransactionTest, ProxyConnect) { |
4150 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 4150 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
4151 BoundNetLog(), GetParam()); | 4151 BoundNetLog(), GetParam()); |
4152 helper.session_deps().reset(new SpdySessionDependencies( | 4152 helper.session_deps().reset(new SpdySessionDependencies( |
4153 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"))); | 4153 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"))); |
4154 helper.SetSession(SpdySessionDependencies::SpdyCreateSession( | 4154 helper.SetSession(make_scoped_refptr( |
4155 helper.session_deps().get())); | 4155 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); |
4156 helper.RunPreTestSetup(); | 4156 helper.RunPreTestSetup(); |
4157 HttpNetworkTransaction* trans = helper.trans(); | 4157 HttpNetworkTransaction* trans = helper.trans(); |
4158 | 4158 |
4159 const char kConnect443[] = {"CONNECT www.google.com:443 HTTP/1.1\r\n" | 4159 const char kConnect443[] = {"CONNECT www.google.com:443 HTTP/1.1\r\n" |
4160 "Host: www.google.com\r\n" | 4160 "Host: www.google.com\r\n" |
4161 "Proxy-Connection: keep-alive\r\n\r\n"}; | 4161 "Proxy-Connection: keep-alive\r\n\r\n"}; |
4162 const char kConnect80[] = {"CONNECT www.google.com:80 HTTP/1.1\r\n" | 4162 const char kConnect80[] = {"CONNECT www.google.com:80 HTTP/1.1\r\n" |
4163 "Host: www.google.com\r\n" | 4163 "Host: www.google.com\r\n" |
4164 "Proxy-Connection: keep-alive\r\n\r\n"}; | 4164 "Proxy-Connection: keep-alive\r\n\r\n"}; |
4165 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; | 4165 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4247 // we can use the same pool in the second transaction. | 4247 // we can use the same pool in the second transaction. |
4248 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 4248 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
4249 BoundNetLog(), GetParam()); | 4249 BoundNetLog(), GetParam()); |
4250 | 4250 |
4251 // Use a proxy service which returns a proxy fallback list from DIRECT to | 4251 // Use a proxy service which returns a proxy fallback list from DIRECT to |
4252 // myproxy:70. For this test there will be no fallback, so it is equivalent | 4252 // myproxy:70. For this test there will be no fallback, so it is equivalent |
4253 // to simply DIRECT. The reason for appending the second proxy is to verify | 4253 // to simply DIRECT. The reason for appending the second proxy is to verify |
4254 // that the session pool key used does is just "DIRECT". | 4254 // that the session pool key used does is just "DIRECT". |
4255 helper.session_deps().reset(new SpdySessionDependencies( | 4255 helper.session_deps().reset(new SpdySessionDependencies( |
4256 ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70"))); | 4256 ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70"))); |
4257 helper.SetSession(SpdySessionDependencies::SpdyCreateSession( | 4257 helper.SetSession(make_scoped_refptr( |
4258 helper.session_deps().get())); | 4258 SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); |
4259 | 4259 |
4260 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); | 4260 SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); |
4261 helper.RunPreTestSetup(); | 4261 helper.RunPreTestSetup(); |
4262 | 4262 |
4263 // Construct and send a simple GET request. | 4263 // Construct and send a simple GET request. |
4264 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 4264 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
4265 MockWrite writes[] = { | 4265 MockWrite writes[] = { |
4266 CreateMockWrite(*req, 1), | 4266 CreateMockWrite(*req, 1), |
4267 }; | 4267 }; |
4268 | 4268 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4627 // TODO(cbentzel): This is actually the same response object as before, but | 4627 // TODO(cbentzel): This is actually the same response object as before, but |
4628 // data has changed. | 4628 // data has changed. |
4629 const HttpResponseInfo* const response_restart = trans->GetResponseInfo(); | 4629 const HttpResponseInfo* const response_restart = trans->GetResponseInfo(); |
4630 ASSERT_TRUE(response_restart != NULL); | 4630 ASSERT_TRUE(response_restart != NULL); |
4631 ASSERT_TRUE(response_restart->headers != NULL); | 4631 ASSERT_TRUE(response_restart->headers != NULL); |
4632 EXPECT_EQ(200, response_restart->headers->response_code()); | 4632 EXPECT_EQ(200, response_restart->headers->response_code()); |
4633 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); | 4633 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); |
4634 } | 4634 } |
4635 | 4635 |
4636 } // namespace net | 4636 } // namespace net |
OLD | NEW |