| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 27 matching lines...) Expand all Loading... |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "testing/platform_test.h" | 39 #include "testing/platform_test.h" |
| 40 | 40 |
| 41 using base::Time; | 41 using base::Time; |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 class URLRequestHttpCacheContext : public URLRequestContext { | 45 class URLRequestHttpCacheContext : public URLRequestContext { |
| 46 public: | 46 public: |
| 47 URLRequestHttpCacheContext() { | 47 URLRequestHttpCacheContext() { |
| 48 host_resolver_ = new net::HostResolver; |
| 48 proxy_service_ = net::ProxyService::CreateNull(); | 49 proxy_service_ = net::ProxyService::CreateNull(); |
| 49 http_transaction_factory_ = | 50 http_transaction_factory_ = |
| 50 new net::HttpCache(net::HttpNetworkLayer::CreateFactory(proxy_service_), | 51 new net::HttpCache( |
| 51 disk_cache::CreateInMemoryCacheBackend(0)); | 52 net::HttpNetworkLayer::CreateFactory(host_resolver_, proxy_service_), |
| 53 disk_cache::CreateInMemoryCacheBackend(0)); |
| 52 // In-memory cookie store. | 54 // In-memory cookie store. |
| 53 cookie_store_ = new net::CookieMonster(); | 55 cookie_store_ = new net::CookieMonster(); |
| 54 } | 56 } |
| 55 | 57 |
| 56 virtual ~URLRequestHttpCacheContext() { | 58 virtual ~URLRequestHttpCacheContext() { |
| 57 delete cookie_store_; | 59 delete cookie_store_; |
| 58 delete http_transaction_factory_; | 60 delete http_transaction_factory_; |
| 59 delete proxy_service_; | 61 delete proxy_service_; |
| 62 delete host_resolver_; |
| 60 } | 63 } |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 class TestURLRequest : public URLRequest { | 66 class TestURLRequest : public URLRequest { |
| 64 public: | 67 public: |
| 65 TestURLRequest(const GURL& url, Delegate* delegate) | 68 TestURLRequest(const GURL& url, Delegate* delegate) |
| 66 : URLRequest(url, delegate) { | 69 : URLRequest(url, delegate) { |
| 67 set_context(new URLRequestHttpCacheContext()); | 70 set_context(new URLRequestHttpCacheContext()); |
| 68 } | 71 } |
| 69 }; | 72 }; |
| (...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 | 1799 |
| 1797 int64 file_size = 0; | 1800 int64 file_size = 0; |
| 1798 file_util::GetFileSize(app_path, &file_size); | 1801 file_util::GetFileSize(app_path, &file_size); |
| 1799 | 1802 |
| 1800 EXPECT_TRUE(!r.is_pending()); | 1803 EXPECT_TRUE(!r.is_pending()); |
| 1801 EXPECT_EQ(1, d.response_started_count()); | 1804 EXPECT_EQ(1, d.response_started_count()); |
| 1802 EXPECT_FALSE(d.received_data_before_response()); | 1805 EXPECT_FALSE(d.received_data_before_response()); |
| 1803 EXPECT_EQ(d.bytes_received(), 0); | 1806 EXPECT_EQ(d.bytes_received(), 0); |
| 1804 } | 1807 } |
| 1805 } | 1808 } |
| OLD | NEW |