| 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 #include "net/url_request/url_request_unittest.h" | 5 #include "net/url_request/url_request_unittest.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/string_piece.h" | 22 #include "base/string_piece.h" |
| 23 #include "base/string_util.h" | 23 #include "base/string_util.h" |
| 24 #include "net/base/load_flags.h" | 24 #include "net/base/load_flags.h" |
| 25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
| 26 #include "net/base/net_module.h" | 26 #include "net/base/net_module.h" |
| 27 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 28 #include "net/base/ssl_test_util.h" | 28 #include "net/base/ssl_test_util.h" |
| 29 #include "net/disk_cache/disk_cache.h" | 29 #include "net/disk_cache/disk_cache.h" |
| 30 #include "net/http/http_cache.h" | 30 #include "net/http/http_cache.h" |
| 31 #include "net/http/http_network_layer.h" | 31 #include "net/http/http_network_layer.h" |
| 32 #include "net/proxy/proxy_resolver_null.h" | |
| 33 #include "net/proxy/proxy_service.h" | 32 #include "net/proxy/proxy_service.h" |
| 34 #include "net/url_request/url_request.h" | 33 #include "net/url_request/url_request.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "testing/platform_test.h" | 35 #include "testing/platform_test.h" |
| 37 | 36 |
| 38 using base::Time; | 37 using base::Time; |
| 39 | 38 |
| 40 namespace { | 39 namespace { |
| 41 | 40 |
| 42 class URLRequestHttpCacheContext : public URLRequestContext { | 41 class URLRequestHttpCacheContext : public URLRequestContext { |
| 43 public: | 42 public: |
| 44 URLRequestHttpCacheContext() { | 43 URLRequestHttpCacheContext() { |
| 45 proxy_service_ = new net::ProxyService(new net::ProxyResolverNull); | 44 proxy_service_ = net::ProxyService::CreateNull(); |
| 46 http_transaction_factory_ = | 45 http_transaction_factory_.reset( |
| 47 new net::HttpCache(net::HttpNetworkLayer::CreateFactory(proxy_service_), | 46 new net::HttpCache(net::HttpNetworkLayer::CreateFactory(proxy_service_), |
| 48 disk_cache::CreateInMemoryCacheBackend(0)); | 47 disk_cache::CreateInMemoryCacheBackend(0))); |
| 49 } | |
| 50 | |
| 51 virtual ~URLRequestHttpCacheContext() { | |
| 52 delete http_transaction_factory_; | |
| 53 delete proxy_service_; | |
| 54 } | 48 } |
| 55 }; | 49 }; |
| 56 | 50 |
| 57 class TestURLRequest : public URLRequest { | 51 class TestURLRequest : public URLRequest { |
| 58 public: | 52 public: |
| 59 TestURLRequest(const GURL& url, Delegate* delegate) | 53 TestURLRequest(const GURL& url, Delegate* delegate) |
| 60 : URLRequest(url, delegate) { | 54 : URLRequest(url, delegate) { |
| 61 set_context(new URLRequestHttpCacheContext()); | 55 set_context(new URLRequestHttpCacheContext()); |
| 62 } | 56 } |
| 63 }; | 57 }; |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 | 881 |
| 888 TEST_F(URLRequestTest, Post307RedirectPost) { | 882 TEST_F(URLRequestTest, Post307RedirectPost) { |
| 889 TestServer server(L"net/data/url_request_unittest"); | 883 TestServer server(L"net/data/url_request_unittest"); |
| 890 TestDelegate d; | 884 TestDelegate d; |
| 891 TestURLRequest req(server.TestServerPage("files/redirect307-to-echoall"), &d); | 885 TestURLRequest req(server.TestServerPage("files/redirect307-to-echoall"), &d); |
| 892 req.set_method("POST"); | 886 req.set_method("POST"); |
| 893 req.Start(); | 887 req.Start(); |
| 894 MessageLoop::current()->Run(); | 888 MessageLoop::current()->Run(); |
| 895 EXPECT_EQ(req.method(), "POST"); | 889 EXPECT_EQ(req.method(), "POST"); |
| 896 } | 890 } |
| OLD | NEW |