Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: net/proxy/proxy_resolver_perftest.cc

Issue 160510: Better match IE's proxy settings.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix merge conflict Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_resolver_mac.h ('k') | net/proxy/proxy_resolver_v8.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "net/base/mock_host_resolver.h" 6 #include "net/base/mock_host_resolver.h"
7 #include "net/proxy/proxy_resolver_js_bindings.h" 7 #include "net/proxy/proxy_resolver_js_bindings.h"
8 #include "net/proxy/proxy_resolver_v8.h" 8 #include "net/proxy/proxy_resolver_v8.h"
9 #include "net/url_request/url_request_unittest.h" 9 #include "net/url_request/url_request_unittest.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 private: 92 private:
93 void RunTest(const std::string& script_name, 93 void RunTest(const std::string& script_name,
94 const PacQuery* queries, 94 const PacQuery* queries,
95 int queries_len) { 95 int queries_len) {
96 if (!resolver_->expects_pac_bytes()) { 96 if (!resolver_->expects_pac_bytes()) {
97 InitHttpServer(); 97 InitHttpServer();
98 GURL pac_url = 98 GURL pac_url =
99 server_->TestServerPage(std::string("files/") + script_name); 99 server_->TestServerPage(std::string("files/") + script_name);
100 resolver_->SetPacScriptByUrl(pac_url); 100 int rv = resolver_->SetPacScriptByUrl(pac_url, NULL);
101 EXPECT_EQ(net::OK, rv);
101 } else { 102 } else {
102 LoadPacScriptIntoResolver(script_name); 103 LoadPacScriptIntoResolver(script_name);
103 } 104 }
104 105
105 // Do a query to warm things up. In the case of internal-fetch proxy 106 // Do a query to warm things up. In the case of internal-fetch proxy
106 // resolvers, the first resolve will be slow since it has to download 107 // resolvers, the first resolve will be slow since it has to download
107 // the PAC script. 108 // the PAC script.
108 { 109 {
109 net::ProxyInfo proxy_info; 110 net::ProxyInfo proxy_info;
110 int result = resolver_->GetProxyForURL( 111 int result = resolver_->GetProxyForURL(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 157
157 // Try to read the file from disk. 158 // Try to read the file from disk.
158 std::string file_contents; 159 std::string file_contents;
159 bool ok = file_util::ReadFileToString(path, &file_contents); 160 bool ok = file_util::ReadFileToString(path, &file_contents);
160 161
161 // If we can't load the file from disk, something is misconfigured. 162 // If we can't load the file from disk, something is misconfigured.
162 LOG_IF(ERROR, !ok) << "Failed to read file: " << path.value(); 163 LOG_IF(ERROR, !ok) << "Failed to read file: " << path.value();
163 ASSERT_TRUE(ok); 164 ASSERT_TRUE(ok);
164 165
165 // Load the PAC script into the ProxyResolver. 166 // Load the PAC script into the ProxyResolver.
166 resolver_->SetPacScriptByData(file_contents); 167 int rv = resolver_->SetPacScriptByData(file_contents, NULL);
168 EXPECT_EQ(net::OK, rv);
167 } 169 }
168 170
169 net::ProxyResolver* resolver_; 171 net::ProxyResolver* resolver_;
170 std::string resolver_name_; 172 std::string resolver_name_;
171 scoped_refptr<HTTPTestServer> server_; 173 scoped_refptr<HTTPTestServer> server_;
172 }; 174 };
173 175
174 #if defined(OS_WIN) 176 #if defined(OS_WIN)
175 TEST(ProxyResolverPerfTest, ProxyResolverWinHttp) { 177 TEST(ProxyResolverPerfTest, ProxyResolverWinHttp) {
176 net::ProxyResolverWinHttp resolver; 178 net::ProxyResolverWinHttp resolver;
(...skipping 10 matching lines...) Expand all
187 189
188 TEST(ProxyResolverPerfTest, ProxyResolverV8) { 190 TEST(ProxyResolverPerfTest, ProxyResolverV8) {
189 net::ProxyResolverJSBindings* js_bindings = 191 net::ProxyResolverJSBindings* js_bindings =
190 net::ProxyResolverJSBindings::CreateDefault( 192 net::ProxyResolverJSBindings::CreateDefault(
191 new net::MockHostResolver, NULL); 193 new net::MockHostResolver, NULL);
192 194
193 net::ProxyResolverV8 resolver(js_bindings); 195 net::ProxyResolverV8 resolver(js_bindings);
194 PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8"); 196 PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8");
195 runner.RunAllTests(); 197 runner.RunAllTests();
196 } 198 }
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_mac.h ('k') | net/proxy/proxy_resolver_v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698