Index: net/log/write_to_file_net_log_observer_unittest.cc |
diff --git a/net/log/write_to_file_net_log_observer_unittest.cc b/net/log/write_to_file_net_log_observer_unittest.cc |
index ddc8aa978db437644d29dc37a4ab3059e33e8231..c1ab52f36f3ce9e42e0fa5d072c51f6ded074d64 100644 |
--- a/net/log/write_to_file_net_log_observer_unittest.cc |
+++ b/net/log/write_to_file_net_log_observer_unittest.cc |
@@ -4,6 +4,7 @@ |
#include "net/log/write_to_file_net_log_observer.h" |
+#include <memory> |
#include <utility> |
#include "base/files/file_path.h" |
@@ -11,7 +12,6 @@ |
#include "base/files/scoped_file.h" |
#include "base/files/scoped_temp_dir.h" |
#include "base/json/json_reader.h" |
-#include "base/memory/scoped_ptr.h" |
#include "base/values.h" |
#include "net/log/net_log.h" |
#include "net/log/net_log_util.h" |
@@ -41,7 +41,8 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONForNoEvents) { |
// Create and destroy a logger. |
base::ScopedFILE file(base::OpenFile(log_path_, "w")); |
ASSERT_TRUE(file); |
- scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); |
+ std::unique_ptr<WriteToFileNetLogObserver> logger( |
+ new WriteToFileNetLogObserver()); |
logger->StartObserving(&net_log_, std::move(file), nullptr, nullptr); |
logger->StopObserving(nullptr); |
logger.reset(); |
@@ -50,7 +51,7 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONForNoEvents) { |
ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); |
base::JSONReader reader; |
- scoped_ptr<base::Value> root(reader.ReadToValue(input)); |
+ std::unique_ptr<base::Value> root(reader.ReadToValue(input)); |
ASSERT_TRUE(root) << reader.GetErrorMessage(); |
base::DictionaryValue* dict; |
@@ -83,7 +84,8 @@ TEST_F(WriteToFileNetLogObserverTest, CaptureMode) { |
TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithOneEvent) { |
base::ScopedFILE file(base::OpenFile(log_path_, "w")); |
ASSERT_TRUE(file); |
- scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); |
+ std::unique_ptr<WriteToFileNetLogObserver> logger( |
+ new WriteToFileNetLogObserver()); |
logger->StartObserving(&net_log_, std::move(file), nullptr, nullptr); |
const int kDummyId = 1; |
@@ -100,7 +102,7 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithOneEvent) { |
ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); |
base::JSONReader reader; |
- scoped_ptr<base::Value> root(reader.ReadToValue(input)); |
+ std::unique_ptr<base::Value> root(reader.ReadToValue(input)); |
ASSERT_TRUE(root) << reader.GetErrorMessage(); |
base::DictionaryValue* dict; |
@@ -113,7 +115,8 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithOneEvent) { |
TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithMultipleEvents) { |
base::ScopedFILE file(base::OpenFile(log_path_, "w")); |
ASSERT_TRUE(file); |
- scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); |
+ std::unique_ptr<WriteToFileNetLogObserver> logger( |
+ new WriteToFileNetLogObserver()); |
logger->StartObserving(&net_log_, std::move(file), nullptr, nullptr); |
const int kDummyId = 1; |
@@ -133,7 +136,7 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithMultipleEvents) { |
ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); |
base::JSONReader reader; |
- scoped_ptr<base::Value> root(reader.ReadToValue(input)); |
+ std::unique_ptr<base::Value> root(reader.ReadToValue(input)); |
ASSERT_TRUE(root) << reader.GetErrorMessage(); |
base::DictionaryValue* dict; |
@@ -145,10 +148,12 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithMultipleEvents) { |
TEST_F(WriteToFileNetLogObserverTest, CustomConstants) { |
const char kConstantString[] = "awesome constant"; |
- scoped_ptr<base::Value> constants(new base::StringValue(kConstantString)); |
+ std::unique_ptr<base::Value> constants( |
+ new base::StringValue(kConstantString)); |
base::ScopedFILE file(base::OpenFile(log_path_, "w")); |
ASSERT_TRUE(file); |
- scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); |
+ std::unique_ptr<WriteToFileNetLogObserver> logger( |
+ new WriteToFileNetLogObserver()); |
logger->StartObserving(&net_log_, std::move(file), constants.get(), nullptr); |
logger->StopObserving(nullptr); |
logger.reset(); |
@@ -157,7 +162,7 @@ TEST_F(WriteToFileNetLogObserverTest, CustomConstants) { |
ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); |
base::JSONReader reader; |
- scoped_ptr<base::Value> root(reader.ReadToValue(input)); |
+ std::unique_ptr<base::Value> root(reader.ReadToValue(input)); |
ASSERT_TRUE(root) << reader.GetErrorMessage(); |
base::DictionaryValue* dict; |
@@ -176,7 +181,8 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithContext) { |
// Create and destroy a logger. |
base::ScopedFILE file(base::OpenFile(log_path_, "w")); |
ASSERT_TRUE(file); |
- scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); |
+ std::unique_ptr<WriteToFileNetLogObserver> logger( |
+ new WriteToFileNetLogObserver()); |
logger->StartObserving(&net_log_, std::move(file), nullptr, &context); |
logger->StopObserving(&context); |
logger.reset(); |
@@ -185,7 +191,7 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithContext) { |
ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); |
base::JSONReader reader; |
- scoped_ptr<base::Value> root(reader.ReadToValue(input)); |
+ std::unique_ptr<base::Value> root(reader.ReadToValue(input)); |
ASSERT_TRUE(root) << reader.GetErrorMessage(); |
base::DictionaryValue* dict; |
@@ -208,14 +214,15 @@ TEST_F(WriteToFileNetLogObserverTest, |
TestDelegate delegate; |
// URL doesn't matter. Requests can't fail synchronously. |
- scoped_ptr<URLRequest> request( |
+ std::unique_ptr<URLRequest> request( |
context.CreateRequest(GURL("blah:blah"), IDLE, &delegate)); |
request->Start(); |
// Create and destroy a logger. |
base::ScopedFILE file(base::OpenFile(log_path_, "w")); |
ASSERT_TRUE(file); |
- scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); |
+ std::unique_ptr<WriteToFileNetLogObserver> logger( |
+ new WriteToFileNetLogObserver()); |
logger->StartObserving(&net_log_, std::move(file), nullptr, &context); |
logger->StopObserving(&context); |
logger.reset(); |
@@ -224,7 +231,7 @@ TEST_F(WriteToFileNetLogObserverTest, |
ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); |
base::JSONReader reader; |
- scoped_ptr<base::Value> root(reader.ReadToValue(input)); |
+ std::unique_ptr<base::Value> root(reader.ReadToValue(input)); |
ASSERT_TRUE(root) << reader.GetErrorMessage(); |
base::DictionaryValue* dict; |