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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 1342613002: Revert of Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « net/url_request/url_request_test_util.cc ('k') | net/url_request/view_cache_helper_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 7013 matching lines...) Expand 10 before | Expand all | Expand 10 after
7024 HttpNetworkSession::Params params; 7024 HttpNetworkSession::Params params;
7025 params.host_resolver = default_context_.host_resolver(); 7025 params.host_resolver = default_context_.host_resolver();
7026 params.cert_verifier = default_context_.cert_verifier(); 7026 params.cert_verifier = default_context_.cert_verifier();
7027 params.transport_security_state = default_context_.transport_security_state(); 7027 params.transport_security_state = default_context_.transport_security_state();
7028 params.proxy_service = default_context_.proxy_service(); 7028 params.proxy_service = default_context_.proxy_service();
7029 params.ssl_config_service = default_context_.ssl_config_service(); 7029 params.ssl_config_service = default_context_.ssl_config_service();
7030 params.http_auth_handler_factory = 7030 params.http_auth_handler_factory =
7031 default_context_.http_auth_handler_factory(); 7031 default_context_.http_auth_handler_factory();
7032 params.network_delegate = &default_network_delegate_; 7032 params.network_delegate = &default_network_delegate_;
7033 params.http_server_properties = default_context_.http_server_properties(); 7033 params.http_server_properties = default_context_.http_server_properties();
7034 scoped_ptr<HttpNetworkSession> network_session(
7035 new HttpNetworkSession(params));
7036 scoped_ptr<HttpNetworkLayer> network_layer( 7034 scoped_ptr<HttpNetworkLayer> network_layer(
7037 new HttpNetworkLayer(network_session.get())); 7035 new HttpNetworkLayer(new HttpNetworkSession(params)));
7038 network_layer->OnSuspend(); 7036 network_layer->OnSuspend();
7039 7037
7040 HttpCache http_cache(network_layer.release(), default_context_.net_log(), 7038 HttpCache http_cache(network_layer.release(), default_context_.net_log(),
7041 HttpCache::DefaultBackend::InMemory(0), true); 7039 HttpCache::DefaultBackend::InMemory(0));
7042 7040
7043 TestURLRequestContext context(true); 7041 TestURLRequestContext context(true);
7044 context.set_http_transaction_factory(&http_cache); 7042 context.set_http_transaction_factory(&http_cache);
7045 context.Init(); 7043 context.Init();
7046 7044
7047 TestDelegate d; 7045 TestDelegate d;
7048 scoped_ptr<URLRequest> req( 7046 scoped_ptr<URLRequest> req(
7049 context.CreateRequest(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d)); 7047 context.CreateRequest(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d));
7050 req->Start(); 7048 req->Start();
7051 base::RunLoop().Run(); 7049 base::RunLoop().Run();
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
8075 params.cert_verifier = default_context_.cert_verifier(); 8073 params.cert_verifier = default_context_.cert_verifier();
8076 params.transport_security_state = default_context_.transport_security_state(); 8074 params.transport_security_state = default_context_.transport_security_state();
8077 params.proxy_service = default_context_.proxy_service(); 8075 params.proxy_service = default_context_.proxy_service();
8078 params.ssl_config_service = default_context_.ssl_config_service(); 8076 params.ssl_config_service = default_context_.ssl_config_service();
8079 params.http_auth_handler_factory = 8077 params.http_auth_handler_factory =
8080 default_context_.http_auth_handler_factory(); 8078 default_context_.http_auth_handler_factory();
8081 params.network_delegate = &default_network_delegate_; 8079 params.network_delegate = &default_network_delegate_;
8082 params.http_server_properties = default_context_.http_server_properties(); 8080 params.http_server_properties = default_context_.http_server_properties();
8083 params.ssl_session_cache_shard = "alternate"; 8081 params.ssl_session_cache_shard = "alternate";
8084 8082
8085 scoped_ptr<HttpNetworkSession> network_session(
8086 new HttpNetworkSession(params));
8087 scoped_ptr<HttpCache> cache(new HttpCache( 8083 scoped_ptr<HttpCache> cache(new HttpCache(
8088 network_session.get(), HttpCache::DefaultBackend::InMemory(0), false)); 8084 new HttpNetworkSession(params),
8085 HttpCache::DefaultBackend::InMemory(0)));
8089 8086
8090 default_context_.set_http_transaction_factory(cache.get()); 8087 default_context_.set_http_transaction_factory(cache.get());
8091 8088
8092 { 8089 {
8093 TestDelegate d; 8090 TestDelegate d;
8094 scoped_ptr<URLRequest> r(default_context_.CreateRequest( 8091 scoped_ptr<URLRequest> r(default_context_.CreateRequest(
8095 test_server.GetURL("ssl-session-cache"), DEFAULT_PRIORITY, &d)); 8092 test_server.GetURL("ssl-session-cache"), DEFAULT_PRIORITY, &d));
8096 8093
8097 r->Start(); 8094 r->Start();
8098 EXPECT_TRUE(r->is_pending()); 8095 EXPECT_TRUE(r->is_pending());
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
9452 9449
9453 req->Start(); 9450 req->Start();
9454 req->Cancel(); 9451 req->Cancel();
9455 job->DetachRequest(); 9452 job->DetachRequest();
9456 base::RunLoop().RunUntilIdle(); 9453 base::RunLoop().RunUntilIdle();
9457 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); 9454 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status());
9458 EXPECT_EQ(0, d.received_redirect_count()); 9455 EXPECT_EQ(0, d.received_redirect_count());
9459 } 9456 }
9460 9457
9461 } // namespace net 9458 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_test_util.cc ('k') | net/url_request/view_cache_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698