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

Unified Diff: chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc

Issue 2785883003: Use unique_ptr<DictionaryValue> in ProxyConfigDictionary (Closed)
Patch Set: one constructor Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
index 6dcf63a05241c0d1b70176eaea8963c8fd025006..93e000f386b48201448f4cb13f9ccdc407890db7 100644
--- a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
+++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/extensions/api/proxy/proxy_api_helpers.h"
#include <memory>
+#include <utility>
#include "base/values.h"
#include "chrome/browser/extensions/api/proxy/proxy_api_constants.h"
@@ -222,43 +223,43 @@ TEST(ExtensionProxyApiHelpers, GetBypassListFromExtensionPref) {
TEST(ExtensionProxyApiHelpers, CreateProxyConfigDict) {
std::string error;
- std::unique_ptr<base::DictionaryValue> exp_direct(
- ProxyConfigDictionary::CreateDirect());
+ std::unique_ptr<base::DictionaryValue> exp_direct =
+ ProxyConfigDictionary::CreateDirect();
std::unique_ptr<base::DictionaryValue> out_direct(CreateProxyConfigDict(
ProxyPrefs::MODE_DIRECT, false, std::string(), std::string(),
std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_direct.get(), out_direct.get()));
- std::unique_ptr<base::DictionaryValue> exp_auto(
- ProxyConfigDictionary::CreateAutoDetect());
+ std::unique_ptr<base::DictionaryValue> exp_auto =
+ ProxyConfigDictionary::CreateAutoDetect();
std::unique_ptr<base::DictionaryValue> out_auto(CreateProxyConfigDict(
ProxyPrefs::MODE_AUTO_DETECT, false, std::string(), std::string(),
std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_auto.get(), out_auto.get()));
- std::unique_ptr<base::DictionaryValue> exp_pac_url(
- ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false));
+ std::unique_ptr<base::DictionaryValue> exp_pac_url =
+ ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false);
std::unique_ptr<base::DictionaryValue> out_pac_url(CreateProxyConfigDict(
ProxyPrefs::MODE_PAC_SCRIPT, false, kSamplePacScriptUrl, std::string(),
std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_pac_url.get(), out_pac_url.get()));
- std::unique_ptr<base::DictionaryValue> exp_pac_data(
- ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false));
+ std::unique_ptr<base::DictionaryValue> exp_pac_data =
+ ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false);
std::unique_ptr<base::DictionaryValue> out_pac_data(CreateProxyConfigDict(
ProxyPrefs::MODE_PAC_SCRIPT, false, std::string(), kSamplePacScript,
std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_pac_data.get(), out_pac_data.get()));
- std::unique_ptr<base::DictionaryValue> exp_fixed(
- ProxyConfigDictionary::CreateFixedServers("foo:80", "localhost"));
+ std::unique_ptr<base::DictionaryValue> exp_fixed =
+ ProxyConfigDictionary::CreateFixedServers("foo:80", "localhost");
std::unique_ptr<base::DictionaryValue> out_fixed(CreateProxyConfigDict(
ProxyPrefs::MODE_FIXED_SERVERS, false, std::string(), std::string(),
"foo:80", "localhost", &error));
EXPECT_TRUE(base::Value::Equals(exp_fixed.get(), out_fixed.get()));
- std::unique_ptr<base::DictionaryValue> exp_system(
- ProxyConfigDictionary::CreateSystem());
+ std::unique_ptr<base::DictionaryValue> exp_system =
+ ProxyConfigDictionary::CreateSystem();
std::unique_ptr<base::DictionaryValue> out_system(CreateProxyConfigDict(
ProxyPrefs::MODE_SYSTEM, false, std::string(), std::string(),
std::string(), std::string(), &error));
@@ -312,7 +313,7 @@ TEST(ExtensionProxyApiHelpers, CreateProxyRulesDict) {
ProxyConfigDictionary::CreateFixedServers(
"http=proxy1:80;https=proxy2:80;ftp=proxy3:80;socks=proxy4:80",
"localhost"));
- ProxyConfigDictionary config(browser_pref.get());
+ ProxyConfigDictionary config(std::move(browser_pref));
std::unique_ptr<base::DictionaryValue> extension_pref(
CreateProxyRulesDict(config));
ASSERT_TRUE(extension_pref.get());
@@ -340,7 +341,7 @@ TEST(ExtensionProxyApiHelpers, CreateProxyRulesDictMultipleProxies) {
"http=proxy1:80,default://;https=proxy2:80,proxy1:80;ftp=proxy3:80,"
"https://proxy5:443;socks=proxy4:80,proxy1:80",
"localhost"));
- ProxyConfigDictionary config(browser_pref.get());
+ ProxyConfigDictionary config(std::move(browser_pref));
std::unique_ptr<base::DictionaryValue> extension_pref(
CreateProxyRulesDict(config));
ASSERT_TRUE(extension_pref.get());
@@ -365,7 +366,7 @@ TEST(ExtensionProxyApiHelpers, CreateProxyRulesDictMultipleProxies) {
TEST(ExtensionProxyApiHelpers, CreatePacScriptDictWithUrl) {
std::unique_ptr<base::DictionaryValue> browser_pref(
ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false));
- ProxyConfigDictionary config(browser_pref.get());
+ ProxyConfigDictionary config(std::move(browser_pref));
std::unique_ptr<base::DictionaryValue> extension_pref(
CreatePacScriptDict(config));
ASSERT_TRUE(extension_pref.get());
@@ -381,7 +382,7 @@ TEST(ExtensionProxyApiHelpers, CreatePacScriptDictWithUrl) {
TEST(ExtensionProxyApiHelpers, CreatePacScriptDictWidthData) {
std::unique_ptr<base::DictionaryValue> browser_pref(
ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false));
- ProxyConfigDictionary config(browser_pref.get());
+ ProxyConfigDictionary config(std::move(browser_pref));
std::unique_ptr<base::DictionaryValue> extension_pref(
CreatePacScriptDict(config));
ASSERT_TRUE(extension_pref.get());

Powered by Google App Engine
This is Rietveld 408576698