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

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

Issue 10905005: Change browser/page action default icon defined in manifest to support hidpi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable unittest on android Created 8 years, 3 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 | « chrome/common/extensions/extension_action.cc ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7a52911a3049a4c93567f1424c4cd944bd59082a 100644
--- a/chrome/common/extensions/extension_action_unittest.cc
+++ b/chrome/common/extensions/extension_action_unittest.cc
@@ -2,44 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_path.h"
-#include "base/file_util.h"
#include "base/message_loop.h"
-#include "base/path_service.h"
-#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_action.h"
#include "googleurl/src/gurl.h"
-#include "grit/theme_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image_skia.h"
-#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());
-
- SkBitmap bitmap;
- webkit_glue::ImageDecoder decoder;
- bitmap = decoder.Decode(data, file_contents.length());
-
- return gfx::Image(bitmap);
-}
-
class ExtensionActionTest : public testing::Test {
public:
ExtensionActionTest()
@@ -63,29 +32,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");
- 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;
« no previous file with comments | « chrome/common/extensions/extension_action.cc ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698