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 <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 10518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10529 } | 10529 } |
10530 | 10530 |
10531 class CapturingProxyResolver : public ProxyResolver { | 10531 class CapturingProxyResolver : public ProxyResolver { |
10532 public: | 10532 public: |
10533 CapturingProxyResolver() {} | 10533 CapturingProxyResolver() {} |
10534 ~CapturingProxyResolver() override {} | 10534 ~CapturingProxyResolver() override {} |
10535 | 10535 |
10536 int GetProxyForURL(const GURL& url, | 10536 int GetProxyForURL(const GURL& url, |
10537 ProxyInfo* results, | 10537 ProxyInfo* results, |
10538 const CompletionCallback& callback, | 10538 const CompletionCallback& callback, |
10539 RequestHandle* request, | 10539 scoped_ptr<Request>* request, |
10540 const BoundNetLog& net_log) override { | 10540 const BoundNetLog& net_log) override { |
10541 ProxyServer proxy_server(ProxyServer::SCHEME_HTTP, | 10541 ProxyServer proxy_server(ProxyServer::SCHEME_HTTP, |
10542 HostPortPair("myproxy", 80)); | 10542 HostPortPair("myproxy", 80)); |
10543 results->UseProxyServer(proxy_server); | 10543 results->UseProxyServer(proxy_server); |
10544 resolved_.push_back(url); | 10544 resolved_.push_back(url); |
10545 return OK; | 10545 return OK; |
10546 } | 10546 } |
10547 | 10547 |
10548 void CancelRequest(RequestHandle request) override { NOTREACHED(); } | |
10549 | |
10550 LoadState GetLoadState(RequestHandle request) const override { | |
10551 NOTREACHED(); | |
10552 return LOAD_STATE_IDLE; | |
10553 } | |
10554 | |
10555 const std::vector<GURL>& resolved() const { return resolved_; } | 10548 const std::vector<GURL>& resolved() const { return resolved_; } |
10556 | 10549 |
10557 private: | 10550 private: |
10558 std::vector<GURL> resolved_; | 10551 std::vector<GURL> resolved_; |
10559 | 10552 |
10560 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); | 10553 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); |
10561 }; | 10554 }; |
10562 | 10555 |
10563 class CapturingProxyResolverFactory : public ProxyResolverFactory { | 10556 class CapturingProxyResolverFactory : public ProxyResolverFactory { |
10564 public: | 10557 public: |
(...skipping 4802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15367 std::string response_data; | 15360 std::string response_data; |
15368 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 15361 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
15369 | 15362 |
15370 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), | 15363 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), |
15371 trans->GetTotalSentBytes()); | 15364 trans->GetTotalSentBytes()); |
15372 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), | 15365 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), |
15373 trans->GetTotalReceivedBytes()); | 15366 trans->GetTotalReceivedBytes()); |
15374 } | 15367 } |
15375 | 15368 |
15376 } // namespace net | 15369 } // namespace net |
OLD | NEW |