Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: chrome_frame/test/test_server_test.cc

Issue 6402002: Simplify HttpCache/HttpNetworkLayer/HttpNetworkSession interaction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix CF tests. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/win/scoped_handle.h" 10 #include "base/win/scoped_handle.h"
11 #include "chrome_frame/test/test_server.h" 11 #include "chrome_frame/test/test_server.h"
12 #include "net/base/cookie_monster.h" 12 #include "net/base/cookie_monster.h"
13 #include "net/base/host_resolver_proc.h" 13 #include "net/base/host_resolver_proc.h"
14 #include "net/disk_cache/disk_cache.h" 14 #include "net/disk_cache/disk_cache.h"
15 #include "net/http/http_auth_handler_factory.h" 15 #include "net/http/http_auth_handler_factory.h"
16 #include "net/http/http_cache.h" 16 #include "net/http/http_cache.h"
17 #include "net/http/http_network_session.h"
17 #include "net/proxy/proxy_service.h" 18 #include "net/proxy/proxy_service.h"
19 #include "net/socket/client_socket_factory.h"
20 #include "net/spdy/spdy_session_pool.h"
18 #include "net/url_request/url_request.h" 21 #include "net/url_request/url_request.h"
19 #include "net/url_request/url_request_test_util.h" 22 #include "net/url_request/url_request_test_util.h"
20 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
21 24
22 class TestServerTest: public testing::Test { 25 class TestServerTest: public testing::Test {
23 protected: 26 protected:
24 virtual void SetUp() { 27 virtual void SetUp() {
25 PathService::Get(base::DIR_SOURCE_ROOT, &source_path_); 28 PathService::Get(base::DIR_SOURCE_ROOT, &source_path_);
26 source_path_ = source_path_.Append(FILE_PATH_LITERAL("chrome_frame")); 29 source_path_ = source_path_.Append(FILE_PATH_LITERAL("chrome_frame"));
27 } 30 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 URLRequestTestContext() { 66 URLRequestTestContext() {
64 host_resolver_ = 67 host_resolver_ =
65 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, 68 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism,
66 NULL, NULL); 69 NULL, NULL);
67 cert_verifier_ = new net::CertVerifier; 70 cert_verifier_ = new net::CertVerifier;
68 proxy_service_ = net::ProxyService::CreateDirect(); 71 proxy_service_ = net::ProxyService::CreateDirect();
69 ssl_config_service_ = new net::SSLConfigServiceDefaults; 72 ssl_config_service_ = new net::SSLConfigServiceDefaults;
70 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( 73 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(
71 host_resolver_); 74 host_resolver_);
72 http_transaction_factory_ = new net::HttpCache( 75 http_transaction_factory_ = new net::HttpCache(
73 net::HttpNetworkLayer::CreateFactory( 76 new net::HttpNetworkSession(
74 host_resolver_, 77 host_resolver_,
75 cert_verifier_, 78 cert_verifier_,
76 NULL /* dnsrr_resolver */, 79 NULL /* dnsrr_resolver */,
77 NULL /* dns_cert_checker */, 80 NULL /* dns_cert_checker */,
78 NULL /* ssl_host_info_factory */, 81 NULL /* ssl_host_info_factory */,
79 proxy_service_, 82 proxy_service_,
83 net::ClientSocketFactory::GetDefaultFactory(),
80 ssl_config_service_, 84 ssl_config_service_,
85 new net::SpdySessionPool(ssl_config_service_),
81 http_auth_handler_factory_, 86 http_auth_handler_factory_,
82 NULL /* network_delegate */, 87 NULL,
83 NULL /* net_log */), 88 NULL),
wtc 2011/01/28 01:51:23 Nit: add /* network_delegate */ and /* net_log */
84 NULL /* net_log */,
85 net::HttpCache::DefaultBackend::InMemory(0)); 89 net::HttpCache::DefaultBackend::InMemory(0));
86 // In-memory cookie store. 90 // In-memory cookie store.
87 cookie_store_ = new net::CookieMonster(NULL, NULL); 91 cookie_store_ = new net::CookieMonster(NULL, NULL);
88 } 92 }
89 93
90 virtual ~URLRequestTestContext() { 94 virtual ~URLRequestTestContext() {
91 delete http_transaction_factory_; 95 delete http_transaction_factory_;
92 delete http_auth_handler_factory_; 96 delete http_auth_handler_factory_;
93 delete cert_verifier_; 97 delete cert_verifier_;
94 delete host_resolver_; 98 delete host_resolver_;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 EXPECT_EQ(file.accessed(), 1); 208 EXPECT_EQ(file.accessed(), 1);
205 EXPECT_EQ(redir.accessed(), 1); 209 EXPECT_EQ(redir.accessed(), 1);
206 210
207 EXPECT_TRUE(person_task.response().find("Guthrie") != std::string::npos); 211 EXPECT_TRUE(person_task.response().find("Guthrie") != std::string::npos);
208 EXPECT_TRUE(file_task.response().find("function") != std::string::npos); 212 EXPECT_TRUE(file_task.response().find("function") != std::string::npos);
209 EXPECT_TRUE(goog_task.response().find("<title>") != std::string::npos); 213 EXPECT_TRUE(goog_task.response().find("<title>") != std::string::npos);
210 } else { 214 } else {
211 ::TerminateThread(worker, ~0); 215 ::TerminateThread(worker, ~0);
212 } 216 }
213 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698