| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/extensions/extension_test_util.h" | 5 #include "chrome/common/extensions/extension_test_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 13 #include "chrome/common/extensions/extension_builder.h" | 13 #include "chrome/common/extensions/extension_builder.h" |
| 14 #include "chrome/common/extensions/extension_manifest_constants.h" | 14 #include "extensions/common/manifest_constants.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 using extensions::DictionaryBuilder; | 17 using extensions::DictionaryBuilder; |
| 18 using extensions::Extension; | 18 using extensions::Extension; |
| 19 using extensions::ExtensionBuilder; | 19 using extensions::ExtensionBuilder; |
| 20 using extensions::ListBuilder; | 20 using extensions::ListBuilder; |
| 21 using extensions::Manifest; | 21 using extensions::Manifest; |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 namespace extension_test_util { | 24 namespace extension_test_util { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 DictionaryBuilder().Set("permissions", permissions)); | 39 DictionaryBuilder().Set("permissions", permissions)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace extension_test_util | 42 } // namespace extension_test_util |
| 43 } // namespace extensions | 43 } // namespace extensions |
| 44 | 44 |
| 45 namespace extension_test_util { | 45 namespace extension_test_util { |
| 46 | 46 |
| 47 scoped_refptr<Extension> CreateExtensionWithID(std::string id) { | 47 scoped_refptr<Extension> CreateExtensionWithID(std::string id) { |
| 48 base::DictionaryValue values; | 48 base::DictionaryValue values; |
| 49 values.SetString(extension_manifest_keys::kName, "test"); | 49 values.SetString(extensions::manifest_keys::kName, "test"); |
| 50 values.SetString(extension_manifest_keys::kVersion, "0.1"); | 50 values.SetString(extensions::manifest_keys::kVersion, "0.1"); |
| 51 std::string error; | 51 std::string error; |
| 52 return Extension::Create(base::FilePath(), extensions::Manifest::INTERNAL, | 52 return Extension::Create(base::FilePath(), extensions::Manifest::INTERNAL, |
| 53 values, Extension::NO_FLAGS, id, &error); | 53 values, Extension::NO_FLAGS, id, &error); |
| 54 } | 54 } |
| 55 | 55 |
| 56 scoped_refptr<Extension> LoadManifestUnchecked(const std::string& dir, | 56 scoped_refptr<Extension> LoadManifestUnchecked(const std::string& dir, |
| 57 const std::string& test_file, | 57 const std::string& test_file, |
| 58 Manifest::Location location, | 58 Manifest::Location location, |
| 59 int extra_flags, | 59 int extra_flags, |
| 60 const std::string& id, | 60 const std::string& id, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const std::string& test_file) { | 108 const std::string& test_file) { |
| 109 return LoadManifest(dir, test_file, Extension::NO_FLAGS); | 109 return LoadManifest(dir, test_file, Extension::NO_FLAGS); |
| 110 } | 110 } |
| 111 | 111 |
| 112 scoped_refptr<Extension> LoadManifest(const std::string& dir, | 112 scoped_refptr<Extension> LoadManifest(const std::string& dir, |
| 113 const std::string& test_file) { | 113 const std::string& test_file) { |
| 114 return LoadManifest(dir, test_file, Extension::NO_FLAGS); | 114 return LoadManifest(dir, test_file, Extension::NO_FLAGS); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace extension_test_util | 117 } // namespace extension_test_util |
| OLD | NEW |