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

Side by Side Diff: chrome/browser/net/chrome_network_delegate_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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
OLDNEW
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 "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/prefs/pref_member.h" 10 #include "base/prefs/pref_member.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 CheckAddedParameters("http://google.com/?" + kSsuiParameter + "&q=goog&" + 228 CheckAddedParameters("http://google.com/?" + kSsuiParameter + "&q=goog&" +
229 kSafeParameter, 229 kSafeParameter,
230 "q=goog&" + kBothParameters); 230 "q=goog&" + kBothParameters);
231 231
232 CheckAddedParameters("http://google.com/?" + kSsuiParameter + "&" + 232 CheckAddedParameters("http://google.com/?" + kSsuiParameter + "&" +
233 kSafeParameter + "&q=goog", 233 kSafeParameter + "&q=goog",
234 "q=goog&" + kBothParameters); 234 "q=goog&" + kBothParameters);
235 235
236 // Test that another website is not affected, without parameters. 236 // Test that another website is not affected, without parameters.
237 CheckAddedParameters("http://google.com/finance", ""); 237 CheckAddedParameters("http://google.com/finance", std::string());
238 238
239 // Test that another website is not affected, with parameters. 239 // Test that another website is not affected, with parameters.
240 CheckAddedParameters("http://google.com/finance?q=goog", "q=goog"); 240 CheckAddedParameters("http://google.com/finance?q=goog", "q=goog");
241 241
242 // Test that another website is not affected with redirects, with parameters. 242 // Test that another website is not affected with redirects, with parameters.
243 CheckAddedParameters("http://finance.google.com/?q=goog", "q=goog"); 243 CheckAddedParameters("http://finance.google.com/?q=goog", "q=goog");
244 244
245 // Test with percent-encoded data (%26 is &) 245 // Test with percent-encoded data (%26 is &)
246 CheckAddedParameters("http://google.com/?q=%26%26%26&" + kSsuiParameter + 246 CheckAddedParameters("http://google.com/?q=%26%26%26&" + kSsuiParameter +
247 "&" + kSafeParameter + "&param=%26%26%26", 247 "&" + kSafeParameter + "&param=%26%26%26",
248 "q=%26%26%26&param=%26%26%26&" + kBothParameters); 248 "q=%26%26%26&param=%26%26%26&" + kBothParameters);
249 } 249 }
250 250
251 TEST_F(ChromeNetworkDelegateSafeSearchTest, SafeSearchOff) { 251 TEST_F(ChromeNetworkDelegateSafeSearchTest, SafeSearchOff) {
252 // Tests with SafeSearch settings off, delegate should not alter requests. 252 // Tests with SafeSearch settings off, delegate should not alter requests.
253 SetSafeSearch(false); 253 SetSafeSearch(false);
254 scoped_ptr<net::NetworkDelegate> delegate(CreateNetworkDelegate()); 254 scoped_ptr<net::NetworkDelegate> delegate(CreateNetworkDelegate());
255 SetDelegate(delegate.get()); 255 SetDelegate(delegate.get());
256 256
257 // Test the home page. 257 // Test the home page.
258 CheckAddedParameters("http://google.com/", ""); 258 CheckAddedParameters("http://google.com/", std::string());
259 259
260 // Test the search home page. 260 // Test the search home page.
261 CheckAddedParameters("http://google.com/webhp", ""); 261 CheckAddedParameters("http://google.com/webhp", std::string());
262 262
263 // Test the home page with parameters. 263 // Test the home page with parameters.
264 CheckAddedParameters("http://google.com/search?q=google", 264 CheckAddedParameters("http://google.com/search?q=google",
265 "q=google"); 265 "q=google");
266 266
267 // Test the search page with parameters. 267 // Test the search page with parameters.
268 CheckAddedParameters("http://google.com/?q=google", 268 CheckAddedParameters("http://google.com/?q=google",
269 "q=google"); 269 "q=google");
270 270
271 // Test the search webhp page with parameters. 271 // Test the search webhp page with parameters.
272 CheckAddedParameters("http://google.com/webhp?q=google", 272 CheckAddedParameters("http://google.com/webhp?q=google",
273 "q=google"); 273 "q=google");
274 274
275 // Test the home page with parameters and safe set to off. 275 // Test the home page with parameters and safe set to off.
276 CheckAddedParameters("http://google.com/search?q=google&safe=off", 276 CheckAddedParameters("http://google.com/search?q=google&safe=off",
277 "q=google&safe=off"); 277 "q=google&safe=off");
278 278
279 // Test the home page with parameters and safe set to active. 279 // Test the home page with parameters and safe set to active.
280 CheckAddedParameters("http://google.com/search?q=google&safe=active", 280 CheckAddedParameters("http://google.com/search?q=google&safe=active",
281 "q=google&safe=active"); 281 "q=google&safe=active");
282 } 282 }
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc ('k') | chrome/browser/net/dns_probe_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698