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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/test/perftimer.h" | 10 #include "base/test/perftimer.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 void LoadPacScriptIntoResolver(const std::string& script_name) { | 156 void LoadPacScriptIntoResolver(const std::string& script_name) { |
157 base::FilePath path; | 157 base::FilePath path; |
158 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 158 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
159 path = path.AppendASCII("net"); | 159 path = path.AppendASCII("net"); |
160 path = path.AppendASCII("data"); | 160 path = path.AppendASCII("data"); |
161 path = path.AppendASCII("proxy_resolver_perftest"); | 161 path = path.AppendASCII("proxy_resolver_perftest"); |
162 path = path.AppendASCII(script_name); | 162 path = path.AppendASCII(script_name); |
163 | 163 |
164 // Try to read the file from disk. | 164 // Try to read the file from disk. |
165 std::string file_contents; | 165 std::string file_contents; |
166 bool ok = file_util::ReadFileToString(path, &file_contents); | 166 bool ok = base::ReadFileToString(path, &file_contents); |
167 | 167 |
168 // If we can't load the file from disk, something is misconfigured. | 168 // If we can't load the file from disk, something is misconfigured. |
169 LOG_IF(ERROR, !ok) << "Failed to read file: " << path.value(); | 169 LOG_IF(ERROR, !ok) << "Failed to read file: " << path.value(); |
170 ASSERT_TRUE(ok); | 170 ASSERT_TRUE(ok); |
171 | 171 |
172 // Load the PAC script into the ProxyResolver. | 172 // Load the PAC script into the ProxyResolver. |
173 int rv = resolver_->SetPacScript( | 173 int rv = resolver_->SetPacScript( |
174 net::ProxyResolverScriptData::FromUTF8(file_contents), | 174 net::ProxyResolverScriptData::FromUTF8(file_contents), |
175 net::CompletionCallback()); | 175 net::CompletionCallback()); |
176 EXPECT_EQ(net::OK, rv); | 176 EXPECT_EQ(net::OK, rv); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 TEST(ProxyResolverPerfTest, ProxyResolverV8) { | 220 TEST(ProxyResolverPerfTest, ProxyResolverV8) { |
221 // This has to be done on the main thread. | 221 // This has to be done on the main thread. |
222 net::ProxyResolverV8::RememberDefaultIsolate(); | 222 net::ProxyResolverV8::RememberDefaultIsolate(); |
223 | 223 |
224 MockJSBindings js_bindings; | 224 MockJSBindings js_bindings; |
225 net::ProxyResolverV8 resolver; | 225 net::ProxyResolverV8 resolver; |
226 resolver.set_js_bindings(&js_bindings); | 226 resolver.set_js_bindings(&js_bindings); |
227 PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8"); | 227 PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8"); |
228 runner.RunAllTests(); | 228 runner.RunAllTests(); |
229 } | 229 } |
OLD | NEW |