Index: chrome/common/extensions/extension_file_util_unittest.cc |
diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc |
index 541806646bfa8f0f28e74c1d301241af9b97cb1d..a9ecc78ad6d5291fe00f46449cabd09a74ef95d2 100644 |
--- a/chrome/common/extensions/extension_file_util_unittest.cc |
+++ b/chrome/common/extensions/extension_file_util_unittest.cc |
@@ -14,6 +14,7 @@ |
#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" |
#include "chrome/common/extensions/extension.h" |
#include "chrome/common/extensions/extension_manifest_constants.h" |
+#include "chrome/common/extensions/manifest.h" |
#include "chrome/common/extensions/manifest_handler.h" |
#include "grit/generated_resources.h" |
#include "testing/gmock/include/gmock/gmock.h" |
@@ -21,6 +22,7 @@ |
#include "ui/base/l10n/l10n_util.h" |
using extensions::Extension; |
+using extensions::Manifest; |
namespace keys = extension_manifest_keys; |
@@ -120,7 +122,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionWithValidLocales) { |
std::string error; |
scoped_refptr<Extension> extension(extension_file_util::LoadExtension( |
- install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); |
+ install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
ASSERT_TRUE(extension != NULL); |
EXPECT_EQ("The first extension that I made.", extension->description()); |
} |
@@ -136,7 +138,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionWithoutLocalesFolder) { |
std::string error; |
scoped_refptr<Extension> extension(extension_file_util::LoadExtension( |
- install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); |
+ install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
ASSERT_FALSE(extension == NULL); |
EXPECT_TRUE(error.empty()); |
} |
@@ -210,7 +212,7 @@ TEST_F(ExtensionFileUtilTest, |
std::string error; |
scoped_refptr<Extension> extension(extension_file_util::LoadExtension( |
- install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); |
+ install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
ASSERT_TRUE(extension == NULL); |
ASSERT_FALSE(error.empty()); |
ASSERT_STREQ("Manifest file is missing or unreadable.", error.c_str()); |
@@ -227,7 +229,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionGivesHelpfullErrorOnBadManifest) { |
std::string error; |
scoped_refptr<Extension> extension(extension_file_util::LoadExtension( |
- install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); |
+ install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
ASSERT_TRUE(extension == NULL); |
ASSERT_FALSE(error.empty()); |
ASSERT_STREQ("Manifest is not valid JSON. " |
@@ -243,7 +245,7 @@ TEST_F(ExtensionFileUtilTest, FailLoadingNonUTF8Scripts) { |
std::string error; |
scoped_refptr<Extension> extension(extension_file_util::LoadExtension( |
- install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); |
+ install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
ASSERT_TRUE(extension == NULL); |
ASSERT_STREQ("Could not load file 'bad_encoding.js' for content script. " |
"It isn't UTF-8 encoded.", error.c_str()); |
@@ -364,7 +366,7 @@ TEST_F(ExtensionFileUtilTest, ExtensionResourceURLToFilePath) { |
static scoped_refptr<Extension> LoadExtensionManifest( |
DictionaryValue* manifest, |
const FilePath& manifest_dir, |
- Extension::Location location, |
+ Manifest::Location location, |
int extra_flags, |
std::string* error) { |
scoped_refptr<Extension> extension = Extension::Create( |
@@ -375,7 +377,7 @@ static scoped_refptr<Extension> LoadExtensionManifest( |
static scoped_refptr<Extension> LoadExtensionManifest( |
const std::string& manifest_value, |
const FilePath& manifest_dir, |
- Extension::Location location, |
+ Manifest::Location location, |
int extra_flags, |
std::string* error) { |
JSONStringValueSerializer serializer(manifest_value); |
@@ -411,10 +413,10 @@ TEST_F(ExtensionFileUtilTest, ValidateThemeUTF8) { |
"}", non_ascii_file.c_str()); |
std::string error; |
scoped_refptr<Extension> extension = LoadExtensionManifest( |
- kManifest, temp.path(), Extension::LOAD, 0, &error); |
+ kManifest, temp.path(), Manifest::LOAD, 0, &error); |
ASSERT_TRUE(extension.get()) << error; |
- Extension::InstallWarningVector warnings; |
+ extensions::InstallWarning::Vector warnings; |
EXPECT_TRUE(extension_file_util::ValidateExtension(extension, |
&error, &warnings)) << |
error; |
@@ -441,9 +443,9 @@ TEST_F(ExtensionFileUtilTest, MAYBE_BackgroundScriptsMustExist) { |
value->Set("background.scripts", scripts); |
std::string error; |
- Extension::InstallWarningVector warnings; |
+ extensions::InstallWarning::Vector warnings; |
scoped_refptr<Extension> extension = LoadExtensionManifest( |
- value.get(), temp.path(), Extension::LOAD, 0, &error); |
+ value.get(), temp.path(), Manifest::LOAD, 0, &error); |
ASSERT_TRUE(extension.get()) << error; |
EXPECT_FALSE(extension_file_util::ValidateExtension(extension, |
@@ -456,7 +458,7 @@ TEST_F(ExtensionFileUtilTest, MAYBE_BackgroundScriptsMustExist) { |
scripts->Clear(); |
scripts->Append(Value::CreateStringValue("http://google.com/foo.js")); |
- extension = LoadExtensionManifest(value.get(), temp.path(), Extension::LOAD, |
+ extension = LoadExtensionManifest(value.get(), temp.path(), Manifest::LOAD, |
0, &error); |
ASSERT_TRUE(extension.get()) << error; |
@@ -537,7 +539,7 @@ TEST_F(ExtensionFileUtilTest, WarnOnPrivateKey) { |
std::string error; |
scoped_refptr<Extension> extension(extension_file_util::LoadExtension( |
- ext_path, "the_id", Extension::EXTERNAL_PREF, |
+ ext_path, "the_id", Manifest::EXTERNAL_PREF, |
Extension::NO_FLAGS, &error)); |
ASSERT_TRUE(extension.get()) << error; |
ASSERT_EQ(1u, extension->install_warnings().size()); |
@@ -545,13 +547,13 @@ TEST_F(ExtensionFileUtilTest, WarnOnPrivateKey) { |
extension->install_warnings(), |
testing::ElementsAre( |
testing::Field( |
- &Extension::InstallWarning::message, |
+ &extensions::InstallWarning::message, |
testing::ContainsRegex( |
"extension includes the key file.*ext_root.a_key.pem")))); |
// Turn the warning into an error with ERROR_ON_PRIVATE_KEY. |
extension = extension_file_util::LoadExtension( |
- ext_path, "the_id", Extension::EXTERNAL_PREF, |
+ ext_path, "the_id", Manifest::EXTERNAL_PREF, |
Extension::ERROR_ON_PRIVATE_KEY, &error); |
EXPECT_FALSE(extension.get()); |
EXPECT_THAT(error, |
@@ -571,7 +573,7 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) { |
std::string error; |
scoped_refptr<Extension> extension(extension_file_util::LoadExtension( |
- ext_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); |
+ ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
ASSERT_TRUE(extension == NULL); |
ASSERT_STREQ("Could not load extension icon 'icon.png'.", |
error.c_str()); |
@@ -583,7 +585,7 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) { |
.AppendASCII("gggggggggggggggggggggggggggggggg"); |
scoped_refptr<Extension> extension2(extension_file_util::LoadExtension( |
- ext_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); |
+ ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
ASSERT_TRUE(extension2 == NULL); |
ASSERT_STREQ("Could not load icon 'icon.png' for browser action.", |
error.c_str()); |
@@ -595,7 +597,7 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) { |
.AppendASCII("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"); |
scoped_refptr<Extension> extension3(extension_file_util::LoadExtension( |
- ext_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); |
+ ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
ASSERT_TRUE(extension3 == NULL); |
ASSERT_STREQ("Could not load icon 'icon.png' for page action.", |
error.c_str()); |