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

Side by Side Diff: extensions/common/test_util.cc

Issue 1511103003: Use rvalue reference instead of ExtensionBuilder::pass() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « extensions/common/test_util.h ('k') | extensions/extensions_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/common/test_util.h" 5 #include "extensions/common/test_util.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "extensions/common/extension.h" 9 #include "extensions/common/extension.h"
10 #include "extensions/common/extension_builder.h" 10 #include "extensions/common/extension_builder.h"
11 #include "extensions/common/value_builder.h" 11 #include "extensions/common/value_builder.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 namespace test_util { 14 namespace test_util {
15 15
16 ExtensionBuilder& BuildExtension(ExtensionBuilder& builder) { 16 ExtensionBuilder& BuildExtension(ExtensionBuilder builder) {
17 return builder 17 return builder
danakj 2015/12/16 18:57:49 This is now returning a reference to a temporary v
danakj 2015/12/16 19:06:04 er, local, not temporary, but it's bad :) the vari
limasdf 2015/12/17 06:19:46 Returning rvalue should work.
18 .SetManifest(DictionaryBuilder() 18 .SetManifest(DictionaryBuilder()
19 .Set("name", "Test extension") 19 .Set("name", "Test extension")
20 .Set("version", "1.0") 20 .Set("version", "1.0")
21 .Set("manifest_version", 2)); 21 .Set("manifest_version", 2));
22 } 22 }
23 23
24 ExtensionBuilder& BuildApp(ExtensionBuilder& builder) { 24 ExtensionBuilder& BuildApp(ExtensionBuilder builder) {
danakj 2015/12/16 18:57:49 ditto
limasdf 2015/12/17 06:19:46 ditto-ly done.
25 return builder.SetManifest( 25 return builder.SetManifest(
26 DictionaryBuilder() 26 DictionaryBuilder()
27 .Set("name", "Test extension") 27 .Set("name", "Test extension")
28 .Set("version", "1.0") 28 .Set("version", "1.0")
29 .Set("manifest_version", 2) 29 .Set("manifest_version", 2)
30 .Set("app", 30 .Set("app",
31 extensions::DictionaryBuilder().Set( 31 extensions::DictionaryBuilder().Set(
32 "background", 32 "background",
33 extensions::DictionaryBuilder().Set( 33 extensions::DictionaryBuilder().Set(
34 "scripts", std::move(extensions::ListBuilder().Append( 34 "scripts", std::move(extensions::ListBuilder().Append(
(...skipping 10 matching lines...) Expand all
45 scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) { 45 scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) {
46 return ExtensionBuilder() 46 return ExtensionBuilder()
47 .SetManifest( 47 .SetManifest(
48 DictionaryBuilder().Set("name", "test").Set("version", "0.1")) 48 DictionaryBuilder().Set("name", "test").Set("version", "0.1"))
49 .SetID(id) 49 .SetID(id)
50 .Build(); 50 .Build();
51 } 51 }
52 52
53 } // namespace test_util 53 } // namespace test_util
54 } // namespace extensions 54 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/test_util.h ('k') | extensions/extensions_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698