| 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 "chrome/test/base/testing_pref_service.h" | 7 #include "chrome/test/base/testing_pref_service.h" |
| 8 #include "content/public/test/test_browser_thread.h" | 8 #include "content/public/test/test_browser_thread.h" |
| 9 #include "net/base/mock_cert_verifier.h" | 9 #include "net/base/mock_cert_verifier.h" |
| 10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // the delegate's methods were invoked. | 30 // the delegate's methods were invoked. |
| 31 class ConnectionTesterDelegate : public ConnectionTester::Delegate { | 31 class ConnectionTesterDelegate : public ConnectionTester::Delegate { |
| 32 public: | 32 public: |
| 33 ConnectionTesterDelegate() | 33 ConnectionTesterDelegate() |
| 34 : start_connection_test_suite_count_(0), | 34 : start_connection_test_suite_count_(0), |
| 35 start_connection_test_experiment_count_(0), | 35 start_connection_test_experiment_count_(0), |
| 36 completed_connection_test_experiment_count_(0), | 36 completed_connection_test_experiment_count_(0), |
| 37 completed_connection_test_suite_count_(0) { | 37 completed_connection_test_suite_count_(0) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual void OnStartConnectionTestSuite() { | 40 virtual void OnStartConnectionTestSuite() OVERRIDE { |
| 41 start_connection_test_suite_count_++; | 41 start_connection_test_suite_count_++; |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual void OnStartConnectionTestExperiment( | 44 virtual void OnStartConnectionTestExperiment( |
| 45 const ConnectionTester::Experiment& experiment) { | 45 const ConnectionTester::Experiment& experiment) OVERRIDE { |
| 46 start_connection_test_experiment_count_++; | 46 start_connection_test_experiment_count_++; |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void OnCompletedConnectionTestExperiment( | 49 virtual void OnCompletedConnectionTestExperiment( |
| 50 const ConnectionTester::Experiment& experiment, | 50 const ConnectionTester::Experiment& experiment, |
| 51 int result) { | 51 int result) OVERRIDE { |
| 52 completed_connection_test_experiment_count_++; | 52 completed_connection_test_experiment_count_++; |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual void OnCompletedConnectionTestSuite() { | 55 virtual void OnCompletedConnectionTestSuite() OVERRIDE { |
| 56 completed_connection_test_suite_count_++; | 56 completed_connection_test_suite_count_++; |
| 57 MessageLoop::current()->Quit(); | 57 MessageLoop::current()->Quit(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 int start_connection_test_suite_count() const { | 60 int start_connection_test_suite_count() const { |
| 61 return start_connection_test_suite_count_; | 61 return start_connection_test_suite_count_; |
| 62 } | 62 } |
| 63 | 63 |
| 64 int start_connection_test_experiment_count() const { | 64 int start_connection_test_experiment_count() const { |
| 65 return start_connection_test_experiment_count_; | 65 return start_connection_test_experiment_count_; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // any pending tasks instead of running them. This causes a problem with | 201 // any pending tasks instead of running them. This causes a problem with |
| 202 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer | 202 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer |
| 203 // |backup_task| that it will try to deref during the destructor, but | 203 // |backup_task| that it will try to deref during the destructor, but |
| 204 // depending on the order that pending tasks were deleted in, it might | 204 // depending on the order that pending tasks were deleted in, it might |
| 205 // already be invalid! See http://crbug.com/43291. | 205 // already be invalid! See http://crbug.com/43291. |
| 206 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 206 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 207 MessageLoop::current()->Run(); | 207 MessageLoop::current()->Run(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace | 210 } // namespace |
| OLD | NEW |