summaryrefslogtreecommitdiffstats
path: root/extensions/common/test_util.cc
blob: 4eacfa68f3e91c94e53f6654f3b8b1192efba73d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/common/test_util.h"

#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/value_builder.h"

namespace extensions {
namespace test_util {

ExtensionBuilder& BuildExtension(ExtensionBuilder& builder) {
  return builder
         .SetManifest(DictionaryBuilder()
                      .Set("name", "Test extension")
                      .Set("version", "1.0")
                      .Set("manifest_version", 2));
}

scoped_refptr<Extension> CreateEmptyExtension() {
  scoped_refptr<Extension> empty_extension(
      ExtensionBuilder()
          .SetManifest(
               DictionaryBuilder().Set("name", "Test").Set("version", "1.0"))
          .Build());
  return empty_extension;
}

scoped_refptr<Extension> CreateExtensionWithID(const std::string& id) {
  return ExtensionBuilder()
      .SetManifest(
           DictionaryBuilder().Set("name", "test").Set("version", "0.1"))
      .SetID(id)
      .Build();
}

}  // namespace test_util
}  // namespace extensions