Index: components/domain_reliability/config_unittest.cc |
diff --git a/components/domain_reliability/config_unittest.cc b/components/domain_reliability/config_unittest.cc |
index d8c7f6d2044bcf58df952d3bab5e3e6cf935760a..be701b0998a399b0034544bdbd0a3d011a7b6c76 100644 |
--- a/components/domain_reliability/config_unittest.cc |
+++ b/components/domain_reliability/config_unittest.cc |
@@ -7,6 +7,7 @@ |
#include <memory> |
#include <string> |
+#include "base/memory/ptr_util.h" |
#include "base/time/time.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -17,7 +18,8 @@ std::unique_ptr<DomainReliabilityConfig> MakeBaseConfig() { |
DomainReliabilityConfig* config = new DomainReliabilityConfig(); |
config->origin = GURL("https://example/"); |
config->include_subdomains = false; |
- config->collectors.push_back(new GURL("https://example/upload")); |
+ config->collectors.push_back( |
+ base::MakeUnique<GURL>("https://example/upload")); |
config->failure_sample_rate = 1.0; |
config->success_sample_rate = 0.0; |
EXPECT_TRUE(config->IsValid()); |
@@ -26,8 +28,8 @@ std::unique_ptr<DomainReliabilityConfig> MakeBaseConfig() { |
std::unique_ptr<DomainReliabilityConfig> MakeSampleConfig() { |
std::unique_ptr<DomainReliabilityConfig> config(MakeBaseConfig()); |
- config->path_prefixes.push_back(new std::string("/css/")); |
- config->path_prefixes.push_back(new std::string("/js/")); |
+ config->path_prefixes.push_back(base::MakeUnique<std::string>("/css/")); |
+ config->path_prefixes.push_back(base::MakeUnique<std::string>("/js/")); |
EXPECT_TRUE(config->IsValid()); |
return config; |
} |
@@ -49,8 +51,7 @@ TEST_F(DomainReliabilityConfigTest, IsValid) { |
EXPECT_FALSE(config->IsValid()); |
config = MakeSampleConfig(); |
- delete config->collectors[0]; |
- config->collectors[0] = new GURL(); |
+ config->collectors[0] = base::MakeUnique<GURL>(); |
EXPECT_FALSE(config->IsValid()); |
config = MakeSampleConfig(); |