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

Side by Side Diff: chrome/browser/chromeos/proxy_config_service_impl_unittest.cc

Issue 2785883003: Use unique_ptr<DictionaryValue> in ProxyConfigDictionary (Closed)
Patch Set: Fix compilation Created 3 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
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 "chromeos/network/proxy/proxy_config_service_impl.h" 5 #include "chromeos/network/proxy/proxy_config_service_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 proxy_config_service_.reset(); 317 proxy_config_service_.reset();
318 NetworkHandler::Shutdown(); 318 NetworkHandler::Shutdown();
319 DBusThreadManager::Shutdown(); 319 DBusThreadManager::Shutdown();
320 } 320 }
321 321
322 void InitConfigWithTestInput(const Input& input, 322 void InitConfigWithTestInput(const Input& input,
323 base::DictionaryValue* result) { 323 base::DictionaryValue* result) {
324 std::unique_ptr<base::DictionaryValue> new_config; 324 std::unique_ptr<base::DictionaryValue> new_config;
325 switch (input.mode) { 325 switch (input.mode) {
326 case MK_MODE(DIRECT): 326 case MK_MODE(DIRECT):
327 new_config.reset(ProxyConfigDictionary::CreateDirect()); 327 new_config = ProxyConfigDictionary::CreateDirect();
328 break; 328 break;
329 case MK_MODE(AUTO_DETECT): 329 case MK_MODE(AUTO_DETECT):
330 new_config.reset(ProxyConfigDictionary::CreateAutoDetect()); 330 new_config = ProxyConfigDictionary::CreateAutoDetect();
331 break; 331 break;
332 case MK_MODE(PAC_SCRIPT): 332 case MK_MODE(PAC_SCRIPT):
333 new_config.reset( 333 new_config =
334 ProxyConfigDictionary::CreatePacScript(input.pac_url, false)); 334 ProxyConfigDictionary::CreatePacScript(input.pac_url, false);
335 break; 335 break;
336 case MK_MODE(SINGLE_PROXY): 336 case MK_MODE(SINGLE_PROXY):
337 case MK_MODE(PROXY_PER_SCHEME): 337 case MK_MODE(PROXY_PER_SCHEME):
338 new_config.reset(ProxyConfigDictionary::CreateFixedServers( 338 new_config = ProxyConfigDictionary::CreateFixedServers(
339 input.server, input.bypass_rules)); 339 input.server, input.bypass_rules);
340 break; 340 break;
341 } 341 }
342 result->Swap(new_config.get()); 342 result->Swap(new_config.get());
343 } 343 }
344 344
345 void SetUserConfigInShill(base::DictionaryValue* pref_proxy_config_dict) { 345 void SetUserConfigInShill(base::DictionaryValue* pref_proxy_config_dict) {
346 std::string proxy_config; 346 std::string proxy_config;
347 if (pref_proxy_config_dict) 347 if (pref_proxy_config_dict)
348 base::JSONWriter::Write(*pref_proxy_config_dict, &proxy_config); 348 base::JSONWriter::Write(*pref_proxy_config_dict, &proxy_config);
349 349
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 std::move(network_configs)); 529 std::move(network_configs));
530 530
531 net::ProxyConfig actual_config; 531 net::ProxyConfig actual_config;
532 SyncGetLatestProxyConfig(&actual_config); 532 SyncGetLatestProxyConfig(&actual_config);
533 net::ProxyConfig expected_config = 533 net::ProxyConfig expected_config =
534 net::ProxyConfig::CreateFromCustomPacURL(GURL("http://domain.com/x")); 534 net::ProxyConfig::CreateFromCustomPacURL(GURL("http://domain.com/x"));
535 EXPECT_TRUE(expected_config.Equals(actual_config)); 535 EXPECT_TRUE(expected_config.Equals(actual_config));
536 } 536 }
537 537
538 } // namespace chromeos 538 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698