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

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

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed too much, back up a bit 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
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));
7034 scoped_ptr<HttpNetworkLayer> network_layer( 7036 scoped_ptr<HttpNetworkLayer> network_layer(
7035 new HttpNetworkLayer(new HttpNetworkSession(params))); 7037 new HttpNetworkLayer(network_session.get()));
7036 network_layer->OnSuspend(); 7038 network_layer->OnSuspend();
7037 7039
7038 HttpCache http_cache(network_layer.release(), default_context_.net_log(), 7040 HttpCache http_cache(network_layer.release(), default_context_.net_log(),
7039 HttpCache::DefaultBackend::InMemory(0)); 7041 HttpCache::DefaultBackend::InMemory(0), true);
pauljensen 2015/09/02 14:32:30 Can you explain your logic for setting set_up_quic
mmenke 2015/09/02 16:29:34 I tried to keep the existing logic. If the old co
7040 7042
7041 TestURLRequestContext context(true); 7043 TestURLRequestContext context(true);
7042 context.set_http_transaction_factory(&http_cache); 7044 context.set_http_transaction_factory(&http_cache);
7043 context.Init(); 7045 context.Init();
7044 7046
7045 TestDelegate d; 7047 TestDelegate d;
7046 scoped_ptr<URLRequest> req( 7048 scoped_ptr<URLRequest> req(
7047 context.CreateRequest(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d)); 7049 context.CreateRequest(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d));
7048 req->Start(); 7050 req->Start();
7049 base::RunLoop().Run(); 7051 base::RunLoop().Run();
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
8073 params.cert_verifier = default_context_.cert_verifier(); 8075 params.cert_verifier = default_context_.cert_verifier();
8074 params.transport_security_state = default_context_.transport_security_state(); 8076 params.transport_security_state = default_context_.transport_security_state();
8075 params.proxy_service = default_context_.proxy_service(); 8077 params.proxy_service = default_context_.proxy_service();
8076 params.ssl_config_service = default_context_.ssl_config_service(); 8078 params.ssl_config_service = default_context_.ssl_config_service();
8077 params.http_auth_handler_factory = 8079 params.http_auth_handler_factory =
8078 default_context_.http_auth_handler_factory(); 8080 default_context_.http_auth_handler_factory();
8079 params.network_delegate = &default_network_delegate_; 8081 params.network_delegate = &default_network_delegate_;
8080 params.http_server_properties = default_context_.http_server_properties(); 8082 params.http_server_properties = default_context_.http_server_properties();
8081 params.ssl_session_cache_shard = "alternate"; 8083 params.ssl_session_cache_shard = "alternate";
8082 8084
8085 scoped_ptr<HttpNetworkSession> network_session(
8086 new HttpNetworkSession(params));
8083 scoped_ptr<HttpCache> cache(new HttpCache( 8087 scoped_ptr<HttpCache> cache(new HttpCache(
8084 new HttpNetworkSession(params), 8088 network_session.get(), HttpCache::DefaultBackend::InMemory(0), false));
8085 HttpCache::DefaultBackend::InMemory(0)));
8086 8089
8087 default_context_.set_http_transaction_factory(cache.get()); 8090 default_context_.set_http_transaction_factory(cache.get());
8088 8091
8089 { 8092 {
8090 TestDelegate d; 8093 TestDelegate d;
8091 scoped_ptr<URLRequest> r(default_context_.CreateRequest( 8094 scoped_ptr<URLRequest> r(default_context_.CreateRequest(
8092 test_server.GetURL("ssl-session-cache"), DEFAULT_PRIORITY, &d)); 8095 test_server.GetURL("ssl-session-cache"), DEFAULT_PRIORITY, &d));
8093 8096
8094 r->Start(); 8097 r->Start();
8095 EXPECT_TRUE(r->is_pending()); 8098 EXPECT_TRUE(r->is_pending());
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
9449 9452
9450 req->Start(); 9453 req->Start();
9451 req->Cancel(); 9454 req->Cancel();
9452 job->DetachRequest(); 9455 job->DetachRequest();
9453 base::RunLoop().RunUntilIdle(); 9456 base::RunLoop().RunUntilIdle();
9454 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); 9457 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status());
9455 EXPECT_EQ(0, d.received_redirect_count()); 9458 EXPECT_EQ(0, d.received_redirect_count());
9456 } 9459 }
9457 9460
9458 } // namespace net 9461 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698