OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <windows.h> | 5 #include <windows.h> |
6 #include <wininet.h> | 6 #include <wininet.h> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_handle_win.h" | 10 #include "base/scoped_handle_win.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 protected: | 57 protected: |
58 HINTERNET h_; | 58 HINTERNET h_; |
59 }; | 59 }; |
60 | 60 |
61 class URLRequestTestContext : public URLRequestContext { | 61 class URLRequestTestContext : public URLRequestContext { |
62 public: | 62 public: |
63 URLRequestTestContext() { | 63 URLRequestTestContext() { |
64 host_resolver_ = | 64 host_resolver_ = |
65 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 65 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
66 NULL, NULL); | 66 NULL, NULL); |
| 67 cert_verifier_ = new net::CertVerifier; |
67 proxy_service_ = net::ProxyService::CreateDirect(); | 68 proxy_service_ = net::ProxyService::CreateDirect(); |
68 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 69 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
69 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( | 70 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( |
70 host_resolver_); | 71 host_resolver_); |
71 http_transaction_factory_ = new net::HttpCache( | 72 http_transaction_factory_ = new net::HttpCache( |
72 net::HttpNetworkLayer::CreateFactory( | 73 net::HttpNetworkLayer::CreateFactory( |
73 host_resolver_, | 74 host_resolver_, |
| 75 cert_verifier_, |
74 NULL /* dnsrr_resolver */, | 76 NULL /* dnsrr_resolver */, |
75 NULL /* dns_cert_checker */, | 77 NULL /* dns_cert_checker */, |
76 NULL /* ssl_host_info_factory */, | 78 NULL /* ssl_host_info_factory */, |
77 proxy_service_, | 79 proxy_service_, |
78 ssl_config_service_, | 80 ssl_config_service_, |
79 http_auth_handler_factory_, | 81 http_auth_handler_factory_, |
80 NULL /* network_delegate */, | 82 NULL /* network_delegate */, |
81 NULL /* net_log */), | 83 NULL /* net_log */), |
82 net::HttpCache::DefaultBackend::InMemory(0)); | 84 net::HttpCache::DefaultBackend::InMemory(0)); |
83 // In-memory cookie store. | 85 // In-memory cookie store. |
84 cookie_store_ = new net::CookieMonster(NULL, NULL); | 86 cookie_store_ = new net::CookieMonster(NULL, NULL); |
85 } | 87 } |
86 | 88 |
87 virtual ~URLRequestTestContext() { | 89 virtual ~URLRequestTestContext() { |
88 delete http_transaction_factory_; | 90 delete http_transaction_factory_; |
89 delete http_auth_handler_factory_; | 91 delete http_auth_handler_factory_; |
| 92 delete cert_verifier_; |
| 93 delete host_resolver_; |
90 } | 94 } |
91 }; | 95 }; |
92 | 96 |
93 class TestURLRequest : public net::URLRequest { | 97 class TestURLRequest : public net::URLRequest { |
94 public: | 98 public: |
95 TestURLRequest(const GURL& url, Delegate* delegate) | 99 TestURLRequest(const GURL& url, Delegate* delegate) |
96 : net::URLRequest(url, delegate) { | 100 : net::URLRequest(url, delegate) { |
97 set_context(new URLRequestTestContext()); | 101 set_context(new URLRequestTestContext()); |
98 } | 102 } |
99 }; | 103 }; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 EXPECT_EQ(file.accessed(), 1); | 202 EXPECT_EQ(file.accessed(), 1); |
199 EXPECT_EQ(redir.accessed(), 1); | 203 EXPECT_EQ(redir.accessed(), 1); |
200 | 204 |
201 EXPECT_TRUE(person_task.response().find("Guthrie") != std::string::npos); | 205 EXPECT_TRUE(person_task.response().find("Guthrie") != std::string::npos); |
202 EXPECT_TRUE(file_task.response().find("function") != std::string::npos); | 206 EXPECT_TRUE(file_task.response().find("function") != std::string::npos); |
203 EXPECT_TRUE(goog_task.response().find("<title>") != std::string::npos); | 207 EXPECT_TRUE(goog_task.response().find("<title>") != std::string::npos); |
204 } else { | 208 } else { |
205 ::TerminateThread(worker, ~0); | 209 ::TerminateThread(worker, ~0); |
206 } | 210 } |
207 } | 211 } |
OLD | NEW |