| 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 #include "base/perftimer.h" | 5 #include "base/perftimer.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "net/base/mock_host_resolver.h" | 7 #include "net/base/mock_host_resolver.h" |
| 8 #include "net/proxy/proxy_resolver_js_bindings.h" | 8 #include "net/proxy/proxy_resolver_js_bindings.h" |
| 9 #include "net/proxy/proxy_resolver_v8.h" | 9 #include "net/proxy/proxy_resolver_v8.h" |
| 10 #include "net/url_request/url_request_unittest.h" | 10 #include "net/url_request/url_request_unittest.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 // Print how long the test ran for. | 139 // Print how long the test ran for. |
| 140 timer.Done(); | 140 timer.Done(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Lazily startup an HTTP server (to serve the PAC script). | 143 // Lazily startup an HTTP server (to serve the PAC script). |
| 144 void InitHttpServer() { | 144 void InitHttpServer() { |
| 145 DCHECK(!resolver_->expects_pac_bytes()); | 145 DCHECK(!resolver_->expects_pac_bytes()); |
| 146 if (!server_) { | 146 if (!server_) { |
| 147 server_ = HTTPTestServer::CreateServer( | 147 server_ = HTTPTestServer::CreateServer( |
| 148 L"net/data/proxy_resolver_perftest", NULL); | 148 L"net/data/proxy_resolver_perftest"); |
| 149 } | 149 } |
| 150 ASSERT_TRUE(server_.get() != NULL); | 150 ASSERT_TRUE(server_.get() != NULL); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Read the PAC script from disk and initialize the proxy resolver with it. | 153 // Read the PAC script from disk and initialize the proxy resolver with it. |
| 154 void LoadPacScriptIntoResolver(const std::string& script_name) { | 154 void LoadPacScriptIntoResolver(const std::string& script_name) { |
| 155 FilePath path; | 155 FilePath path; |
| 156 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 156 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 157 path = path.AppendASCII("net"); | 157 path = path.AppendASCII("net"); |
| 158 path = path.AppendASCII("data"); | 158 path = path.AppendASCII("data"); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 TEST(ProxyResolverPerfTest, ProxyResolverV8) { | 195 TEST(ProxyResolverPerfTest, ProxyResolverV8) { |
| 196 net::ProxyResolverJSBindings* js_bindings = | 196 net::ProxyResolverJSBindings* js_bindings = |
| 197 net::ProxyResolverJSBindings::CreateDefault( | 197 net::ProxyResolverJSBindings::CreateDefault( |
| 198 new net::MockHostResolver, NULL); | 198 new net::MockHostResolver, NULL); |
| 199 | 199 |
| 200 net::ProxyResolverV8 resolver(js_bindings); | 200 net::ProxyResolverV8 resolver(js_bindings); |
| 201 PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8"); | 201 PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8"); |
| 202 runner.RunAllTests(); | 202 runner.RunAllTests(); |
| 203 } | 203 } |
| 204 | 204 |
| OLD | NEW |