| 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 9493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9504 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 9504 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 9505 EXPECT_FALSE(response->was_fetched_via_spdy); | 9505 EXPECT_FALSE(response->was_fetched_via_spdy); |
| 9506 EXPECT_FALSE(response->was_npn_negotiated); | 9506 EXPECT_FALSE(response->was_npn_negotiated); |
| 9507 | 9507 |
| 9508 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 9508 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 9509 EXPECT_EQ("hello world", response_data); | 9509 EXPECT_EQ("hello world", response_data); |
| 9510 } | 9510 } |
| 9511 | 9511 |
| 9512 class CapturingProxyResolver : public ProxyResolver { | 9512 class CapturingProxyResolver : public ProxyResolver { |
| 9513 public: | 9513 public: |
| 9514 CapturingProxyResolver() : ProxyResolver(false /* expects_pac_bytes */) {} | 9514 CapturingProxyResolver() {} |
| 9515 ~CapturingProxyResolver() override {} | 9515 ~CapturingProxyResolver() override {} |
| 9516 | 9516 |
| 9517 int GetProxyForURL(const GURL& url, | 9517 int GetProxyForURL(const GURL& url, |
| 9518 ProxyInfo* results, | 9518 ProxyInfo* results, |
| 9519 const CompletionCallback& callback, | 9519 const CompletionCallback& callback, |
| 9520 RequestHandle* request, | 9520 RequestHandle* request, |
| 9521 const BoundNetLog& net_log) override { | 9521 const BoundNetLog& net_log) override { |
| 9522 ProxyServer proxy_server(ProxyServer::SCHEME_HTTP, | 9522 ProxyServer proxy_server(ProxyServer::SCHEME_HTTP, |
| 9523 HostPortPair("myproxy", 80)); | 9523 HostPortPair("myproxy", 80)); |
| 9524 results->UseProxyServer(proxy_server); | 9524 results->UseProxyServer(proxy_server); |
| 9525 resolved_.push_back(url); | 9525 resolved_.push_back(url); |
| 9526 return OK; | 9526 return OK; |
| 9527 } | 9527 } |
| 9528 | 9528 |
| 9529 void CancelRequest(RequestHandle request) override { NOTREACHED(); } | 9529 void CancelRequest(RequestHandle request) override { NOTREACHED(); } |
| 9530 | 9530 |
| 9531 LoadState GetLoadState(RequestHandle request) const override { | 9531 LoadState GetLoadState(RequestHandle request) const override { |
| 9532 NOTREACHED(); | 9532 NOTREACHED(); |
| 9533 return LOAD_STATE_IDLE; | 9533 return LOAD_STATE_IDLE; |
| 9534 } | 9534 } |
| 9535 | 9535 |
| 9536 void CancelSetPacScript() override { NOTREACHED(); } | |
| 9537 | |
| 9538 int SetPacScript(const scoped_refptr<ProxyResolverScriptData>&, | |
| 9539 const CompletionCallback& /*callback*/) override { | |
| 9540 return OK; | |
| 9541 } | |
| 9542 | |
| 9543 const std::vector<GURL>& resolved() const { return resolved_; } | 9536 const std::vector<GURL>& resolved() const { return resolved_; } |
| 9544 | 9537 |
| 9545 private: | 9538 private: |
| 9546 std::vector<GURL> resolved_; | 9539 std::vector<GURL> resolved_; |
| 9547 | 9540 |
| 9548 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); | 9541 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); |
| 9549 }; | 9542 }; |
| 9550 | 9543 |
| 9551 class CapturingProxyResolverFactory : public ProxyResolverFactory { | 9544 class CapturingProxyResolverFactory : public ProxyResolverFactory { |
| 9552 public: | 9545 public: |
| (...skipping 4700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14253 ASSERT_TRUE(response); | 14246 ASSERT_TRUE(response); |
| 14254 ASSERT_TRUE(response->headers.get()); | 14247 ASSERT_TRUE(response->headers.get()); |
| 14255 | 14248 |
| 14256 EXPECT_EQ(101, response->headers->response_code()); | 14249 EXPECT_EQ(101, response->headers->response_code()); |
| 14257 | 14250 |
| 14258 trans.reset(); | 14251 trans.reset(); |
| 14259 session->CloseAllConnections(); | 14252 session->CloseAllConnections(); |
| 14260 } | 14253 } |
| 14261 | 14254 |
| 14262 } // namespace net | 14255 } // namespace net |
| OLD | NEW |