diff options
author | dcheng <dcheng@chromium.org> | 2016-02-26 19:51:32 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-27 03:53:04 +0000 |
commit | 794d2bd77811b6d6b45048c19c287075cc9930db (patch) | |
tree | ef71bf3826d396a488ef0c72a68b3d7f4ff236d3 /extensions/common/test_util.cc | |
parent | 47dc6a8a0f7d36d20f90df5ac62da075d45bc9c3 (diff) | |
download | chromium_src-794d2bd77811b6d6b45048c19c287075cc9930db.zip chromium_src-794d2bd77811b6d6b45048c19c287075cc9930db.tar.gz chromium_src-794d2bd77811b6d6b45048c19c287075cc9930db.tar.bz2 |
Make extensions::DictionaryBuilder and extensions::ListValue unmovable.
There's no reason for these classes to be movable. std::move() is just
being used as a synonym for Build().
In addition:
- Build() is fewer characters than std::move().
- clang-format works better when builder syntax is consistently used,
which makes it easier for readers to visually match up deeply nested
builders.
- It's surprising to see std::move() used with what looks like a
temporary.
BUG=none
Review URL: https://codereview.chromium.org/1739183003
Cr-Commit-Position: refs/heads/master@{#378107}
Diffstat (limited to 'extensions/common/test_util.cc')
-rw-r--r-- | extensions/common/test_util.cc | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/extensions/common/test_util.cc b/extensions/common/test_util.cc index e3775e5..c065c29 100644 --- a/extensions/common/test_util.cc +++ b/extensions/common/test_util.cc @@ -14,39 +14,43 @@ namespace extensions { namespace test_util { ExtensionBuilder BuildExtension(ExtensionBuilder builder) { - builder.SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0") - .Set("manifest_version", 2))); + builder.SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Build()); return builder; } ExtensionBuilder BuildApp(ExtensionBuilder builder) { - builder.SetManifest(std::move( + builder.SetManifest( DictionaryBuilder() .Set("name", "Test extension") .Set("version", "1.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))))); + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Build()); return builder; } scoped_refptr<Extension> CreateEmptyExtension() { return ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder().Set("name", "Test").Set("version", "1.0"))) + .SetManifest( + DictionaryBuilder().Set("name", "Test").Set("version", "1.0").Build()) .Build(); } scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) { return ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder().Set("name", "test").Set("version", "0.1"))) + .SetManifest( + DictionaryBuilder().Set("name", "test").Set("version", "0.1").Build()) .SetID(id) .Build(); } |