| 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 #ifndef CHROME_BROWSER_NET_CONNECTION_TESTER_H_ | 5 #ifndef CHROME_BROWSER_NET_CONNECTION_TESTER_H_ |
| 6 #define CHROME_BROWSER_NET_CONNECTION_TESTER_H_ | 6 #define CHROME_BROWSER_NET_CONNECTION_TESTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 typedef std::vector<Experiment> ExperimentList; | 97 typedef std::vector<Experiment> ExperimentList; |
| 98 | 98 |
| 99 // "Delegate" is an interface for receiving start and completion notification | 99 // "Delegate" is an interface for receiving start and completion notification |
| 100 // of individual tests that are run by the ConnectionTester. | 100 // of individual tests that are run by the ConnectionTester. |
| 101 // | 101 // |
| 102 // NOTE: do not delete the ConnectionTester when executing within one of the | 102 // NOTE: do not delete the ConnectionTester when executing within one of the |
| 103 // delegate methods. | 103 // delegate methods. |
| 104 class Delegate { | 104 class Delegate { |
| 105 public: | 105 public: |
| 106 virtual ~Delegate() {} | |
| 107 | |
| 108 // Called once the test suite is about to start. | 106 // Called once the test suite is about to start. |
| 109 virtual void OnStartConnectionTestSuite() = 0; | 107 virtual void OnStartConnectionTestSuite() = 0; |
| 110 | 108 |
| 111 // Called when an individual experiment is about to be started. | 109 // Called when an individual experiment is about to be started. |
| 112 virtual void OnStartConnectionTestExperiment( | 110 virtual void OnStartConnectionTestExperiment( |
| 113 const Experiment& experiment) = 0; | 111 const Experiment& experiment) = 0; |
| 114 | 112 |
| 115 // Called when an individual experiment has completed. | 113 // Called when an individual experiment has completed. |
| 116 // |experiment| - the experiment that has completed. | 114 // |experiment| - the experiment that has completed. |
| 117 // |result| - the net error that the experiment completed with | 115 // |result| - the net error that the experiment completed with |
| 118 // (or net::OK if it was success). | 116 // (or net::OK if it was success). |
| 119 virtual void OnCompletedConnectionTestExperiment( | 117 virtual void OnCompletedConnectionTestExperiment( |
| 120 const Experiment& experiment, | 118 const Experiment& experiment, |
| 121 int result) = 0; | 119 int result) = 0; |
| 122 | 120 |
| 123 // Called once ALL tests have completed. | 121 // Called once ALL tests have completed. |
| 124 virtual void OnCompletedConnectionTestSuite() = 0; | 122 virtual void OnCompletedConnectionTestSuite() = 0; |
| 123 |
| 124 protected: |
| 125 virtual ~Delegate() {} |
| 125 }; | 126 }; |
| 126 | 127 |
| 127 // Constructs a ConnectionTester that notifies test progress to |delegate|. | 128 // Constructs a ConnectionTester that notifies test progress to |delegate|. |
| 128 // |delegate| is owned by the caller, and must remain valid for the lifetime | 129 // |delegate| is owned by the caller, and must remain valid for the lifetime |
| 129 // of ConnectionTester. | 130 // of ConnectionTester. |
| 130 ConnectionTester(Delegate* delegate, | 131 ConnectionTester(Delegate* delegate, |
| 131 net::URLRequestContext* proxy_request_context); | 132 net::URLRequestContext* proxy_request_context); |
| 132 | 133 |
| 133 // Note that destruction cancels any in-progress tests. | 134 // Note that destruction cancels any in-progress tests. |
| 134 ~ConnectionTester(); | 135 ~ConnectionTester(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // The ordered list of experiments to try next. The experiment at the front | 174 // The ordered list of experiments to try next. The experiment at the front |
| 174 // of the list is the one currently in progress. | 175 // of the list is the one currently in progress. |
| 175 ExperimentList remaining_experiments_; | 176 ExperimentList remaining_experiments_; |
| 176 | 177 |
| 177 net::URLRequestContext* const proxy_request_context_; | 178 net::URLRequestContext* const proxy_request_context_; |
| 178 | 179 |
| 179 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); | 180 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); |
| 180 }; | 181 }; |
| 181 | 182 |
| 182 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ | 183 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ |
| OLD | NEW |