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

Unified Diff: tools/gn/functions_unittest.cc

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/functions.cc ('k') | tools/gn/header_checker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/functions_unittest.cc
diff --git a/tools/gn/functions_unittest.cc b/tools/gn/functions_unittest.cc
index e2f67567ab90017044a931dee5008a79e01ea100..22670710704c6969255185ae5b3c34ca2b910a50 100644
--- a/tools/gn/functions_unittest.cc
+++ b/tools/gn/functions_unittest.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "tools/gn/parse_tree.h"
#include "tools/gn/test_with_scope.h"
@@ -21,7 +22,7 @@ TEST(Functions, Defined) {
Token undefined_token(Location(), Token::IDENTIFIER, "undef");
ListNode args_list_identifier_undefined;
args_list_identifier_undefined.append_item(
- scoped_ptr<ParseNode>(new IdentifierNode(undefined_token)));
+ std::unique_ptr<ParseNode>(new IdentifierNode(undefined_token)));
Value result = functions::RunDefined(setup.scope(), &function_call,
&args_list_identifier_undefined, &err);
ASSERT_EQ(Value::BOOLEAN, result.type());
@@ -30,14 +31,14 @@ TEST(Functions, Defined) {
// Define a value that's itself a scope value.
const char kDef[] = "def"; // Defined variable name.
setup.scope()->SetValue(
- kDef, Value(nullptr, scoped_ptr<Scope>(new Scope(setup.scope()))),
+ kDef, Value(nullptr, std::unique_ptr<Scope>(new Scope(setup.scope()))),
nullptr);
// Test the defined identifier.
Token defined_token(Location(), Token::IDENTIFIER, kDef);
ListNode args_list_identifier_defined;
args_list_identifier_defined.append_item(
- scoped_ptr<ParseNode>(new IdentifierNode(defined_token)));
+ std::unique_ptr<ParseNode>(new IdentifierNode(defined_token)));
result = functions::RunDefined(setup.scope(), &function_call,
&args_list_identifier_defined, &err);
ASSERT_EQ(Value::BOOLEAN, result.type());
@@ -45,10 +46,10 @@ TEST(Functions, Defined) {
// Should also work by passing an accessor node so you can do
// "defined(def.foo)" to see if foo is defined on the def scope.
- scoped_ptr<AccessorNode> undef_accessor(new AccessorNode);
+ std::unique_ptr<AccessorNode> undef_accessor(new AccessorNode);
undef_accessor->set_base(defined_token);
- undef_accessor->set_member(scoped_ptr<IdentifierNode>(
- new IdentifierNode(undefined_token)));
+ undef_accessor->set_member(
+ base::WrapUnique(new IdentifierNode(undefined_token)));
ListNode args_list_accessor_defined;
args_list_accessor_defined.append_item(std::move(undef_accessor));
result = functions::RunDefined(setup.scope(), &function_call,
« no previous file with comments | « tools/gn/functions.cc ('k') | tools/gn/header_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698