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

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

Issue 1739183003: Make extensions::DictionaryBuilder and extensions::ListValue unmovable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
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 builder.SetManifest(std::move(DictionaryBuilder() 17 builder.SetManifest(DictionaryBuilder()
18 .Set("name", "Test extension") 18 .Set("name", "Test extension")
19 .Set("version", "1.0") 19 .Set("version", "1.0")
20 .Set("manifest_version", 2))); 20 .Set("manifest_version", 2)
21 .Build());
21 return builder; 22 return builder;
22 } 23 }
23 24
24 ExtensionBuilder BuildApp(ExtensionBuilder builder) { 25 ExtensionBuilder BuildApp(ExtensionBuilder builder) {
25 builder.SetManifest(std::move( 26 builder.SetManifest(
26 DictionaryBuilder() 27 DictionaryBuilder()
27 .Set("name", "Test extension") 28 .Set("name", "Test extension")
28 .Set("version", "1.0") 29 .Set("version", "1.0")
29 .Set("manifest_version", 2) 30 .Set("manifest_version", 2)
30 .Set("app", 31 .Set("app", extensions::DictionaryBuilder()
31 std::move(extensions::DictionaryBuilder().Set( 32 .Set("background",
32 "background", 33 extensions::DictionaryBuilder()
33 std::move(extensions::DictionaryBuilder().Set( 34 .Set("scripts", extensions::ListBuilder()
34 "scripts", std::move(extensions::ListBuilder().Append( 35 .Append("background.js")
35 "background.js"))))))))); 36 .Build())
37 .Build())
38 .Build())
39 .Build());
36 return builder; 40 return builder;
37 } 41 }
38 42
39 scoped_refptr<Extension> CreateEmptyExtension() { 43 scoped_refptr<Extension> CreateEmptyExtension() {
40 return ExtensionBuilder() 44 return ExtensionBuilder()
41 .SetManifest(std::move( 45 .SetManifest(
42 DictionaryBuilder().Set("name", "Test").Set("version", "1.0"))) 46 DictionaryBuilder().Set("name", "Test").Set("version", "1.0").Build())
43 .Build(); 47 .Build();
44 } 48 }
45 49
46 scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) { 50 scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) {
47 return ExtensionBuilder() 51 return ExtensionBuilder()
48 .SetManifest(std::move( 52 .SetManifest(
49 DictionaryBuilder().Set("name", "test").Set("version", "0.1"))) 53 DictionaryBuilder().Set("name", "test").Set("version", "0.1").Build())
50 .SetID(id) 54 .SetID(id)
51 .Build(); 55 .Build();
52 } 56 }
53 57
54 } // namespace test_util 58 } // namespace test_util
55 } // namespace extensions 59 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698