diff options
author | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-16 19:14:39 +0000 |
---|---|---|
committer | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-16 19:14:39 +0000 |
commit | b3fe68db246694707b52c8ad7b239c9a8bee0bb8 (patch) | |
tree | da67c2f2b3a60c49872d32ae2f9b4b38a441f7c5 | |
parent | f464dd73785972f0b93b5412bb7677bf8d939013 (diff) | |
download | chromium_src-b3fe68db246694707b52c8ad7b239c9a8bee0bb8.zip chromium_src-b3fe68db246694707b52c8ad7b239c9a8bee0bb8.tar.gz chromium_src-b3fe68db246694707b52c8ad7b239c9a8bee0bb8.tar.bz2 |
Move ExtensionUnpacker into extensions:: namespace, rename it to Unpacker
BUG=135462, 117261
Review URL: https://chromiumcodereview.appspot.com/10704060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146853 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/sandboxed_unpacker.cc | 13 | ||||
-rw-r--r-- | chrome/browser/extensions/sandboxed_unpacker.h | 18 | ||||
-rw-r--r-- | chrome/browser/extensions/sandboxed_unpacker_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 4 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 2 | ||||
-rw-r--r-- | chrome/common/chrome_utility_messages.h | 2 | ||||
-rw-r--r-- | chrome/common/extensions/unpacker.cc (renamed from chrome/common/extensions/extension_unpacker.cc) | 43 | ||||
-rw-r--r-- | chrome/common/extensions/unpacker.h (renamed from chrome/common/extensions/extension_unpacker.h) | 26 | ||||
-rw-r--r-- | chrome/common/extensions/unpacker_unittest.cc (renamed from chrome/common/extensions/extension_unpacker_unittest.cc) | 41 | ||||
-rw-r--r-- | chrome/utility/chrome_content_utility_client.cc | 4 |
10 files changed, 82 insertions, 77 deletions
diff --git a/chrome/browser/extensions/sandboxed_unpacker.cc b/chrome/browser/extensions/sandboxed_unpacker.cc index 80520ea..ffdba4e 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_unpacker.cc @@ -24,7 +24,7 @@ #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_file_util.h" #include "chrome/common/extensions/extension_l10n_util.h" -#include "chrome/common/extensions/extension_unpacker.h" +#include "chrome/common/extensions/unpacker.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/utility_process_host.h" #include "crypto/signature_verifier.h" @@ -35,7 +35,6 @@ using content::BrowserThread; using content::UtilityProcessHost; -using extensions::Extension; // The following macro makes histograms that record the length of paths // in this file much easier to read. @@ -273,8 +272,7 @@ void SandboxedUnpacker::Start() { link_free_crx_path)); } else { // Otherwise, unpack the extension in this process. - ExtensionUnpacker unpacker( - temp_crx_path, extension_id_, location_, creation_flags_); + Unpacker unpacker(temp_crx_path, extension_id_, location_, creation_flags_); if (unpacker.Run() && unpacker.DumpImagesToFile() && unpacker.DumpMessageCatalogsToFile()) { OnUnpackExtensionSucceeded(*unpacker.parsed_manifest()); @@ -618,8 +616,8 @@ DictionaryValue* SandboxedUnpacker::RewriteManifestFile( } bool SandboxedUnpacker::RewriteImageFiles() { - ExtensionUnpacker::DecodedImages images; - if (!ExtensionUnpacker::ReadImagesFromFile(temp_dir_.path(), &images)) { + Unpacker::DecodedImages images; + if (!Unpacker::ReadImagesFromFile(temp_dir_.path(), &images)) { // Couldn't read image data from disk. ReportFailure( COULD_NOT_READ_IMAGE_DATA_FROM_DISK, @@ -714,8 +712,7 @@ bool SandboxedUnpacker::RewriteImageFiles() { bool SandboxedUnpacker::RewriteCatalogFiles() { DictionaryValue catalogs; - if (!ExtensionUnpacker::ReadMessageCatalogsFromFile(temp_dir_.path(), - &catalogs)) { + if (!Unpacker::ReadMessageCatalogsFromFile(temp_dir_.path(), &catalogs)) { // Could not read catalog data from disk. ReportFailure( COULD_NOT_READ_CATALOG_DATA_FROM_DISK, diff --git a/chrome/browser/extensions/sandboxed_unpacker.h b/chrome/browser/extensions/sandboxed_unpacker.h index e05b9da..7fc537c 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.h +++ b/chrome/browser/extensions/sandboxed_unpacker.h @@ -36,7 +36,7 @@ class SandboxedUnpackerClient virtual void OnUnpackSuccess(const FilePath& temp_dir, const FilePath& extension_root, const base::DictionaryValue* original_manifest, - const extensions::Extension* extension) = 0; + const Extension* extension) = 0; virtual void OnUnpackFailure(const string16& error) = 0; protected: @@ -74,7 +74,7 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { // is done in a sandboxed subprocess. Otherwise, it is done in-process. SandboxedUnpacker(const FilePath& crx_path, bool run_out_of_process, - extensions::Extension::Location location, + Extension::Location location, int creation_flags, SandboxedUnpackerClient* client); @@ -155,11 +155,11 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { // |public_key_|. Returns true if the signature validates, false otherwise. // // NOTE: Having this method here is a bit ugly. This code should really live - // in ExtensionUnpacker as it is not specific to sandboxed unpacking. It was - // put here because we cannot run windows crypto code in the sandbox. But we - // could still have this method statically on ExtensionUnpacker so that code - // just for unpacking is there and code just for sandboxing of unpacking is - // here. + // in extensions::Unpacker as it is not specific to sandboxed unpacking. It + // was put here because we cannot run windows crypto code in the sandbox. But + // we could still have this method statically on extensions::Unpacker so that + // code just for unpacking is there and code just for sandboxing of unpacking + // is here. bool ValidateSignature(); // Starts the utility process that unpacks our extension. @@ -205,7 +205,7 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { FilePath extension_root_; // Represents the extension we're unpacking. - scoped_refptr<extensions::Extension> extension_; + scoped_refptr<Extension> extension_; // Whether we've received a response from the utility process yet. bool got_response_; @@ -221,7 +221,7 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { base::TimeTicks unpack_start_time_; // Location to use for the unpacked extension. - extensions::Extension::Location location_; + Extension::Location location_; // Creation flags to use for the extension. These flags will be used // when calling Extenion::Create() by the crx installer. diff --git a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc index 01c396a..3be80b2 100644 --- a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc @@ -14,7 +14,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/extension_unpacker.h" +#include "chrome/common/extensions/unpacker.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -94,7 +94,7 @@ class SandboxedUnpackerTest : public testing::Test { "Original path: " << original_path.value() << ", Crx path: " << crx_path.value(); - unpacker_.reset(new ExtensionUnpacker( + unpacker_.reset(new Unpacker( crx_path, std::string(), Extension::INTERNAL, Extension::NO_FLAGS)); // Build a temp area where the extension will be unpacked. @@ -161,7 +161,7 @@ class SandboxedUnpackerTest : public testing::Test { ScopedTempDir temp_dir_; FilePath temp_path_; MockSandboxedUnpackerClient* client_; - scoped_ptr<ExtensionUnpacker> unpacker_; + scoped_ptr<Unpacker> unpacker_; scoped_refptr<SandboxedUnpacker> sandboxed_unpacker_; MessageLoop loop_; scoped_ptr<content::TestBrowserThread> file_thread_; diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index ea8fad6..84ffc03 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -150,8 +150,6 @@ 'common/extensions/extension_set.h', 'common/extensions/extension_switch_utils.cc', 'common/extensions/extension_switch_utils.h', - 'common/extensions/extension_unpacker.cc', - 'common/extensions/extension_unpacker.h', 'common/extensions/features/feature.cc', 'common/extensions/features/feature.h', 'common/extensions/features/feature_provider.h', @@ -183,6 +181,8 @@ 'common/extensions/permissions/permission_set.h', 'common/extensions/permissions/permissions_info.cc', 'common/extensions/permissions/permissions_info.h', + 'common/extensions/unpacker.cc', + 'common/extensions/unpacker.h', 'common/extensions/update_manifest.cc', 'common/extensions/update_manifest.h', 'common/extensions/url_pattern.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 35eb603..dee9749 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1902,7 +1902,6 @@ 'common/extensions/extension_test_util.h', 'common/extensions/extension_test_util.cc', 'common/extensions/extension_unittest.cc', - 'common/extensions/extension_unpacker_unittest.cc', 'common/extensions/features/feature_unittest.cc', 'common/extensions/features/simple_feature_provider_unittest.cc', 'common/extensions/manifest_tests/extension_manifest_test.cc', @@ -1942,6 +1941,7 @@ 'common/extensions/matcher/url_matcher_factory_unittest.cc', 'common/extensions/manifest_unittest.cc', 'common/extensions/permissions/permission_set_unittest.cc', + 'common/extensions/unpacker_unittest.cc', 'common/extensions/update_manifest_unittest.cc', 'common/extensions/url_pattern_set_unittest.cc', 'common/extensions/url_pattern_unittest.cc', diff --git a/chrome/common/chrome_utility_messages.h b/chrome/common/chrome_utility_messages.h index df8aefa..67508264 100644 --- a/chrome/common/chrome_utility_messages.h +++ b/chrome/common/chrome_utility_messages.h @@ -102,7 +102,7 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults, // Reply when the utility process is done unpacking an extension. |manifest| // is the parsed manifest.json file. // The unpacker should also have written out files containing the decoded -// images and message catalogs from the extension. See ExtensionUnpacker for +// images and message catalogs from the extension. See extensions::Unpacker for // details. IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackExtension_Succeeded, DictionaryValue /* manifest */) diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/unpacker.cc index 965ea0e..7c1bed4 100644 --- a/chrome/common/extensions/extension_unpacker.cc +++ b/chrome/common/extensions/unpacker.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/extension_unpacker.h" +#include "chrome/common/extensions/unpacker.h" #include <set> @@ -30,8 +30,6 @@ namespace errors = extension_manifest_errors; namespace keys = extension_manifest_keys; namespace filenames = extension_filenames; -using extensions::Extension; - namespace { // Errors @@ -86,20 +84,22 @@ bool PathContainsParentDirectory(const FilePath& path) { } // namespace -ExtensionUnpacker::ExtensionUnpacker(const FilePath& extension_path, - const std::string& extension_id, - Extension::Location location, - int creation_flags) +namespace extensions { + +Unpacker::Unpacker(const FilePath& extension_path, + const std::string& extension_id, + Extension::Location location, + int creation_flags) : extension_path_(extension_path), extension_id_(extension_id), location_(location), creation_flags_(creation_flags) { } -ExtensionUnpacker::~ExtensionUnpacker() { +Unpacker::~Unpacker() { } -DictionaryValue* ExtensionUnpacker::ReadManifest() { +DictionaryValue* Unpacker::ReadManifest() { FilePath manifest_path = temp_install_dir_.Append(Extension::kManifestFilename); if (!file_util::PathExists(manifest_path)) { @@ -123,8 +123,7 @@ DictionaryValue* ExtensionUnpacker::ReadManifest() { return static_cast<DictionaryValue*>(root.release()); } -bool ExtensionUnpacker::ReadAllMessageCatalogs( - const std::string& default_locale) { +bool Unpacker::ReadAllMessageCatalogs(const std::string& default_locale) { FilePath locales_path = temp_install_dir_.Append(Extension::kLocaleFolder); @@ -151,7 +150,7 @@ bool ExtensionUnpacker::ReadAllMessageCatalogs( return true; } -bool ExtensionUnpacker::Run() { +bool Unpacker::Run() { DVLOG(1) << "Installing extension " << extension_path_.value(); // <profile>/Extensions/INSTALL_TEMP/<version> @@ -218,7 +217,7 @@ bool ExtensionUnpacker::Run() { return true; } -bool ExtensionUnpacker::DumpImagesToFile() { +bool Unpacker::DumpImagesToFile() { IPC::Message pickle; // We use a Message so we can use WriteParam. IPC::WriteParam(&pickle, decoded_images_); @@ -233,7 +232,7 @@ bool ExtensionUnpacker::DumpImagesToFile() { return true; } -bool ExtensionUnpacker::DumpMessageCatalogsToFile() { +bool Unpacker::DumpMessageCatalogsToFile() { IPC::Message pickle; IPC::WriteParam(&pickle, *parsed_catalogs_.get()); @@ -249,8 +248,8 @@ bool ExtensionUnpacker::DumpMessageCatalogsToFile() { } // static -bool ExtensionUnpacker::ReadImagesFromFile(const FilePath& extension_path, - DecodedImages* images) { +bool Unpacker::ReadImagesFromFile(const FilePath& extension_path, + DecodedImages* images) { FilePath path = extension_path.AppendASCII(filenames::kDecodedImagesFilename); std::string file_str; if (!file_util::ReadFileToString(path, &file_str)) @@ -262,8 +261,8 @@ bool ExtensionUnpacker::ReadImagesFromFile(const FilePath& extension_path, } // static -bool ExtensionUnpacker::ReadMessageCatalogsFromFile( - const FilePath& extension_path, DictionaryValue* catalogs) { +bool Unpacker::ReadMessageCatalogsFromFile(const FilePath& extension_path, + DictionaryValue* catalogs) { FilePath path = extension_path.AppendASCII( filenames::kDecodedMessageCatalogsFilename); std::string file_str; @@ -275,7 +274,7 @@ bool ExtensionUnpacker::ReadMessageCatalogsFromFile( return IPC::ReadParam(&pickle, &iter, catalogs); } -bool ExtensionUnpacker::AddDecodedImage(const FilePath& path) { +bool Unpacker::AddDecodedImage(const FilePath& path) { // Make sure it's not referencing a file outside the extension's subdir. if (path.IsAbsolute() || PathContainsParentDirectory(path)) { SetError(kPathNamesMustBeAbsoluteOrLocalError); @@ -292,7 +291,7 @@ bool ExtensionUnpacker::AddDecodedImage(const FilePath& path) { return true; } -bool ExtensionUnpacker::ReadMessageCatalog(const FilePath& message_path) { +bool Unpacker::ReadMessageCatalog(const FilePath& message_path) { std::string error; JSONFileValueSerializer serializer(message_path); scoped_ptr<DictionaryValue> root( @@ -328,6 +327,8 @@ bool ExtensionUnpacker::ReadMessageCatalog(const FilePath& message_path) { return true; } -void ExtensionUnpacker::SetError(const std::string &error) { +void Unpacker::SetError(const std::string &error) { error_message_ = UTF8ToUTF16(error); } + +} // namespace extensions diff --git a/chrome/common/extensions/extension_unpacker.h b/chrome/common/extensions/unpacker.h index 36cd551..9908165 100644 --- a/chrome/common/extensions/extension_unpacker.h +++ b/chrome/common/extensions/unpacker.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ -#define CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ +#ifndef CHROME_COMMON_EXTENSIONS_UNPACKER_H_ +#define CHROME_COMMON_EXTENSIONS_UNPACKER_H_ #include <string> #include <vector> @@ -19,19 +19,21 @@ namespace base { class DictionaryValue; } +namespace extensions { + // This class unpacks an extension. It is designed to be used in a sandboxed // child process. We unpack and parse various bits of the extension, then // report back to the browser process, who then transcodes the pre-parsed bits // and writes them back out to disk for later use. -class ExtensionUnpacker { +class Unpacker { public: typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages; - ExtensionUnpacker(const FilePath& extension_path, - const std::string& extension_id, - extensions::Extension::Location location, - int creation_flags); - ~ExtensionUnpacker(); + Unpacker(const FilePath& extension_path, + const std::string& extension_id, + Extension::Location location, + int creation_flags); + ~Unpacker(); // Install the extension file at |extension_path|. Returns true on success. // Otherwise, error_message will contain a string explaining what went wrong. @@ -92,7 +94,7 @@ class ExtensionUnpacker { std::string extension_id_; // The location to use for the created extension. - extensions::Extension::Location location_; + Extension::Location location_; // The creation flags to use with the created extension. int creation_flags_; @@ -114,7 +116,9 @@ class ExtensionUnpacker { // The last error message that was set. Empty if there were no errors. string16 error_message_; - DISALLOW_COPY_AND_ASSIGN(ExtensionUnpacker); + DISALLOW_COPY_AND_ASSIGN(Unpacker); }; -#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ +} // namespace extensions + +#endif // CHROME_COMMON_EXTENSIONS_UNPACKER_H_ diff --git a/chrome/common/extensions/extension_unpacker_unittest.cc b/chrome/common/extensions/unpacker_unittest.cc index 64d08f6..2a052e9 100644 --- a/chrome/common/extensions/extension_unpacker_unittest.cc +++ b/chrome/common/extensions/unpacker_unittest.cc @@ -10,16 +10,18 @@ #include "base/values.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/extension_unpacker.h" +#include "chrome/common/extensions/unpacker.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" namespace errors = extension_manifest_errors; namespace keys = extension_manifest_keys; -class ExtensionUnpackerTest : public testing::Test { +namespace extensions { + +class UnpackerTest : public testing::Test { public: - ~ExtensionUnpackerTest() { + ~UnpackerTest() { LOG(WARNING) << "Deleting temp dir: " << temp_dir_.path().LossyDisplayName(); LOG(WARNING) << temp_dir_.Delete(); @@ -42,16 +44,15 @@ public: "Original path " << original_path.value() << ", Crx path " << crx_path.value(); - unpacker_.reset( - new ExtensionUnpacker(crx_path, - std::string(), - extensions::Extension::INTERNAL, - extensions::Extension::NO_FLAGS)); + unpacker_.reset(new Unpacker(crx_path, + std::string(), + Extension::INTERNAL, + Extension::NO_FLAGS)); } protected: ScopedTempDir temp_dir_; - scoped_ptr<ExtensionUnpacker> unpacker_; + scoped_ptr<Unpacker> unpacker_; }; // Crashes intermittently on Windows, see http://crbug.com/109238 @@ -60,7 +61,7 @@ public: #else #define MAYBE_EmptyDefaultLocale EmptyDefaultLocale #endif -TEST_F(ExtensionUnpackerTest, MAYBE_EmptyDefaultLocale) { +TEST_F(UnpackerTest, MAYBE_EmptyDefaultLocale) { SetupUnpacker("empty_default_locale.crx"); EXPECT_FALSE(unpacker_->Run()); EXPECT_EQ(ASCIIToUTF16(errors::kInvalidDefaultLocale), @@ -75,7 +76,7 @@ TEST_F(ExtensionUnpackerTest, MAYBE_EmptyDefaultLocale) { #define MAYBE_HasDefaultLocaleMissingLocalesFolder \ HasDefaultLocaleMissingLocalesFolder #endif -TEST_F(ExtensionUnpackerTest, MAYBE_HasDefaultLocaleMissingLocalesFolder) { +TEST_F(UnpackerTest, MAYBE_HasDefaultLocaleMissingLocalesFolder) { SetupUnpacker("has_default_missing_locales.crx"); EXPECT_FALSE(unpacker_->Run()); EXPECT_EQ(ASCIIToUTF16(errors::kLocalesTreeMissing), @@ -88,7 +89,7 @@ TEST_F(ExtensionUnpackerTest, MAYBE_HasDefaultLocaleMissingLocalesFolder) { #else #define MAYBE_InvalidDefaultLocale InvalidDefaultLocale #endif -TEST_F(ExtensionUnpackerTest, MAYBE_InvalidDefaultLocale) { +TEST_F(UnpackerTest, MAYBE_InvalidDefaultLocale) { SetupUnpacker("invalid_default_locale.crx"); EXPECT_FALSE(unpacker_->Run()); EXPECT_EQ(ASCIIToUTF16(errors::kInvalidDefaultLocale), @@ -101,7 +102,7 @@ TEST_F(ExtensionUnpackerTest, MAYBE_InvalidDefaultLocale) { #else #define MAYBE_InvalidMessagesFile InvalidMessagesFile #endif -TEST_F(ExtensionUnpackerTest, MAYBE_InvalidMessagesFile) { +TEST_F(UnpackerTest, MAYBE_InvalidMessagesFile) { SetupUnpacker("invalid_messages_file.crx"); EXPECT_FALSE(unpacker_->Run()); EXPECT_TRUE(MatchPattern(unpacker_->error_message(), @@ -115,7 +116,7 @@ TEST_F(ExtensionUnpackerTest, MAYBE_InvalidMessagesFile) { #else #define MAYBE_MissingDefaultData MissingDefaultData #endif -TEST_F(ExtensionUnpackerTest, MAYBE_MissingDefaultData) { +TEST_F(UnpackerTest, MAYBE_MissingDefaultData) { SetupUnpacker("missing_default_data.crx"); EXPECT_FALSE(unpacker_->Run()); EXPECT_EQ(ASCIIToUTF16(errors::kLocalesNoDefaultMessages), @@ -130,7 +131,7 @@ TEST_F(ExtensionUnpackerTest, MAYBE_MissingDefaultData) { #define MAYBE_MissingDefaultLocaleHasLocalesFolder \ MissingDefaultLocaleHasLocalesFolder #endif -TEST_F(ExtensionUnpackerTest, MAYBE_MissingDefaultLocaleHasLocalesFolder) { +TEST_F(UnpackerTest, MAYBE_MissingDefaultLocaleHasLocalesFolder) { SetupUnpacker("missing_default_has_locales.crx"); EXPECT_FALSE(unpacker_->Run()); EXPECT_EQ(ASCIIToUTF16(errors::kLocalesNoDefaultLocaleSpecified), @@ -143,7 +144,7 @@ TEST_F(ExtensionUnpackerTest, MAYBE_MissingDefaultLocaleHasLocalesFolder) { #else #define MAYBE_MissingMessagesFile MissingMessagesFile #endif -TEST_F(ExtensionUnpackerTest, MAYBE_MissingMessagesFile) { +TEST_F(UnpackerTest, MAYBE_MissingMessagesFile) { SetupUnpacker("missing_messages_file.crx"); EXPECT_FALSE(unpacker_->Run()); EXPECT_TRUE(MatchPattern(unpacker_->error_message(), @@ -157,7 +158,7 @@ TEST_F(ExtensionUnpackerTest, MAYBE_MissingMessagesFile) { #else #define MAYBE_NoLocaleData NoLocaleData #endif -TEST_F(ExtensionUnpackerTest, MAYBE_NoLocaleData) { +TEST_F(UnpackerTest, MAYBE_NoLocaleData) { SetupUnpacker("no_locale_data.crx"); EXPECT_FALSE(unpacker_->Run()); EXPECT_EQ(ASCIIToUTF16(errors::kLocalesNoDefaultMessages), @@ -170,7 +171,7 @@ TEST_F(ExtensionUnpackerTest, MAYBE_NoLocaleData) { #else #define MAYBE_GoodL10n GoodL10n #endif -TEST_F(ExtensionUnpackerTest, MAYBE_GoodL10n) { +TEST_F(UnpackerTest, MAYBE_GoodL10n) { SetupUnpacker("good_l10n.crx"); EXPECT_TRUE(unpacker_->Run()); EXPECT_TRUE(unpacker_->error_message().empty()); @@ -183,9 +184,11 @@ TEST_F(ExtensionUnpackerTest, MAYBE_GoodL10n) { #else #define MAYBE_NoL10n NoL10n #endif -TEST_F(ExtensionUnpackerTest, MAYBE_NoL10n) { +TEST_F(UnpackerTest, MAYBE_NoL10n) { SetupUnpacker("no_l10n.crx"); EXPECT_TRUE(unpacker_->Run()); EXPECT_TRUE(unpacker_->error_message().empty()); EXPECT_EQ(0U, unpacker_->parsed_catalogs()->size()); } + +} // namespace extensions diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index 9a129e9..f1a0724 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc @@ -18,7 +18,7 @@ #include "chrome/common/chrome_utility_messages.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_l10n_util.h" -#include "chrome/common/extensions/extension_unpacker.h" +#include "chrome/common/extensions/unpacker.h" #include "chrome/common/extensions/update_manifest.h" #include "chrome/common/web_resource/web_resource_unpacker.h" #include "content/public/utility/utility_thread.h" @@ -104,7 +104,7 @@ void ChromeContentUtilityClient::OnUnpackExtension( int creation_flags) { CHECK(location > extensions::Extension::INVALID); CHECK(location < extensions::Extension::NUM_LOCATIONS); - ExtensionUnpacker unpacker( + extensions::Unpacker unpacker( extension_path, extension_id, static_cast<extensions::Extension::Location>(location), |