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

Side by Side Diff: net/spdy/spdy_test_util.cc

Issue 6402002: Simplify HttpCache/HttpNetworkLayer/HttpNetworkSession interaction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 9 years, 11 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
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl_unittest.cc ('k') | net/tools/fetch/fetch_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/spdy/spdy_test_util.h" 5 #include "net/spdy/spdy_test_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "net/http/http_network_session.h"
12 #include "net/http/http_network_transaction.h" 13 #include "net/http/http_network_transaction.h"
13 #include "net/spdy/spdy_framer.h" 14 #include "net/spdy/spdy_framer.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 // Chop a frame into an array of MockWrites. 18 // Chop a frame into an array of MockWrites.
18 // |data| is the frame to chop. 19 // |data| is the frame to chop.
19 // |length| is the length of the frame to chop. 20 // |length| is the length of the frame to chop.
20 // |num_chunks| is the number of chunks to create. 21 // |num_chunks| is the number of chunks to create.
21 MockWrite* ChopWriteFrame(const char* data, int length, int num_chunks) { 22 MockWrite* ChopWriteFrame(const char* data, int length, int num_chunks) {
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 NULL); 918 NULL);
918 } 919 }
919 920
920 SpdyURLRequestContext::SpdyURLRequestContext() { 921 SpdyURLRequestContext::SpdyURLRequestContext() {
921 host_resolver_ = new MockHostResolver(); 922 host_resolver_ = new MockHostResolver();
922 cert_verifier_ = new CertVerifier; 923 cert_verifier_ = new CertVerifier;
923 proxy_service_ = ProxyService::CreateDirect(); 924 proxy_service_ = ProxyService::CreateDirect();
924 ssl_config_service_ = new SSLConfigServiceDefaults; 925 ssl_config_service_ = new SSLConfigServiceDefaults;
925 http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault( 926 http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault(
926 host_resolver_); 927 host_resolver_);
928 scoped_refptr<HttpNetworkSession> network_session(
929 new HttpNetworkSession(
930 host_resolver_,
931 cert_verifier_,
932 NULL /* dnsrr_resolver */,
933 NULL /* dns_cert_checker */,
934 NULL /* ssl_host_info_factory */,
935 proxy_service_,
936 &socket_factory_,
937 ssl_config_service_,
938 new SpdySessionPool(NULL),
939 http_auth_handler_factory_,
940 network_delegate_,
941 NULL /* net_log */));
927 http_transaction_factory_ = new HttpCache( 942 http_transaction_factory_ = new HttpCache(
928 new HttpNetworkLayer(&socket_factory_, 943 network_session,
929 host_resolver_,
930 cert_verifier_,
931 NULL /* dnsrr_resolver */,
932 NULL /* dns_cert_checker */,
933 NULL /* ssl_host_info_factory */,
934 proxy_service_,
935 ssl_config_service_,
936 new SpdySessionPool(NULL),
937 http_auth_handler_factory_,
938 network_delegate_,
939 NULL),
940 NULL /* net_log */,
941 HttpCache::DefaultBackend::InMemory(0)); 944 HttpCache::DefaultBackend::InMemory(0));
942 } 945 }
943 946
944 SpdyURLRequestContext::~SpdyURLRequestContext() { 947 SpdyURLRequestContext::~SpdyURLRequestContext() {
945 delete http_transaction_factory_; 948 delete http_transaction_factory_;
946 delete http_auth_handler_factory_; 949 delete http_auth_handler_factory_;
947 delete cert_verifier_; 950 delete cert_verifier_;
948 delete host_resolver_; 951 delete host_resolver_;
949 } 952 }
950 953
951 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type) { 954 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type) {
952 const SpdyHeaderInfo kHeader = { 955 const SpdyHeaderInfo kHeader = {
953 type, // Kind = Syn 956 type, // Kind = Syn
954 1, // Stream ID 957 1, // Stream ID
955 0, // Associated stream ID 958 0, // Associated stream ID
956 2, // Priority 959 2, // Priority
957 spdy::CONTROL_FLAG_FIN, // Control Flags 960 spdy::CONTROL_FLAG_FIN, // Control Flags
958 false, // Compressed 961 false, // Compressed
959 spdy::INVALID, // Status 962 spdy::INVALID, // Status
960 NULL, // Data 963 NULL, // Data
961 0, // Length 964 0, // Length
962 spdy::DATA_FLAG_NONE // Data Flags 965 spdy::DATA_FLAG_NONE // Data Flags
963 }; 966 };
964 return kHeader; 967 return kHeader;
965 } 968 }
966 } // namespace net 969 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl_unittest.cc ('k') | net/tools/fetch/fetch_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698