From 3d1025433fba150119ec1519f9228f2febddd55c Mon Sep 17 00:00:00 2001 From: limasdf Date: Tue, 8 Dec 2015 19:58:45 -0800 Subject: Use rvalue reference instead of extensions::ListBuilder::Pass() C++ 11 enables rvalue reference with std::move() so that removing legacy ListBuilder::Pass() stuff. TEST=unit_tests BUG=563649 TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1497753002 Cr-Commit-Position: refs/heads/master@{#363970} --- .../features/base_feature_provider_unittest.cc | 21 +++++++++++---------- .../common/features/complex_feature_unittest.cc | 21 ++++++++++++--------- 2 files changed, 23 insertions(+), 19 deletions(-) (limited to 'extensions/common/features') diff --git a/extensions/common/features/base_feature_provider_unittest.cc b/extensions/common/features/base_feature_provider_unittest.cc index dc41366..30850a3 100644 --- a/extensions/common/features/base_feature_provider_unittest.cc +++ b/extensions/common/features/base_feature_provider_unittest.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include "base/stl_util.h" #include "extensions/common/extension_builder.h" @@ -99,16 +100,16 @@ TEST(BaseFeatureProviderTest, PermissionFeatureAvailability) { scoped_refptr app = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "test app") - .Set("version", "1") - .Set("app", - DictionaryBuilder().Set( - "background", - DictionaryBuilder().Set( - "scripts", - ListBuilder().Append("background.js")))) - .Set("permissions", ListBuilder().Append("power"))) + .SetManifest( + DictionaryBuilder() + .Set("name", "test app") + .Set("version", "1") + .Set("app", DictionaryBuilder().Set( + "background", + DictionaryBuilder().Set( + "scripts", std::move(ListBuilder().Append( + "background.js"))))) + .Set("permissions", std::move(ListBuilder().Append("power")))) .Build(); ASSERT_TRUE(app.get()); ASSERT_TRUE(app->is_platform_app()); diff --git a/extensions/common/features/complex_feature_unittest.cc b/extensions/common/features/complex_feature_unittest.cc index 54355aa..d06a15a 100644 --- a/extensions/common/features/complex_feature_unittest.cc +++ b/extensions/common/features/complex_feature_unittest.cc @@ -5,6 +5,7 @@ #include "extensions/common/features/complex_feature.h" #include +#include #include "extensions/common/features/simple_feature.h" #include "extensions/common/manifest.h" @@ -23,18 +24,19 @@ TEST(ComplexFeatureTest, MultipleRulesWhitelist) { scoped_ptr simple_feature(new SimpleFeature); scoped_ptr rule( DictionaryBuilder() - .Set("whitelist", ListBuilder().Append(kIdFoo)) - .Set("extension_types", ListBuilder() - .Append("extension")).Build()); + .Set("whitelist", std::move(ListBuilder().Append(kIdFoo))) + .Set("extension_types", std::move(ListBuilder().Append("extension"))) + .Build()); simple_feature->Parse(rule.get()); features->push_back(simple_feature.Pass()); // Rule: "legacy_packaged_app", whitelist "bar". simple_feature.reset(new SimpleFeature); rule = DictionaryBuilder() - .Set("whitelist", ListBuilder().Append(kIdBar)) - .Set("extension_types", ListBuilder() - .Append("legacy_packaged_app")).Build(); + .Set("whitelist", std::move(ListBuilder().Append(kIdBar))) + .Set("extension_types", + std::move(ListBuilder().Append("legacy_packaged_app"))) + .Build(); simple_feature->Parse(rule.get()); features->push_back(simple_feature.Pass()); @@ -84,8 +86,8 @@ TEST(ComplexFeatureTest, Dependencies) { scoped_ptr simple_feature(new SimpleFeature); scoped_ptr rule = DictionaryBuilder() - .Set("dependencies", - ListBuilder().Append("manifest:content_security_policy")) + .Set("dependencies", std::move(ListBuilder().Append( + "manifest:content_security_policy"))) .Build(); simple_feature->Parse(rule.get()); features->push_back(simple_feature.Pass()); @@ -93,7 +95,8 @@ TEST(ComplexFeatureTest, Dependencies) { // Rule which depends on an platform-app-only feature (serial). simple_feature.reset(new SimpleFeature); rule = DictionaryBuilder() - .Set("dependencies", ListBuilder().Append("permission:serial")) + .Set("dependencies", + std::move(ListBuilder().Append("permission:serial"))) .Build(); simple_feature->Parse(rule.get()); features->push_back(simple_feature.Pass()); -- cgit v1.1