Migrate to github hosting of CLD2 project.
[chromium-blink-merge.git] / extensions / common / test_util.cc
blobdafbca23e4a0fda75cde4ce124e3b0982f4d4555
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
3 // found in the LICENSE file.
5 #include "extensions/common/test_util.h"
7 #include "extensions/common/extension.h"
8 #include "extensions/common/extension_builder.h"
9 #include "extensions/common/value_builder.h"
11 namespace extensions {
12 namespace test_util {
14 ExtensionBuilder& BuildExtension(ExtensionBuilder& builder) {
15 return builder
16 .SetManifest(DictionaryBuilder()
17 .Set("name", "Test extension")
18 .Set("version", "1.0")
19 .Set("manifest_version", 2));
22 ExtensionBuilder& BuildApp(ExtensionBuilder& builder) {
23 return builder.SetManifest(
24 DictionaryBuilder()
25 .Set("name", "Test extension")
26 .Set("version", "1.0")
27 .Set("manifest_version", 2)
28 .Set("app",
29 extensions::DictionaryBuilder().Set(
30 "background",
31 extensions::DictionaryBuilder().Set(
32 "scripts",
33 extensions::ListBuilder().Append("background.js")))));
36 scoped_refptr<Extension> CreateEmptyExtension() {
37 return ExtensionBuilder()
38 .SetManifest(
39 DictionaryBuilder().Set("name", "Test").Set("version", "1.0"))
40 .Build();
43 scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) {
44 return ExtensionBuilder()
45 .SetManifest(
46 DictionaryBuilder().Set("name", "test").Set("version", "0.1"))
47 .SetID(id)
48 .Build();
51 } // namespace test_util
52 } // namespace extensions