Index: chrome/common/extensions/extension_action_unittest.cc |
diff --git a/chrome/common/extensions/extension_action_unittest.cc b/chrome/common/extensions/extension_action_unittest.cc |
index f34ab88a0ca604864090493067ee193d68a96d84..248a443169b95e5bedef2d4fb30979b82b4c3f6d 100644 |
--- a/chrome/common/extensions/extension_action_unittest.cc |
+++ b/chrome/common/extensions/extension_action_unittest.cc |
@@ -10,6 +10,7 @@ |
#include "chrome/common/extensions/extension_action.h" |
#include "googleurl/src/gurl.h" |
#include "grit/theme_resources.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
#include "ui/base/resource/resource_bundle.h" |
@@ -17,28 +18,9 @@ |
#include "ui/gfx/skia_util.h" |
#include "webkit/glue/image_decoder.h" |
-namespace { |
- |
-bool ImagesAreEqual(const gfx::Image& i1, const gfx::Image& i2) { |
- return gfx::BitmapsAreEqual(*i1.ToSkBitmap(), *i2.ToSkBitmap()); |
-} |
- |
-gfx::Image LoadIcon(const std::string& filename) { |
- FilePath path; |
- PathService::Get(chrome::DIR_TEST_DATA, &path); |
- path = path.AppendASCII("extensions").AppendASCII(filename); |
- |
- std::string file_contents; |
- file_util::ReadFileToString(path, &file_contents); |
- const unsigned char* data = |
- reinterpret_cast<const unsigned char*>(file_contents.data()); |
+using ::testing::Return; |
- SkBitmap bitmap; |
- webkit_glue::ImageDecoder decoder; |
- bitmap = decoder.Decode(data, file_contents.length()); |
- |
- return gfx::Image(bitmap); |
-} |
+namespace { |
class ExtensionActionTest : public testing::Test { |
public: |
@@ -63,29 +45,6 @@ TEST_F(ExtensionActionTest, Title) { |
ASSERT_EQ("baz", action.GetTitle(100)); |
} |
-TEST_F(ExtensionActionTest, Icon) { |
- gfx::Image puzzle_piece = |
- ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
- IDR_EXTENSIONS_FAVICON); |
- gfx::Image icon1 = LoadIcon("icon1.png"); |
- gfx::Image icon2 = LoadIcon("icon2.png"); |
tbarzic
2012/09/14 22:24:17
this will be covered in extension_action_icon_fact
|
- ASSERT_TRUE(ImagesAreEqual(puzzle_piece, action.GetIcon(1))); |
- |
- action.set_default_icon_path("the_default.png"); |
- ASSERT_TRUE(ImagesAreEqual(puzzle_piece, action.GetIcon(1))) |
- << "Still returns the puzzle piece because the image isn't loaded yet."; |
- action.CacheIcon(icon2); |
- ASSERT_TRUE(ImagesAreEqual(icon2, action.GetIcon(1))); |
- |
- action.SetIcon(ExtensionAction::kDefaultTabId, icon1); |
- ASSERT_TRUE(ImagesAreEqual(icon1, action.GetIcon(100))) |
- << "SetIcon(kDefaultTabId) overrides the default_icon_path."; |
- |
- action.SetIcon(100, icon2); |
- ASSERT_TRUE(ImagesAreEqual(icon1, action.GetIcon(1))); |
- ASSERT_TRUE(ImagesAreEqual(icon2, action.GetIcon(100))); |
-} |
- |
TEST_F(ExtensionActionTest, Visibility) { |
// Supports the icon animation. |
MessageLoop message_loop; |