| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 class IOThread; | 16 class URLRequestContext; |
| 17 | 17 |
| 18 // ConnectionTester runs a suite of tests (also called "experiments"), | 18 // ConnectionTester runs a suite of tests (also called "experiments"), |
| 19 // to try and discover why loading a particular URL is failing with an error | 19 // to try and discover why loading a particular URL is failing with an error |
| 20 // code. | 20 // code. |
| 21 // | 21 // |
| 22 // For example, one reason why the URL might have failed, is that the | 22 // 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 | 23 // network requires the URL to be routed through a proxy, however chrome is |
| 24 // not configured for that. | 24 // not configured for that. |
| 25 // | 25 // |
| 26 // The above issue might be detected by running test that fetches the URL using | 26 // The above issue might be detected by running test that fetches the URL using |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 const Experiment& experiment, | 118 const Experiment& experiment, |
| 119 int result) = 0; | 119 int result) = 0; |
| 120 | 120 |
| 121 // Called once ALL tests have completed. | 121 // Called once ALL tests have completed. |
| 122 virtual void OnCompletedConnectionTestSuite() = 0; | 122 virtual void OnCompletedConnectionTestSuite() = 0; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 // Constructs a ConnectionTester that notifies test progress to |delegate|. | 125 // Constructs a ConnectionTester that notifies test progress to |delegate|. |
| 126 // |delegate| is owned by the caller, and must remain valid for the lifetime | 126 // |delegate| is owned by the caller, and must remain valid for the lifetime |
| 127 // of ConnectionTester. | 127 // of ConnectionTester. |
| 128 ConnectionTester(Delegate* delegate, IOThread* io_thread); | 128 ConnectionTester(Delegate* delegate, |
| 129 URLRequestContext* proxy_request_context); |
| 129 | 130 |
| 130 // Note that destruction cancels any in-progress tests. | 131 // Note that destruction cancels any in-progress tests. |
| 131 ~ConnectionTester(); | 132 ~ConnectionTester(); |
| 132 | 133 |
| 133 // Starts running the test suite on |url|. Notification of progress is sent to | 134 // Starts running the test suite on |url|. Notification of progress is sent to |
| 134 // |delegate_|. | 135 // |delegate_|. |
| 135 void RunAllTests(const GURL& url); | 136 void RunAllTests(const GURL& url); |
| 136 | 137 |
| 137 // Returns a text string explaining what |experiment| is testing. | 138 // Returns a text string explaining what |experiment| is testing. |
| 138 static string16 ProxySettingsExperimentDescription( | 139 static string16 ProxySettingsExperimentDescription( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 164 // The object to notify test progress to. | 165 // The object to notify test progress to. |
| 165 Delegate* delegate_; | 166 Delegate* delegate_; |
| 166 | 167 |
| 167 // The current in-progress test, or NULL if there is no active test. | 168 // The current in-progress test, or NULL if there is no active test. |
| 168 scoped_ptr<TestRunner> current_test_runner_; | 169 scoped_ptr<TestRunner> current_test_runner_; |
| 169 | 170 |
| 170 // The ordered list of experiments to try next. The experiment at the front | 171 // The ordered list of experiments to try next. The experiment at the front |
| 171 // of the list is the one currently in progress. | 172 // of the list is the one currently in progress. |
| 172 ExperimentList remaining_experiments_; | 173 ExperimentList remaining_experiments_; |
| 173 | 174 |
| 174 IOThread* io_thread_; | 175 const scoped_refptr<URLRequestContext> proxy_request_context_; |
| 175 | 176 |
| 176 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); | 177 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); |
| 177 }; | 178 }; |
| 178 | 179 |
| 179 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ | 180 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ |
| 180 | |
| OLD | NEW |