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

Side by Side Diff: chrome/browser/extensions/api/proxy/proxy_api_helpers_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 // Unit tests for helper functions for the Chrome Extensions Proxy Settings API. 5 // Unit tests for helper functions for the Chrome Extensions Proxy Settings API.
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/api/proxy/proxy_api_constants.h" 9 #include "chrome/browser/extensions/api/proxy/proxy_api_constants.h"
10 #include "chrome/browser/extensions/api/proxy/proxy_api_helpers.h" 10 #include "chrome/browser/extensions/api/proxy/proxy_api_helpers.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 &bad_message)); 215 &bad_message));
216 EXPECT_EQ("host1,host2", out); 216 EXPECT_EQ("host1,host2", out);
217 EXPECT_EQ(std::string(), error); 217 EXPECT_EQ(std::string(), error);
218 EXPECT_FALSE(bad_message); 218 EXPECT_FALSE(bad_message);
219 } 219 }
220 220
221 TEST(ExtensionProxyApiHelpers, CreateProxyConfigDict) { 221 TEST(ExtensionProxyApiHelpers, CreateProxyConfigDict) {
222 std::string error; 222 std::string error;
223 scoped_ptr<DictionaryValue> exp_direct(ProxyConfigDictionary::CreateDirect()); 223 scoped_ptr<DictionaryValue> exp_direct(ProxyConfigDictionary::CreateDirect());
224 scoped_ptr<DictionaryValue> out_direct( 224 scoped_ptr<DictionaryValue> out_direct(
225 CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT, false, "", "", "", "", 225 CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT,
226 false,
227 std::string(),
228 std::string(),
229 std::string(),
230 std::string(),
226 &error)); 231 &error));
227 EXPECT_TRUE(Value::Equals(exp_direct.get(), out_direct.get())); 232 EXPECT_TRUE(Value::Equals(exp_direct.get(), out_direct.get()));
228 233
229 scoped_ptr<DictionaryValue> exp_auto( 234 scoped_ptr<DictionaryValue> exp_auto(
230 ProxyConfigDictionary::CreateAutoDetect()); 235 ProxyConfigDictionary::CreateAutoDetect());
231 scoped_ptr<DictionaryValue> out_auto( 236 scoped_ptr<DictionaryValue> out_auto(
232 CreateProxyConfigDict(ProxyPrefs::MODE_AUTO_DETECT, false, "", "", "", "", 237 CreateProxyConfigDict(ProxyPrefs::MODE_AUTO_DETECT,
238 false,
239 std::string(),
240 std::string(),
241 std::string(),
242 std::string(),
233 &error)); 243 &error));
234 EXPECT_TRUE(Value::Equals(exp_auto.get(), out_auto.get())); 244 EXPECT_TRUE(Value::Equals(exp_auto.get(), out_auto.get()));
235 245
236 scoped_ptr<DictionaryValue> exp_pac_url( 246 scoped_ptr<DictionaryValue> exp_pac_url(
237 ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false)); 247 ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false));
238 scoped_ptr<DictionaryValue> out_pac_url( 248 scoped_ptr<DictionaryValue> out_pac_url(
239 CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, false, 249 CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT,
240 kSamplePacScriptUrl, "", "", "", &error)); 250 false,
251 kSamplePacScriptUrl,
252 std::string(),
253 std::string(),
254 std::string(),
255 &error));
241 EXPECT_TRUE(Value::Equals(exp_pac_url.get(), out_pac_url.get())); 256 EXPECT_TRUE(Value::Equals(exp_pac_url.get(), out_pac_url.get()));
242 257
243 scoped_ptr<DictionaryValue> exp_pac_data( 258 scoped_ptr<DictionaryValue> exp_pac_data(
244 ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false)); 259 ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false));
245 scoped_ptr<DictionaryValue> out_pac_data( 260 scoped_ptr<DictionaryValue> out_pac_data(
246 CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, false, "", 261 CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT,
247 kSamplePacScript, "", "", &error)); 262 false,
263 std::string(),
264 kSamplePacScript,
265 std::string(),
266 std::string(),
267 &error));
248 EXPECT_TRUE(Value::Equals(exp_pac_data.get(), out_pac_data.get())); 268 EXPECT_TRUE(Value::Equals(exp_pac_data.get(), out_pac_data.get()));
249 269
250 scoped_ptr<DictionaryValue> exp_fixed( 270 scoped_ptr<DictionaryValue> exp_fixed(
251 ProxyConfigDictionary::CreateFixedServers("foo:80", "localhost")); 271 ProxyConfigDictionary::CreateFixedServers("foo:80", "localhost"));
252 scoped_ptr<DictionaryValue> out_fixed( 272 scoped_ptr<DictionaryValue> out_fixed(
253 CreateProxyConfigDict(ProxyPrefs::MODE_FIXED_SERVERS, false, "", "", 273 CreateProxyConfigDict(ProxyPrefs::MODE_FIXED_SERVERS,
254 "foo:80", "localhost", &error)); 274 false,
275 std::string(),
276 std::string(),
277 "foo:80",
278 "localhost",
279 &error));
255 EXPECT_TRUE(Value::Equals(exp_fixed.get(), out_fixed.get())); 280 EXPECT_TRUE(Value::Equals(exp_fixed.get(), out_fixed.get()));
256 281
257 scoped_ptr<DictionaryValue> exp_system(ProxyConfigDictionary::CreateSystem()); 282 scoped_ptr<DictionaryValue> exp_system(ProxyConfigDictionary::CreateSystem());
258 scoped_ptr<DictionaryValue> out_system( 283 scoped_ptr<DictionaryValue> out_system(
259 CreateProxyConfigDict(ProxyPrefs::MODE_SYSTEM, false, "", "", "", "", 284 CreateProxyConfigDict(ProxyPrefs::MODE_SYSTEM,
285 false,
286 std::string(),
287 std::string(),
288 std::string(),
289 std::string(),
260 &error)); 290 &error));
261 EXPECT_TRUE(Value::Equals(exp_system.get(), out_system.get())); 291 EXPECT_TRUE(Value::Equals(exp_system.get(), out_system.get()));
262 292
263 // Neither of them should have set an error. 293 // Neither of them should have set an error.
264 EXPECT_EQ(std::string(), error); 294 EXPECT_EQ(std::string(), error);
265 } 295 }
266 296
267 TEST(ExtensionProxyApiHelpers, GetProxyServer) { 297 TEST(ExtensionProxyApiHelpers, GetProxyServer) {
268 DictionaryValue proxy_server_dict; 298 DictionaryValue proxy_server_dict;
269 net::ProxyServer created; 299 net::ProxyServer created;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 expected.Append(Value::CreateStringValue("s1")); 420 expected.Append(Value::CreateStringValue("s1"));
391 expected.Append(Value::CreateStringValue("s2")); 421 expected.Append(Value::CreateStringValue("s2"));
392 expected.Append(Value::CreateStringValue("s3")); 422 expected.Append(Value::CreateStringValue("s3"));
393 423
394 scoped_ptr<ListValue> out(TokenizeToStringList("s1;s2;s3", ";")); 424 scoped_ptr<ListValue> out(TokenizeToStringList("s1;s2;s3", ";"));
395 EXPECT_TRUE(Value::Equals(&expected, out.get())); 425 EXPECT_TRUE(Value::Equals(&expected, out.get()));
396 } 426 }
397 427
398 } // namespace proxy_api_helpers 428 } // namespace proxy_api_helpers
399 } // namespace extensions 429 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/proxy/proxy_api.cc ('k') | chrome/browser/extensions/api/socket/udp_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698