[email protected] | f971f9ca | 2014-01-07 21:28:49 | [diff] [blame] | 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. |
| 4 | |
| 5 | #include "extensions/common/test_util.h" |
| 6 | |
limasdf | 3d10254 | 2015-12-09 03:58:45 | [diff] [blame] | 7 | #include <utility> |
| 8 | |
[email protected] | f971f9ca | 2014-01-07 21:28:49 | [diff] [blame] | 9 | #include "extensions/common/extension.h" |
| 10 | #include "extensions/common/extension_builder.h" |
| 11 | #include "extensions/common/value_builder.h" |
| 12 | |
| 13 | namespace extensions { |
| 14 | namespace test_util { |
| 15 | |
limasdf | 704a902 | 2015-12-18 01:36:16 | [diff] [blame] | 16 | ExtensionBuilder BuildExtension(ExtensionBuilder builder) { |
dcheng | 794d2bd | 2016-02-27 03:51:32 | [diff] [blame] | 17 | builder.SetManifest(DictionaryBuilder() |
| 18 | .Set("name", "Test extension") |
| 19 | .Set("version", "1.0") |
| 20 | .Set("manifest_version", 2) |
| 21 | .Build()); |
limasdf | 704a902 | 2015-12-18 01:36:16 | [diff] [blame] | 22 | return builder; |
[email protected] | f971f9ca | 2014-01-07 21:28:49 | [diff] [blame] | 23 | } |
| 24 | |
limasdf | 704a902 | 2015-12-18 01:36:16 | [diff] [blame] | 25 | ExtensionBuilder BuildApp(ExtensionBuilder builder) { |
dcheng | 794d2bd | 2016-02-27 03:51:32 | [diff] [blame] | 26 | builder.SetManifest( |
sashab | 84817f9 | 2014-09-29 08:07:42 | [diff] [blame] | 27 | DictionaryBuilder() |
| 28 | .Set("name", "Test extension") |
| 29 | .Set("version", "1.0") |
| 30 | .Set("manifest_version", 2) |
dcheng | 794d2bd | 2016-02-27 03:51:32 | [diff] [blame] | 31 | .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()); |
limasdf | 704a902 | 2015-12-18 01:36:16 | [diff] [blame] | 40 | return builder; |
sashab | 84817f9 | 2014-09-29 08:07:42 | [diff] [blame] | 41 | } |
| 42 | |
[email protected] | 904eb66 | 2014-08-09 02:53:32 | [diff] [blame] | 43 | scoped_refptr<Extension> CreateEmptyExtension() { |
limasdf | f0dcf2f | 2014-09-18 20:17:37 | [diff] [blame] | 44 | return ExtensionBuilder() |
dcheng | 794d2bd | 2016-02-27 03:51:32 | [diff] [blame] | 45 | .SetManifest( |
| 46 | DictionaryBuilder().Set("name", "Test").Set("version", "1.0").Build()) |
limasdf | f0dcf2f | 2014-09-18 20:17:37 | [diff] [blame] | 47 | .Build(); |
[email protected] | 904eb66 | 2014-08-09 02:53:32 | [diff] [blame] | 48 | } |
| 49 | |
limasdf | f0dcf2f | 2014-09-18 20:17:37 | [diff] [blame] | 50 | scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) { |
[email protected] | f971f9ca | 2014-01-07 21:28:49 | [diff] [blame] | 51 | return ExtensionBuilder() |
dcheng | 794d2bd | 2016-02-27 03:51:32 | [diff] [blame] | 52 | .SetManifest( |
| 53 | DictionaryBuilder().Set("name", "test").Set("version", "0.1").Build()) |
[email protected] | f971f9ca | 2014-01-07 21:28:49 | [diff] [blame] | 54 | .SetID(id) |
| 55 | .Build(); |
| 56 | } |
| 57 | |
[email protected] | f971f9ca | 2014-01-07 21:28:49 | [diff] [blame] | 58 | } // namespace test_util |
| 59 | } // namespace extensions |