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 9575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9586 } | 9586 } |
9587 | 9587 |
9588 const std::vector<GURL>& resolved() const { return resolved_; } | 9588 const std::vector<GURL>& resolved() const { return resolved_; } |
9589 | 9589 |
9590 private: | 9590 private: |
9591 std::vector<GURL> resolved_; | 9591 std::vector<GURL> resolved_; |
9592 | 9592 |
9593 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); | 9593 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); |
9594 }; | 9594 }; |
9595 | 9595 |
| 9596 class CapturingProxyResolverFactory : public ProxyResolverFactory { |
| 9597 public: |
| 9598 explicit CapturingProxyResolverFactory(CapturingProxyResolver* resolver) |
| 9599 : ProxyResolverFactory(false), resolver_(resolver) {} |
| 9600 |
| 9601 int CreateProxyResolver( |
| 9602 const scoped_refptr<ProxyResolverScriptData>& pac_script, |
| 9603 scoped_ptr<ProxyResolver>* resolver, |
| 9604 const net::CompletionCallback& callback, |
| 9605 scoped_ptr<Request>* request) override { |
| 9606 resolver->reset(new ForwardingProxyResolver(resolver_)); |
| 9607 return OK; |
| 9608 } |
| 9609 |
| 9610 private: |
| 9611 ProxyResolver* resolver_; |
| 9612 }; |
| 9613 |
9596 TEST_P(HttpNetworkTransactionTest, | 9614 TEST_P(HttpNetworkTransactionTest, |
9597 UseAlternateProtocolForTunneledNpnSpdy) { | 9615 UseAlternateProtocolForTunneledNpnSpdy) { |
9598 session_deps_.use_alternate_protocols = true; | 9616 session_deps_.use_alternate_protocols = true; |
9599 session_deps_.next_protos = SpdyNextProtos(); | 9617 session_deps_.next_protos = SpdyNextProtos(); |
9600 | 9618 |
9601 ProxyConfig proxy_config; | 9619 ProxyConfig proxy_config; |
9602 proxy_config.set_auto_detect(true); | 9620 proxy_config.set_auto_detect(true); |
9603 proxy_config.set_pac_url(GURL("http://fooproxyurl")); | 9621 proxy_config.set_pac_url(GURL("http://fooproxyurl")); |
9604 | 9622 |
9605 CapturingProxyResolver capturing_proxy_resolver; | 9623 CapturingProxyResolver capturing_proxy_resolver; |
9606 session_deps_.proxy_service.reset(new ProxyService( | 9624 session_deps_.proxy_service.reset(new ProxyService( |
9607 new ProxyConfigServiceFixed(proxy_config), | 9625 new ProxyConfigServiceFixed(proxy_config), |
9608 make_scoped_ptr( | 9626 make_scoped_ptr( |
9609 new ForwardingProxyResolverFactory(&capturing_proxy_resolver)), | 9627 new CapturingProxyResolverFactory(&capturing_proxy_resolver)), |
9610 NULL)); | 9628 NULL)); |
9611 TestNetLog net_log; | 9629 TestNetLog net_log; |
9612 session_deps_.net_log = &net_log; | 9630 session_deps_.net_log = &net_log; |
9613 | 9631 |
9614 HttpRequestInfo request; | 9632 HttpRequestInfo request; |
9615 request.method = "GET"; | 9633 request.method = "GET"; |
9616 request.url = GURL("http://www.example.org/"); | 9634 request.url = GURL("http://www.example.org/"); |
9617 request.load_flags = 0; | 9635 request.load_flags = 0; |
9618 | 9636 |
9619 std::string alternate_protocol_http_header = | 9637 std::string alternate_protocol_http_header = |
(...skipping 4260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13880 ASSERT_TRUE(response); | 13898 ASSERT_TRUE(response); |
13881 ASSERT_TRUE(response->headers.get()); | 13899 ASSERT_TRUE(response->headers.get()); |
13882 | 13900 |
13883 EXPECT_EQ(101, response->headers->response_code()); | 13901 EXPECT_EQ(101, response->headers->response_code()); |
13884 | 13902 |
13885 trans.reset(); | 13903 trans.reset(); |
13886 session->CloseAllConnections(); | 13904 session->CloseAllConnections(); |
13887 } | 13905 } |
13888 | 13906 |
13889 } // namespace net | 13907 } // namespace net |
OLD | NEW |