| 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 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 class NetLog; |
| 16 class URLRequestContext; | 17 class URLRequestContext; |
| 17 } // namespace net | 18 } // namespace net |
| 18 | 19 |
| 19 // ConnectionTester runs a suite of tests (also called "experiments"), | 20 // ConnectionTester runs a suite of tests (also called "experiments"), |
| 20 // to try and discover why loading a particular URL is failing with an error | 21 // to try and discover why loading a particular URL is failing with an error |
| 21 // code. | 22 // code. |
| 22 // | 23 // |
| 23 // For example, one reason why the URL might have failed, is that the | 24 // For example, one reason why the URL might have failed, is that the |
| 24 // network requires the URL to be routed through a proxy, however chrome is | 25 // network requires the URL to be routed through a proxy, however chrome is |
| 25 // not configured for that. | 26 // not configured for that. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 virtual void OnCompletedConnectionTestSuite() = 0; | 122 virtual void OnCompletedConnectionTestSuite() = 0; |
| 122 | 123 |
| 123 protected: | 124 protected: |
| 124 virtual ~Delegate() {} | 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, |
| 133 net::NetLog* net_log); |
| 132 | 134 |
| 133 // Note that destruction cancels any in-progress tests. | 135 // Note that destruction cancels any in-progress tests. |
| 134 ~ConnectionTester(); | 136 ~ConnectionTester(); |
| 135 | 137 |
| 136 // Starts running the test suite on |url|. Notification of progress is sent to | 138 // Starts running the test suite on |url|. Notification of progress is sent to |
| 137 // |delegate_|. | 139 // |delegate_|. |
| 138 void RunAllTests(const GURL& url); | 140 void RunAllTests(const GURL& url); |
| 139 | 141 |
| 140 // Returns a text string explaining what |experiment| is testing. | 142 // Returns a text string explaining what |experiment| is testing. |
| 141 static string16 ProxySettingsExperimentDescription( | 143 static string16 ProxySettingsExperimentDescription( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 169 | 171 |
| 170 // The current in-progress test, or NULL if there is no active test. | 172 // The current in-progress test, or NULL if there is no active test. |
| 171 scoped_ptr<TestRunner> current_test_runner_; | 173 scoped_ptr<TestRunner> current_test_runner_; |
| 172 | 174 |
| 173 // The ordered list of experiments to try next. The experiment at the front | 175 // The ordered list of experiments to try next. The experiment at the front |
| 174 // of the list is the one currently in progress. | 176 // of the list is the one currently in progress. |
| 175 ExperimentList remaining_experiments_; | 177 ExperimentList remaining_experiments_; |
| 176 | 178 |
| 177 net::URLRequestContext* const proxy_request_context_; | 179 net::URLRequestContext* const proxy_request_context_; |
| 178 | 180 |
| 181 net::NetLog* net_log_; |
| 182 |
| 179 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); | 183 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); |
| 180 }; | 184 }; |
| 181 | 185 |
| 182 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ | 186 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ |
| OLD | NEW |