| Index: net/http/http_server_properties_manager_unittest.cc
|
| diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc
|
| index 51f509496a9735f45f0d09414583ae88cf59d75c..140be0718606e0425eec2f97885fcc10b227e41a 100644
|
| --- a/net/http/http_server_properties_manager_unittest.cc
|
| +++ b/net/http/http_server_properties_manager_unittest.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/json/json_reader.h"
|
| #include "base/json/json_writer.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| #include "base/single_thread_task_runner.h"
|
| @@ -263,16 +264,15 @@ TEST_P(HttpServerPropertiesManagerTest,
|
| server_pref_dict->SetWithoutPathExpansion("network_stats", stats);
|
|
|
| // Set the server preference for https://www.google.com.
|
| - base::DictionaryValue* servers_dict = new base::DictionaryValue;
|
| + auto servers_dict = base::MakeUnique<base::DictionaryValue>();
|
| servers_dict->SetWithoutPathExpansion(
|
| GetParam() >= 5 ? "https://www.google.com" : "www.google.com:443",
|
| server_pref_dict);
|
| base::ListValue* servers_list = nullptr;
|
| if (GetParam() >= 4) {
|
| servers_list = new base::ListValue;
|
| - // |servers_list| takes ownership of |servers_dict|.
|
| - servers_list->AppendIfNotPresent(servers_dict);
|
| - servers_dict = new base::DictionaryValue;
|
| + servers_list->AppendIfNotPresent(std::move(servers_dict));
|
| + servers_dict = base::MakeUnique<base::DictionaryValue>();
|
| }
|
|
|
| // Set the preference for mail.google.com server.
|
| @@ -302,8 +302,7 @@ TEST_P(HttpServerPropertiesManagerTest,
|
| server_pref_dict1);
|
| base::DictionaryValue http_server_properties_dict;
|
| if (GetParam() >= 4) {
|
| - // |servers_list| takes ownership of |servers_dict|.
|
| - servers_list->AppendIfNotPresent(servers_dict);
|
| + servers_list->AppendIfNotPresent(std::move(servers_dict));
|
| if (GetParam() == 5) {
|
| HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, -1);
|
| } else {
|
| @@ -315,8 +314,8 @@ TEST_P(HttpServerPropertiesManagerTest,
|
| } else {
|
| HttpServerPropertiesManager::SetVersion(&http_server_properties_dict,
|
| GetParam());
|
| - http_server_properties_dict.SetWithoutPathExpansion("servers",
|
| - servers_dict);
|
| + http_server_properties_dict.SetWithoutPathExpansion(
|
| + "servers", std::move(servers_dict));
|
| }
|
| base::DictionaryValue* supports_quic = new base::DictionaryValue;
|
| supports_quic->SetBoolean("used_quic", true);
|
| @@ -475,14 +474,13 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedHostPortPair) {
|
| server_pref_dict->SetWithoutPathExpansion("network_stats", stats);
|
|
|
| // Set the server preference for www.google.com:65536.
|
| - base::DictionaryValue* servers_dict = new base::DictionaryValue;
|
| + auto servers_dict = base::MakeUnique<base::DictionaryValue>();
|
| servers_dict->SetWithoutPathExpansion("www.google.com:65536",
|
| server_pref_dict);
|
| base::DictionaryValue http_server_properties_dict;
|
| if (GetParam() >= 4) {
|
| base::ListValue* servers_list = new base::ListValue;
|
| - // |servers_list| takes ownership of |servers_dict|.
|
| - servers_list->AppendIfNotPresent(servers_dict);
|
| + servers_list->AppendIfNotPresent(std::move(servers_dict));
|
| if (GetParam() == 5) {
|
| HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, -1);
|
| } else {
|
| @@ -494,8 +492,8 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedHostPortPair) {
|
| } else {
|
| HttpServerPropertiesManager::SetVersion(&http_server_properties_dict,
|
| GetParam());
|
| - http_server_properties_dict.SetWithoutPathExpansion("servers",
|
| - servers_dict);
|
| + http_server_properties_dict.SetWithoutPathExpansion(
|
| + "servers", std::move(servers_dict));
|
| }
|
|
|
| // Set quic_server_info for www.google.com:65536.
|
| @@ -552,13 +550,12 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) {
|
| alternative_service_list);
|
|
|
| // Set the server preference for www.google.com:80.
|
| - base::DictionaryValue* servers_dict = new base::DictionaryValue;
|
| + auto servers_dict = base::MakeUnique<base::DictionaryValue>();
|
| servers_dict->SetWithoutPathExpansion("www.google.com:80", server_pref_dict);
|
| base::DictionaryValue http_server_properties_dict;
|
| if (GetParam() >= 4) {
|
| base::ListValue* servers_list = new base::ListValue;
|
| - // |servers_list| takes ownership of |servers_dict|.
|
| - servers_list->AppendIfNotPresent(servers_dict);
|
| + servers_list->AppendIfNotPresent(std::move(servers_dict));
|
| if (GetParam() == 5) {
|
| HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, -1);
|
| } else {
|
| @@ -570,8 +567,8 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) {
|
| } else {
|
| HttpServerPropertiesManager::SetVersion(&http_server_properties_dict,
|
| GetParam());
|
| - http_server_properties_dict.SetWithoutPathExpansion("servers",
|
| - servers_dict);
|
| + http_server_properties_dict.SetWithoutPathExpansion(
|
| + "servers", std::move(servers_dict));
|
| }
|
|
|
| // Set up the pref.
|
| @@ -972,7 +969,7 @@ TEST_P(HttpServerPropertiesManagerTest, Clear) {
|
| TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) {
|
| ExpectCacheUpdate();
|
|
|
| - base::DictionaryValue* servers_dict = new base::DictionaryValue;
|
| + auto servers_dict = base::MakeUnique<base::DictionaryValue>();
|
| base::ListValue* servers_list = nullptr;
|
| if (GetParam() >= 4)
|
| servers_list = new base::ListValue;
|
| @@ -996,9 +993,8 @@ TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) {
|
| StringPrintf("www.google.com:%d", i), server_pref_dict);
|
| }
|
| if (GetParam() >= 4) {
|
| - // |servers_list| takes ownership of |servers_dict|.
|
| - servers_list->AppendIfNotPresent(servers_dict);
|
| - servers_dict = new base::DictionaryValue;
|
| + servers_list->AppendIfNotPresent(std::move(servers_dict));
|
| + servers_dict = base::MakeUnique<base::DictionaryValue>();
|
| }
|
| }
|
|
|
| @@ -1013,8 +1009,7 @@ TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) {
|
| }
|
| base::DictionaryValue http_server_properties_dict;
|
| if (GetParam() >= 4) {
|
| - // |servers_list| takes ownership of |servers_dict|.
|
| - servers_list->AppendIfNotPresent(servers_dict);
|
| + servers_list->AppendIfNotPresent(std::move(servers_dict));
|
| if (GetParam() == 5) {
|
| HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, -1);
|
| } else {
|
| @@ -1026,8 +1021,8 @@ TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) {
|
| } else {
|
| HttpServerPropertiesManager::SetVersion(&http_server_properties_dict,
|
| GetParam());
|
| - http_server_properties_dict.SetWithoutPathExpansion("servers",
|
| - servers_dict);
|
| + http_server_properties_dict.SetWithoutPathExpansion(
|
| + "servers", std::move(servers_dict));
|
| }
|
|
|
| // Set up SupportsQuic for 127.0.0.1
|
|
|