| 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 "chrome/browser/net/connection_tester.h" | 5 #include "chrome/browser/net/connection_tester.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
| 21 #include "net/base/request_priority.h" |
| 21 #include "net/cert/cert_verifier.h" | 22 #include "net/cert/cert_verifier.h" |
| 22 #include "net/cookies/cookie_monster.h" | 23 #include "net/cookies/cookie_monster.h" |
| 23 #include "net/dns/host_resolver.h" | 24 #include "net/dns/host_resolver.h" |
| 24 #include "net/http/http_auth_handler_factory.h" | 25 #include "net/http/http_auth_handler_factory.h" |
| 25 #include "net/http/http_cache.h" | 26 #include "net/http/http_cache.h" |
| 26 #include "net/http/http_network_session.h" | 27 #include "net/http/http_network_session.h" |
| 27 #include "net/http/http_server_properties_impl.h" | 28 #include "net/http/http_server_properties_impl.h" |
| 28 #include "net/http/transport_security_state.h" | 29 #include "net/http/transport_security_state.h" |
| 29 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" | 30 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
| 30 #include "net/proxy/proxy_config_service_fixed.h" | 31 #include "net/proxy/proxy_config_service_fixed.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 int status) { | 403 int status) { |
| 403 if (status == net::OK) | 404 if (status == net::OK) |
| 404 status = request_context_->Init(experiment, | 405 status = request_context_->Init(experiment, |
| 405 proxy_config_service, | 406 proxy_config_service, |
| 406 net_log_); | 407 net_log_); |
| 407 if (status != net::OK) { | 408 if (status != net::OK) { |
| 408 tester_->OnExperimentCompleted(status); | 409 tester_->OnExperimentCompleted(status); |
| 409 return; | 410 return; |
| 410 } | 411 } |
| 411 // Fetch a request using the experimental context. | 412 // Fetch a request using the experimental context. |
| 412 request_.reset(request_context_->CreateRequest(experiment.url, this)); | 413 request_ = request_context_->CreateRequest( |
| 414 experiment.url, net::DEFAULT_PRIORITY, this); |
| 413 request_->Start(); | 415 request_->Start(); |
| 414 } | 416 } |
| 415 | 417 |
| 416 void ConnectionTester::TestRunner::Run(const Experiment& experiment) { | 418 void ConnectionTester::TestRunner::Run(const Experiment& experiment) { |
| 417 // Try to create a net::URLRequestContext for this experiment. | 419 // Try to create a net::URLRequestContext for this experiment. |
| 418 request_context_.reset( | 420 request_context_.reset( |
| 419 new ExperimentURLRequestContext(tester_->proxy_request_context_)); | 421 new ExperimentURLRequestContext(tester_->proxy_request_context_)); |
| 420 scoped_ptr<net::ProxyConfigService>* proxy_config_service = | 422 scoped_ptr<net::ProxyConfigService>* proxy_config_service = |
| 421 new scoped_ptr<net::ProxyConfigService>(); | 423 new scoped_ptr<net::ProxyConfigService>(); |
| 422 base::Callback<void(int)> config_service_callback = | 424 base::Callback<void(int)> config_service_callback = |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 533 |
| 532 // Notify the delegate of completion. | 534 // Notify the delegate of completion. |
| 533 delegate_->OnCompletedConnectionTestExperiment(current, result); | 535 delegate_->OnCompletedConnectionTestExperiment(current, result); |
| 534 | 536 |
| 535 if (remaining_experiments_.empty()) { | 537 if (remaining_experiments_.empty()) { |
| 536 delegate_->OnCompletedConnectionTestSuite(); | 538 delegate_->OnCompletedConnectionTestSuite(); |
| 537 } else { | 539 } else { |
| 538 StartNextExperiment(); | 540 StartNextExperiment(); |
| 539 } | 541 } |
| 540 } | 542 } |
| OLD | NEW |