| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 9491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9502 } | 9502 } |
| 9503 | 9503 |
| 9504 const std::vector<GURL>& resolved() const { return resolved_; } | 9504 const std::vector<GURL>& resolved() const { return resolved_; } |
| 9505 | 9505 |
| 9506 private: | 9506 private: |
| 9507 std::vector<GURL> resolved_; | 9507 std::vector<GURL> resolved_; |
| 9508 | 9508 |
| 9509 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); | 9509 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); |
| 9510 }; | 9510 }; |
| 9511 | 9511 |
| 9512 class CapturingProxyResolverFactory : public ProxyResolverFactory { |
| 9513 public: |
| 9514 CapturingProxyResolverFactory(CapturingProxyResolver* resolver) |
| 9515 : ProxyResolverFactory(false), resolver_(resolver) {} |
| 9516 |
| 9517 int CreateProxyResolver( |
| 9518 const scoped_refptr<ProxyResolverScriptData>& pac_script, |
| 9519 scoped_ptr<ProxyResolver>* resolver, |
| 9520 const net::CompletionCallback& callback, |
| 9521 scoped_ptr<Request>* request) override { |
| 9522 resolver->reset(new ForwardingProxyResolver(resolver_)); |
| 9523 return OK; |
| 9524 } |
| 9525 |
| 9526 private: |
| 9527 ProxyResolver* resolver_; |
| 9528 }; |
| 9529 |
| 9512 TEST_P(HttpNetworkTransactionTest, | 9530 TEST_P(HttpNetworkTransactionTest, |
| 9513 UseAlternateProtocolForTunneledNpnSpdy) { | 9531 UseAlternateProtocolForTunneledNpnSpdy) { |
| 9514 session_deps_.use_alternate_protocols = true; | 9532 session_deps_.use_alternate_protocols = true; |
| 9515 session_deps_.next_protos = SpdyNextProtos(); | 9533 session_deps_.next_protos = SpdyNextProtos(); |
| 9516 | 9534 |
| 9517 ProxyConfig proxy_config; | 9535 ProxyConfig proxy_config; |
| 9518 proxy_config.set_auto_detect(true); | 9536 proxy_config.set_auto_detect(true); |
| 9519 proxy_config.set_pac_url(GURL("http://fooproxyurl")); | 9537 proxy_config.set_pac_url(GURL("http://fooproxyurl")); |
| 9520 | 9538 |
| 9521 CapturingProxyResolver capturing_proxy_resolver; | 9539 CapturingProxyResolver capturing_proxy_resolver; |
| 9522 session_deps_.proxy_service.reset(new ProxyService( | 9540 session_deps_.proxy_service.reset(new ProxyService( |
| 9523 new ProxyConfigServiceFixed(proxy_config), | 9541 new ProxyConfigServiceFixed(proxy_config), |
| 9524 make_scoped_ptr( | 9542 make_scoped_ptr( |
| 9525 new ForwardingProxyResolverFactory(&capturing_proxy_resolver)), | 9543 new CapturingProxyResolverFactory(&capturing_proxy_resolver)), |
| 9526 NULL)); | 9544 NULL)); |
| 9527 TestNetLog net_log; | 9545 TestNetLog net_log; |
| 9528 session_deps_.net_log = &net_log; | 9546 session_deps_.net_log = &net_log; |
| 9529 | 9547 |
| 9530 HttpRequestInfo request; | 9548 HttpRequestInfo request; |
| 9531 request.method = "GET"; | 9549 request.method = "GET"; |
| 9532 request.url = GURL("http://www.google.com/"); | 9550 request.url = GURL("http://www.google.com/"); |
| 9533 request.load_flags = 0; | 9551 request.load_flags = 0; |
| 9534 | 9552 |
| 9535 std::string alternate_protocol_http_header = | 9553 std::string alternate_protocol_http_header = |
| (...skipping 4247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13783 ASSERT_TRUE(response); | 13801 ASSERT_TRUE(response); |
| 13784 ASSERT_TRUE(response->headers.get()); | 13802 ASSERT_TRUE(response->headers.get()); |
| 13785 | 13803 |
| 13786 EXPECT_EQ(101, response->headers->response_code()); | 13804 EXPECT_EQ(101, response->headers->response_code()); |
| 13787 | 13805 |
| 13788 trans.reset(); | 13806 trans.reset(); |
| 13789 session->CloseAllConnections(); | 13807 session->CloseAllConnections(); |
| 13790 } | 13808 } |
| 13791 | 13809 |
| 13792 } // namespace net | 13810 } // namespace net |
| OLD | NEW |