blob: c065c291ec801613576c815c2c1c9504e3b4b085 [file] [log] [blame]
[email protected]f971f9ca2014-01-07 21:28:491// 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.
4
5#include "extensions/common/test_util.h"
6
limasdf3d102542015-12-09 03:58:457#include <utility>
8
[email protected]f971f9ca2014-01-07 21:28:499#include "extensions/common/extension.h"
10#include "extensions/common/extension_builder.h"
11#include "extensions/common/value_builder.h"
12
13namespace extensions {
14namespace test_util {
15
limasdf704a9022015-12-18 01:36:1616ExtensionBuilder BuildExtension(ExtensionBuilder builder) {
dcheng794d2bd2016-02-27 03:51:3217 builder.SetManifest(DictionaryBuilder()
18 .Set("name", "Test extension")
19 .Set("version", "1.0")
20 .Set("manifest_version", 2)
21 .Build());
limasdf704a9022015-12-18 01:36:1622 return builder;
[email protected]f971f9ca2014-01-07 21:28:4923}
24
limasdf704a9022015-12-18 01:36:1625ExtensionBuilder BuildApp(ExtensionBuilder builder) {
dcheng794d2bd2016-02-27 03:51:3226 builder.SetManifest(
sashab84817f92014-09-29 08:07:4227 DictionaryBuilder()
28 .Set("name", "Test extension")
29 .Set("version", "1.0")
30 .Set("manifest_version", 2)
dcheng794d2bd2016-02-27 03:51:3231 .Set("app", extensions::DictionaryBuilder()
32 .Set("background",
33 extensions::DictionaryBuilder()
34 .Set("scripts", extensions::ListBuilder()
35 .Append("background.js")
36 .Build())
37 .Build())
38 .Build())
39 .Build());
limasdf704a9022015-12-18 01:36:1640 return builder;
sashab84817f92014-09-29 08:07:4241}
42
[email protected]904eb662014-08-09 02:53:3243scoped_refptr<Extension> CreateEmptyExtension() {
limasdff0dcf2f2014-09-18 20:17:3744 return ExtensionBuilder()
dcheng794d2bd2016-02-27 03:51:3245 .SetManifest(
46 DictionaryBuilder().Set("name", "Test").Set("version", "1.0").Build())
limasdff0dcf2f2014-09-18 20:17:3747 .Build();
[email protected]904eb662014-08-09 02:53:3248}
49
limasdff0dcf2f2014-09-18 20:17:3750scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) {
[email protected]f971f9ca2014-01-07 21:28:4951 return ExtensionBuilder()
dcheng794d2bd2016-02-27 03:51:3252 .SetManifest(
53 DictionaryBuilder().Set("name", "test").Set("version", "0.1").Build())
[email protected]f971f9ca2014-01-07 21:28:4954 .SetID(id)
55 .Build();
56}
57
[email protected]f971f9ca2014-01-07 21:28:4958} // namespace test_util
59} // namespace extensions