| OLD | NEW |
| 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 7063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7074 HttpNetworkSession::Params params; | 7074 HttpNetworkSession::Params params; |
| 7075 params.host_resolver = default_context_.host_resolver(); | 7075 params.host_resolver = default_context_.host_resolver(); |
| 7076 params.cert_verifier = default_context_.cert_verifier(); | 7076 params.cert_verifier = default_context_.cert_verifier(); |
| 7077 params.transport_security_state = default_context_.transport_security_state(); | 7077 params.transport_security_state = default_context_.transport_security_state(); |
| 7078 params.proxy_service = default_context_.proxy_service(); | 7078 params.proxy_service = default_context_.proxy_service(); |
| 7079 params.ssl_config_service = default_context_.ssl_config_service(); | 7079 params.ssl_config_service = default_context_.ssl_config_service(); |
| 7080 params.http_auth_handler_factory = | 7080 params.http_auth_handler_factory = |
| 7081 default_context_.http_auth_handler_factory(); | 7081 default_context_.http_auth_handler_factory(); |
| 7082 params.network_delegate = &default_network_delegate_; | 7082 params.network_delegate = &default_network_delegate_; |
| 7083 params.http_server_properties = default_context_.http_server_properties(); | 7083 params.http_server_properties = default_context_.http_server_properties(); |
| 7084 scoped_ptr<HttpNetworkSession> network_session( |
| 7085 new HttpNetworkSession(params)); |
| 7084 scoped_ptr<HttpNetworkLayer> network_layer( | 7086 scoped_ptr<HttpNetworkLayer> network_layer( |
| 7085 new HttpNetworkLayer(new HttpNetworkSession(params))); | 7087 new HttpNetworkLayer(network_session.get())); |
| 7086 network_layer->OnSuspend(); | 7088 network_layer->OnSuspend(); |
| 7087 | 7089 |
| 7088 HttpCache http_cache(network_layer.release(), default_context_.net_log(), | 7090 HttpCache http_cache(network_layer.release(), default_context_.net_log(), |
| 7089 HttpCache::DefaultBackend::InMemory(0)); | 7091 HttpCache::DefaultBackend::InMemory(0), true); |
| 7090 | 7092 |
| 7091 TestURLRequestContext context(true); | 7093 TestURLRequestContext context(true); |
| 7092 context.set_http_transaction_factory(&http_cache); | 7094 context.set_http_transaction_factory(&http_cache); |
| 7093 context.Init(); | 7095 context.Init(); |
| 7094 | 7096 |
| 7095 TestDelegate d; | 7097 TestDelegate d; |
| 7096 scoped_ptr<URLRequest> req( | 7098 scoped_ptr<URLRequest> req( |
| 7097 context.CreateRequest(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d)); | 7099 context.CreateRequest(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d)); |
| 7098 req->Start(); | 7100 req->Start(); |
| 7099 base::RunLoop().Run(); | 7101 base::RunLoop().Run(); |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8142 params.cert_verifier = default_context_.cert_verifier(); | 8144 params.cert_verifier = default_context_.cert_verifier(); |
| 8143 params.transport_security_state = default_context_.transport_security_state(); | 8145 params.transport_security_state = default_context_.transport_security_state(); |
| 8144 params.proxy_service = default_context_.proxy_service(); | 8146 params.proxy_service = default_context_.proxy_service(); |
| 8145 params.ssl_config_service = default_context_.ssl_config_service(); | 8147 params.ssl_config_service = default_context_.ssl_config_service(); |
| 8146 params.http_auth_handler_factory = | 8148 params.http_auth_handler_factory = |
| 8147 default_context_.http_auth_handler_factory(); | 8149 default_context_.http_auth_handler_factory(); |
| 8148 params.network_delegate = &default_network_delegate_; | 8150 params.network_delegate = &default_network_delegate_; |
| 8149 params.http_server_properties = default_context_.http_server_properties(); | 8151 params.http_server_properties = default_context_.http_server_properties(); |
| 8150 params.ssl_session_cache_shard = "alternate"; | 8152 params.ssl_session_cache_shard = "alternate"; |
| 8151 | 8153 |
| 8154 scoped_ptr<HttpNetworkSession> network_session( |
| 8155 new HttpNetworkSession(params)); |
| 8152 scoped_ptr<HttpCache> cache(new HttpCache( | 8156 scoped_ptr<HttpCache> cache(new HttpCache( |
| 8153 new HttpNetworkSession(params), | 8157 network_session.get(), HttpCache::DefaultBackend::InMemory(0), false)); |
| 8154 HttpCache::DefaultBackend::InMemory(0))); | |
| 8155 | 8158 |
| 8156 default_context_.set_http_transaction_factory(cache.get()); | 8159 default_context_.set_http_transaction_factory(cache.get()); |
| 8157 | 8160 |
| 8158 { | 8161 { |
| 8159 TestDelegate d; | 8162 TestDelegate d; |
| 8160 scoped_ptr<URLRequest> r(default_context_.CreateRequest( | 8163 scoped_ptr<URLRequest> r(default_context_.CreateRequest( |
| 8161 test_server.GetURL("ssl-session-cache"), DEFAULT_PRIORITY, &d)); | 8164 test_server.GetURL("ssl-session-cache"), DEFAULT_PRIORITY, &d)); |
| 8162 | 8165 |
| 8163 r->Start(); | 8166 r->Start(); |
| 8164 EXPECT_TRUE(r->is_pending()); | 8167 EXPECT_TRUE(r->is_pending()); |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9503 | 9506 |
| 9504 req->Start(); | 9507 req->Start(); |
| 9505 req->Cancel(); | 9508 req->Cancel(); |
| 9506 job->DetachRequest(); | 9509 job->DetachRequest(); |
| 9507 base::RunLoop().RunUntilIdle(); | 9510 base::RunLoop().RunUntilIdle(); |
| 9508 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); | 9511 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); |
| 9509 EXPECT_EQ(0, d.received_redirect_count()); | 9512 EXPECT_EQ(0, d.received_redirect_count()); |
| 9510 } | 9513 } |
| 9511 | 9514 |
| 9512 } // namespace net | 9515 } // namespace net |
| OLD | NEW |