Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2863)

Unified Diff: chrome/common/extensions/unpacker_unittest.cc

Issue 10868050: Remove "theme" in extension/app unpacker error messages, make those messages localizable, and add u… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed trailing periods in messages, as these messages get included before being shown to users in… Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/unpacker_unittest.cc
diff --git a/chrome/common/extensions/unpacker_unittest.cc b/chrome/common/extensions/unpacker_unittest.cc
index 2a052e998838783208599d758677feed078e32b1..868c840e56f7d3d6640ce50a2aa8aeb90cfbaec3 100644
--- a/chrome/common/extensions/unpacker_unittest.cc
+++ b/chrome/common/extensions/unpacker_unittest.cc
@@ -9,12 +9,14 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_manifest_constants.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 filenames = extension_filenames;
namespace keys = extension_manifest_keys;
namespace extensions {
@@ -191,4 +193,70 @@ TEST_F(UnpackerTest, MAYBE_NoL10n) {
EXPECT_EQ(0U, unpacker_->parsed_catalogs()->size());
}
+// Disabled on Windows because it probably crashes intermittently as described
+// in <http://crbug.com/109238>. However, because the logic being testing here
+// is platform-independant, this test should still provide good coverage.
+#if defined(OS_WIN)
+#define MAYBE_UnzipDirectoryError DISABLED_UnzipDirectoryError
+#else
+#define MAYBE_UnzipDirectoryError UnzipDirectoryError
+#endif
+TEST_F(UnpackerTest, MAYBE_UnzipDirectoryError) {
+ const char* kExpected = "Could not create directory for unzipping: ";
+ SetupUnpacker("good_package.crx");
+ FilePath path = temp_dir_.path().AppendASCII(filenames::kTempExtensionName);
+ ASSERT_TRUE(file_util::WriteFile(path, "foo", 3));
+ EXPECT_FALSE(unpacker_->Run());
+ EXPECT_TRUE(StartsWith(unpacker_->error_message(),
+ ASCIIToUTF16(kExpected),
+ false)) << "Expected prefix: \"" << kExpected <<
asargent_no_longer_on_chrome 2012/08/23 22:16:36 nit: the chrome-specific style guide encourages a
+ "\", actual error: \"" << unpacker_->error_message() <<
+ "\"";
+}
+
+// Disabled on Windows because it probably crashes intermittently as described
+// in <http://crbug.com/109238>. However, because the logic being testing here
+// is platform-independant, this test should still provide good coverage.
+#if defined(OS_WIN)
+#define MAYBE_ImageDecodingError DISABLED_ImageDecodingError
+#else
+#define MAYBE_ImageDecodingError ImageDecodingError
+#endif
+TEST_F(UnpackerTest, MAYBE_ImageDecodingError) {
+ const char* kExpected = "Could not decode image";
+ SetupUnpacker("bad_image.crx");
+ EXPECT_FALSE(unpacker_->Run());
+ EXPECT_EQ(ASCIIToUTF16(kExpected), unpacker_->error_message());
+}
+
+// Disabled on Windows because it probably crashes intermittently as described
+// in <http://crbug.com/109238>. However, because the logic being testing here
+// is platform-independant, this test should still provide good coverage.
+#if defined(OS_WIN)
+#define MAYBE_UnzipError DISABLED_UnzipError
+#else
+#define MAYBE_UnzipError UnzipError
+#endif
+TEST_F(UnpackerTest, MAYBE_UnzipError) {
+ const char* kExpected = "Could not unzip extension";
+ SetupUnpacker("bad_zip.crx");
+ EXPECT_FALSE(unpacker_->Run());
+ EXPECT_EQ(ASCIIToUTF16(kExpected), unpacker_->error_message());
+}
+
+// Disabled on Windows because it probably crashes intermittently as described
+// in <http://crbug.com/109238>. However, because the logic being testing here
+// is platform-independant, this test should still provide good coverage.
+#if defined(OS_WIN)
+#define MAYBE_BadPathError DISABLED_BadPathError
+#else
+#define MAYBE_BadPathError BadPathError
+#endif
+TEST_F(UnpackerTest, MAYBE_BadPathError) {
+ const char* kExpected = "Path names must not be absolute or contain '..'";
+ SetupUnpacker("bad_path.crx");
+ EXPECT_FALSE(unpacker_->Run());
+ EXPECT_EQ(ASCIIToUTF16(kExpected), unpacker_->error_message());
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698