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

Unified Diff: extensions/common/file_util_unittest.cc

Issue 1547413002: Reland of Change extension icon load errors to warnings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: extensions/common/file_util_unittest.cc
diff --git a/extensions/common/file_util_unittest.cc b/extensions/common/file_util_unittest.cc
index 0bfb8b9d79acc16cbb3d91d9fd1962751384d36d..afbcf3c83e6bd0ddaec206709f8bca20d6d6cf88 100644
--- a/extensions/common/file_util_unittest.cc
+++ b/extensions/common/file_util_unittest.cc
@@ -419,19 +419,39 @@
"extension includes the key file.*ext_root.a_key.pem"));
}
-TEST_F(FileUtilTest, CheckZeroLengthIconFile) {
+// Try to install an extension with a zero-length icon file.
+TEST_F(FileUtilTest, CheckZeroLengthAndMissingIconFile) {
base::FilePath install_dir;
ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &install_dir));
- // Try to install an extension with a zero-length icon file.
base::FilePath ext_dir =
install_dir.AppendASCII("file_util").AppendASCII("bad_icon");
std::string error;
scoped_refptr<Extension> extension(file_util::LoadExtension(
+ ext_dir, Manifest::INTERNAL, Extension::NO_FLAGS, &error));
+ EXPECT_TRUE(extension);
+ ASSERT_EQ(2U, extension->install_warnings().size());
+
+ EXPECT_EQ("Could not load extension icon 'missing-icon.png'.",
+ extension->install_warnings()[0].message);
+ EXPECT_EQ("Could not load extension icon 'icon.png'.",
+ extension->install_warnings()[1].message);
+}
+
+// Try to install an unpacked extension with a zero-length icon file.
+TEST_F(FileUtilTest, CheckZeroLengthAndMissingIconFileUnpacked) {
+ base::FilePath install_dir;
+ ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &install_dir));
+
+ base::FilePath ext_dir =
+ install_dir.AppendASCII("file_util").AppendASCII("bad_icon");
+
+ std::string error;
+ scoped_refptr<Extension> extension(file_util::LoadExtension(
ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- EXPECT_TRUE(extension.get() == NULL);
- EXPECT_STREQ("Could not load extension icon 'icon.png'.", error.c_str());
+ EXPECT_FALSE(extension);
+ EXPECT_EQ("Could not load extension icon 'missing-icon.png'.", error);
}
TEST_F(FileUtilTest, ExtensionURLToRelativeFilePath) {

Powered by Google App Engine
This is Rietveld 408576698