| 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 #include "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/perftimer.h" | 9 #include "base/perftimer.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 // Helper class to run through all the performance tests using the specified | 92 // Helper class to run through all the performance tests using the specified |
| 93 // proxy resolver implementation. | 93 // proxy resolver implementation. |
| 94 class PacPerfSuiteRunner { | 94 class PacPerfSuiteRunner { |
| 95 public: | 95 public: |
| 96 // |resolver_name| is the label used when logging the results. | 96 // |resolver_name| is the label used when logging the results. |
| 97 PacPerfSuiteRunner(net::ProxyResolver* resolver, | 97 PacPerfSuiteRunner(net::ProxyResolver* resolver, |
| 98 const std::string& resolver_name) | 98 const std::string& resolver_name) |
| 99 : resolver_(resolver), | 99 : resolver_(resolver), |
| 100 resolver_name_(resolver_name), | 100 resolver_name_(resolver_name), |
| 101 test_server_(net::TestServer::TYPE_HTTP, | 101 test_server_( |
| 102 net::TestServer::TYPE_HTTP, |
| 103 net::TestServer::kLocalhost, |
| 102 FilePath(FILE_PATH_LITERAL("net/data/proxy_resolver_perftest"))) { | 104 FilePath(FILE_PATH_LITERAL("net/data/proxy_resolver_perftest"))) { |
| 103 } | 105 } |
| 104 | 106 |
| 105 void RunAllTests() { | 107 void RunAllTests() { |
| 106 ASSERT_TRUE(test_server_.Start()); | 108 ASSERT_TRUE(test_server_.Start()); |
| 107 for (size_t i = 0; i < arraysize(kPerfTests); ++i) { | 109 for (size_t i = 0; i < arraysize(kPerfTests); ++i) { |
| 108 const PacPerfTest& test_data = kPerfTests[i]; | 110 const PacPerfTest& test_data = kPerfTests[i]; |
| 109 RunTest(test_data.pac_name, | 111 RunTest(test_data.pac_name, |
| 110 test_data.queries, | 112 test_data.queries, |
| 111 test_data.NumQueries()); | 113 test_data.NumQueries()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 TEST(ProxyResolverPerfTest, ProxyResolverV8) { | 210 TEST(ProxyResolverPerfTest, ProxyResolverV8) { |
| 209 net::ProxyResolverJSBindings* js_bindings = | 211 net::ProxyResolverJSBindings* js_bindings = |
| 210 net::ProxyResolverJSBindings::CreateDefault( | 212 net::ProxyResolverJSBindings::CreateDefault( |
| 211 new MockSyncHostResolver, NULL, NULL); | 213 new MockSyncHostResolver, NULL, NULL); |
| 212 | 214 |
| 213 net::ProxyResolverV8 resolver(js_bindings); | 215 net::ProxyResolverV8 resolver(js_bindings); |
| 214 PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8"); | 216 PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8"); |
| 215 runner.RunAllTests(); | 217 runner.RunAllTests(); |
| 216 } | 218 } |
| 217 | 219 |
| OLD | NEW |