| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 15 | 15 |
| 16 namespace net { |
| 16 class URLRequestContext; | 17 class URLRequestContext; |
| 18 } // namespace net |
| 17 | 19 |
| 18 // ConnectionTester runs a suite of tests (also called "experiments"), | 20 // ConnectionTester runs a suite of tests (also called "experiments"), |
| 19 // 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 |
| 20 // code. | 22 // code. |
| 21 // | 23 // |
| 22 // 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 |
| 23 // 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 |
| 24 // not configured for that. | 26 // not configured for that. |
| 25 // | 27 // |
| 26 // The above issue might be detected by running test that fetches the URL using | 28 // The above issue might be detected by running test that fetches the URL using |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 int result) = 0; | 121 int result) = 0; |
| 120 | 122 |
| 121 // Called once ALL tests have completed. | 123 // Called once ALL tests have completed. |
| 122 virtual void OnCompletedConnectionTestSuite() = 0; | 124 virtual void OnCompletedConnectionTestSuite() = 0; |
| 123 }; | 125 }; |
| 124 | 126 |
| 125 // Constructs a ConnectionTester that notifies test progress to |delegate|. | 127 // Constructs a ConnectionTester that notifies test progress to |delegate|. |
| 126 // |delegate| is owned by the caller, and must remain valid for the lifetime | 128 // |delegate| is owned by the caller, and must remain valid for the lifetime |
| 127 // of ConnectionTester. | 129 // of ConnectionTester. |
| 128 ConnectionTester(Delegate* delegate, | 130 ConnectionTester(Delegate* delegate, |
| 129 URLRequestContext* proxy_request_context); | 131 net::URLRequestContext* proxy_request_context); |
| 130 | 132 |
| 131 // Note that destruction cancels any in-progress tests. | 133 // Note that destruction cancels any in-progress tests. |
| 132 ~ConnectionTester(); | 134 ~ConnectionTester(); |
| 133 | 135 |
| 134 // Starts running the test suite on |url|. Notification of progress is sent to | 136 // Starts running the test suite on |url|. Notification of progress is sent to |
| 135 // |delegate_|. | 137 // |delegate_|. |
| 136 void RunAllTests(const GURL& url); | 138 void RunAllTests(const GURL& url); |
| 137 | 139 |
| 138 // Returns a text string explaining what |experiment| is testing. | 140 // Returns a text string explaining what |experiment| is testing. |
| 139 static string16 ProxySettingsExperimentDescription( | 141 static string16 ProxySettingsExperimentDescription( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 165 // The object to notify test progress to. | 167 // The object to notify test progress to. |
| 166 Delegate* delegate_; | 168 Delegate* delegate_; |
| 167 | 169 |
| 168 // The current in-progress test, or NULL if there is no active test. | 170 // The current in-progress test, or NULL if there is no active test. |
| 169 scoped_ptr<TestRunner> current_test_runner_; | 171 scoped_ptr<TestRunner> current_test_runner_; |
| 170 | 172 |
| 171 // The ordered list of experiments to try next. The experiment at the front | 173 // The ordered list of experiments to try next. The experiment at the front |
| 172 // of the list is the one currently in progress. | 174 // of the list is the one currently in progress. |
| 173 ExperimentList remaining_experiments_; | 175 ExperimentList remaining_experiments_; |
| 174 | 176 |
| 175 const scoped_refptr<URLRequestContext> proxy_request_context_; | 177 const scoped_refptr<net::URLRequestContext> proxy_request_context_; |
| 176 | 178 |
| 177 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); | 179 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); |
| 178 }; | 180 }; |
| 179 | 181 |
| 180 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ | 182 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ |
| OLD | NEW |