Home | History | Annotate | Download | only in extensions
      1 // Copyright (c) 2012 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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_TEST_UTIL_H_
      6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_TEST_UTIL_H_
      7 
      8 #include <string>
      9 
     10 #include "base/memory/ref_counted.h"
     11 #include "extensions/common/extension_builder.h"
     12 #include "extensions/common/manifest.h"
     13 
     14 namespace extensions {
     15 class Extension;
     16 
     17 // Newer functions go here.
     18 // TODO(mpcomplete): migrate older functions over.
     19 namespace extension_test_util {
     20 
     21 ExtensionBuilder& BuildExtension(ExtensionBuilder& builder);
     22 ExtensionBuilder& BuildExtensionWithPermissions(ExtensionBuilder& builder,
     23                                                 ListBuilder& permissions);
     24 
     25 }  // namespace extension_test_util
     26 }  // namespace extensions
     27 
     28 namespace extension_test_util {
     29 
     30 // Return a very simple extension with id |id|.
     31 scoped_refptr<extensions::Extension> CreateExtensionWithID(std::string id);
     32 
     33 // Helpers for loading manifests, |dir| is relative to chrome::DIR_TEST_DATA
     34 // followed by "extensions".
     35 scoped_refptr<extensions::Extension> LoadManifestUnchecked(
     36     const std::string& dir,
     37     const std::string& test_file,
     38     extensions::Manifest::Location location,
     39     int extra_flags,
     40     const std::string& id,
     41     std::string* error);
     42 
     43 scoped_refptr<extensions::Extension> LoadManifestUnchecked(
     44     const std::string& dir,
     45     const std::string& test_file,
     46     extensions::Manifest::Location location,
     47     int extra_flags,
     48     std::string* error);
     49 
     50 scoped_refptr<extensions::Extension> LoadManifest(
     51     const std::string& dir,
     52     const std::string& test_file,
     53     extensions::Manifest::Location location,
     54     int extra_flags);
     55 
     56 scoped_refptr<extensions::Extension> LoadManifest(const std::string& dir,
     57                                                   const std::string& test_file,
     58                                                   int extra_flags);
     59 
     60 scoped_refptr<extensions::Extension> LoadManifestStrict(
     61     const std::string& dir,
     62     const std::string& test_file);
     63 
     64 scoped_refptr<extensions::Extension> LoadManifest(const std::string& dir,
     65                                                   const std::string& test_file);
     66 
     67 }  // namespace extension_test_util
     68 
     69 #endif  // CHROME_COMMON_EXTENSIONS_EXTENSION_TEST_UTIL_H_
     70