summaryrefslogtreecommitdiffstats
path: root/extensions/common/features
diff options
context:
space:
mode:
authorlimasdf <limasdf@gmail.com>2015-12-08 19:58:45 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-09 03:59:36 +0000
commit3d1025433fba150119ec1519f9228f2febddd55c (patch)
tree1b00bc3d0334a7c624d7e49043182a6a9d6dd605 /extensions/common/features
parent9679230bb637a8aeca7598d08da802b1c64404fe (diff)
downloadchromium_src-3d1025433fba150119ec1519f9228f2febddd55c.zip
chromium_src-3d1025433fba150119ec1519f9228f2febddd55c.tar.gz
chromium_src-3d1025433fba150119ec1519f9228f2febddd55c.tar.bz2
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}
Diffstat (limited to 'extensions/common/features')
-rw-r--r--extensions/common/features/base_feature_provider_unittest.cc21
-rw-r--r--extensions/common/features/complex_feature_unittest.cc21
2 files changed, 23 insertions, 19 deletions
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 <algorithm>
#include <set>
#include <string>
+#include <utility>
#include "base/stl_util.h"
#include "extensions/common/extension_builder.h"
@@ -99,16 +100,16 @@ TEST(BaseFeatureProviderTest, PermissionFeatureAvailability) {
scoped_refptr<const Extension> 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 <string>
+#include <utility>
#include "extensions/common/features/simple_feature.h"
#include "extensions/common/manifest.h"
@@ -23,18 +24,19 @@ TEST(ComplexFeatureTest, MultipleRulesWhitelist) {
scoped_ptr<SimpleFeature> simple_feature(new SimpleFeature);
scoped_ptr<base::DictionaryValue> 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<SimpleFeature> simple_feature(new SimpleFeature);
scoped_ptr<base::DictionaryValue> 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());