| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include <sstream> | 10 #include <sstream> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/platform_thread.h" | 17 #include "base/platform_thread.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/thread.h" | 20 #include "base/thread.h" |
| 21 #include "base/time.h" | 21 #include "base/time.h" |
| 22 #include "base/waitable_event.h" | 22 #include "base/waitable_event.h" |
| 23 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 24 #include "net/http/http_network_layer.h" | 24 #include "net/http/http_network_layer.h" |
| 25 #include "net/url_request/url_request.h" | 25 #include "net/url_request/url_request.h" |
| 26 #include "net/proxy/proxy_resolver_null.h" | |
| 27 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 29 #include "googleurl/src/url_util.h" | 28 #include "googleurl/src/url_util.h" |
| 30 | 29 |
| 31 const int kDefaultPort = 1337; | 30 const int kDefaultPort = 1337; |
| 32 const std::string kDefaultHostName("localhost"); | 31 const std::string kDefaultHostName("localhost"); |
| 33 | 32 |
| 34 // This URLRequestContext does not use a local cache. | 33 // This URLRequestContext does not use a local cache. |
| 35 class TestURLRequestContext : public URLRequestContext { | 34 class TestURLRequestContext : public URLRequestContext { |
| 36 public: | 35 public: |
| 37 TestURLRequestContext() { | 36 TestURLRequestContext() { |
| 38 proxy_service_ = new net::ProxyService(new net::ProxyResolverNull); | 37 proxy_service_ = net::ProxyService::CreateNull(); |
| 39 http_transaction_factory_ = | 38 http_transaction_factory_.reset( |
| 40 net::HttpNetworkLayer::CreateFactory(proxy_service_); | 39 net::HttpNetworkLayer::CreateFactory(proxy_service_)); |
| 41 } | |
| 42 | |
| 43 virtual ~TestURLRequestContext() { | |
| 44 delete http_transaction_factory_; | |
| 45 delete proxy_service_; | |
| 46 } | 40 } |
| 47 }; | 41 }; |
| 48 | 42 |
| 49 class TestDelegate : public URLRequest::Delegate { | 43 class TestDelegate : public URLRequest::Delegate { |
| 50 public: | 44 public: |
| 51 TestDelegate() | 45 TestDelegate() |
| 52 : cancel_in_rr_(false), | 46 : cancel_in_rr_(false), |
| 53 cancel_in_rs_(false), | 47 cancel_in_rs_(false), |
| 54 cancel_in_rd_(false), | 48 cancel_in_rd_(false), |
| 55 cancel_in_rd_pending_(false), | 49 cancel_in_rd_pending_(false), |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 const std::wstring& document_root, | 432 const std::wstring& document_root, |
| 439 const std::wstring& cert_path) : TestServer(ManualInit()) { | 433 const std::wstring& cert_path) : TestServer(ManualInit()) { |
| 440 Init(host_name, port, document_root, cert_path); | 434 Init(host_name, port, document_root, cert_path); |
| 441 } | 435 } |
| 442 | 436 |
| 443 virtual std::string scheme() { return std::string("https"); } | 437 virtual std::string scheme() { return std::string("https"); } |
| 444 }; | 438 }; |
| 445 | 439 |
| 446 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 440 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 447 | 441 |
| OLD | NEW |