| 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 NetLog; |
| 17 class URLRequestContext; | 17 class URLRequestContext; |
| 18 } // namespace net | 18 } // namespace net |
| 19 | 19 |
| 20 namespace v8 { |
| 21 class Isolate; |
| 22 } // namespace v8 |
| 23 |
| 20 // ConnectionTester runs a suite of tests (also called "experiments"), | 24 // ConnectionTester runs a suite of tests (also called "experiments"), |
| 21 // to try and discover why loading a particular URL is failing with an error | 25 // to try and discover why loading a particular URL is failing with an error |
| 22 // code. | 26 // code. |
| 23 // | 27 // |
| 24 // For example, one reason why the URL might have failed, is that the | 28 // For example, one reason why the URL might have failed, is that the |
| 25 // network requires the URL to be routed through a proxy, however chrome is | 29 // network requires the URL to be routed through a proxy, however chrome is |
| 26 // not configured for that. | 30 // not configured for that. |
| 27 // | 31 // |
| 28 // The above issue might be detected by running test that fetches the URL using | 32 // The above issue might be detected by running test that fetches the URL using |
| 29 // auto-detect and seeing if it works this time. Or even by retrieving the | 33 // auto-detect and seeing if it works this time. Or even by retrieving the |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 127 |
| 124 protected: | 128 protected: |
| 125 virtual ~Delegate() {} | 129 virtual ~Delegate() {} |
| 126 }; | 130 }; |
| 127 | 131 |
| 128 // Constructs a ConnectionTester that notifies test progress to |delegate|. | 132 // Constructs a ConnectionTester that notifies test progress to |delegate|. |
| 129 // |delegate| is owned by the caller, and must remain valid for the lifetime | 133 // |delegate| is owned by the caller, and must remain valid for the lifetime |
| 130 // of ConnectionTester. | 134 // of ConnectionTester. |
| 131 ConnectionTester(Delegate* delegate, | 135 ConnectionTester(Delegate* delegate, |
| 132 net::URLRequestContext* proxy_request_context, | 136 net::URLRequestContext* proxy_request_context, |
| 133 net::NetLog* net_log); | 137 net::NetLog* net_log, |
| 138 v8::Isolate* v8_default_isolate); |
| 134 | 139 |
| 135 // Note that destruction cancels any in-progress tests. | 140 // Note that destruction cancels any in-progress tests. |
| 136 ~ConnectionTester(); | 141 ~ConnectionTester(); |
| 137 | 142 |
| 138 // Starts running the test suite on |url|. Notification of progress is sent to | 143 // Starts running the test suite on |url|. Notification of progress is sent to |
| 139 // |delegate_|. | 144 // |delegate_|. |
| 140 void RunAllTests(const GURL& url); | 145 void RunAllTests(const GURL& url); |
| 141 | 146 |
| 142 // Returns a text string explaining what |experiment| is testing. | 147 // Returns a text string explaining what |experiment| is testing. |
| 143 static string16 ProxySettingsExperimentDescription( | 148 static string16 ProxySettingsExperimentDescription( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 173 scoped_ptr<TestRunner> current_test_runner_; | 178 scoped_ptr<TestRunner> current_test_runner_; |
| 174 | 179 |
| 175 // The ordered list of experiments to try next. The experiment at the front | 180 // The ordered list of experiments to try next. The experiment at the front |
| 176 // of the list is the one currently in progress. | 181 // of the list is the one currently in progress. |
| 177 ExperimentList remaining_experiments_; | 182 ExperimentList remaining_experiments_; |
| 178 | 183 |
| 179 net::URLRequestContext* const proxy_request_context_; | 184 net::URLRequestContext* const proxy_request_context_; |
| 180 | 185 |
| 181 net::NetLog* net_log_; | 186 net::NetLog* net_log_; |
| 182 | 187 |
| 188 v8::Isolate* v8_default_isolate_; |
| 189 |
| 183 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); | 190 DISALLOW_COPY_AND_ASSIGN(ConnectionTester); |
| 184 }; | 191 }; |
| 185 | 192 |
| 186 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ | 193 #endif // CHROME_BROWSER_NET_CONNECTION_TESTER_H_ |
| OLD | NEW |