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

Unified Diff: chrome/browser/extensions/extension_icon_manager_unittest.cc

Issue 9979001: Attempt to load component extension favicon from the resources first. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Merge Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/extensions/image_loading_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_icon_manager_unittest.cc
===================================================================
--- chrome/browser/extensions/extension_icon_manager_unittest.cc (revision 133434)
+++ chrome/browser/extensions/extension_icon_manager_unittest.cc (working copy)
@@ -137,3 +137,45 @@
EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon));
}
+
+#if defined(FILE_MANAGER_EXTENSION)
+// Tests loading an icon for a component extension.
+TEST_F(ExtensionIconManagerTest, LoadComponentExtensionResource) {
+ SkBitmap default_icon = GetDefaultIcon();
+
+ FilePath test_dir;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
+ FilePath manifest_path = test_dir.AppendASCII(
+ "extensions/file_manager/app.json");
+
+ JSONFileValueSerializer serializer(manifest_path);
+ scoped_ptr<DictionaryValue> manifest(
+ static_cast<DictionaryValue*>(serializer.Deserialize(NULL, NULL)));
+ ASSERT_TRUE(manifest.get() != NULL);
+
+ std::string error;
+ scoped_refptr<Extension> extension(Extension::Create(
+ manifest_path.DirName(), Extension::COMPONENT, *manifest.get(),
+ Extension::STRICT_ERROR_CHECKS, &error));
+ ASSERT_TRUE(extension.get());
+
+ TestIconManager icon_manager(this);
+ // Load the icon and grab the bitmap.
+ icon_manager.LoadIcon(extension.get());
+ WaitForImageLoad();
+ SkBitmap first_icon = icon_manager.GetIcon(extension->id());
+ EXPECT_FALSE(gfx::BitmapsAreEqual(first_icon, default_icon));
+
+ // Remove the icon from the manager.
+ icon_manager.RemoveIcon(extension->id());
+
+ // Now re-load the icon - we should get the same result bitmap (and not the
+ // default icon).
+ icon_manager.LoadIcon(extension.get());
+ WaitForImageLoad();
+ SkBitmap second_icon = icon_manager.GetIcon(extension->id());
+ EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon));
+
+ EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon));
+}
+#endif
« no previous file with comments | « no previous file | chrome/browser/extensions/image_loading_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698