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

Unified Diff: ui/gfx/image/image_unittest.cc

Issue 10378009: Get rid of Image::Image(SkBitmap*) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: k Created 8 years, 7 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 | « ui/gfx/image/image_mac_unittest.mm ('k') | ui/gfx/image/image_unittest_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_unittest.cc
diff --git a/ui/gfx/image/image_unittest.cc b/ui/gfx/image/image_unittest.cc
index 87935621c9446701bb51f2808dfa85567cefc239..51e06f440a422270d69d6ee88dc7fd27c3b93f01 100644
--- a/ui/gfx/image/image_unittest.cc
+++ b/ui/gfx/image/image_unittest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image/image.h"
@@ -68,8 +67,8 @@ TEST_F(ImageTest, SkiaToSkia) {
}
TEST_F(ImageTest, SkiaRefToSkia) {
- scoped_ptr<SkBitmap> originalBitmap(gt::CreateBitmap(25, 25));
- gfx::Image image(*originalBitmap.get());
+ SkBitmap originalBitmap(gt::CreateBitmap(25, 25));
+ gfx::Image image(originalBitmap);
const SkBitmap* bitmap = image.ToSkBitmap();
EXPECT_TRUE(bitmap);
EXPECT_FALSE(bitmap->isNull());
@@ -104,7 +103,7 @@ TEST_F(ImageTest, SkiaToPlatform) {
if (!kUsesSkiaNatively)
EXPECT_FALSE(image.HasRepresentation(gt::GetPlatformRepresentationType()));
- EXPECT_TRUE(gt::ToPlatformType(image));
+ EXPECT_TRUE(gt::IsPlatformImageValid(gt::ToPlatformType(image)));
EXPECT_EQ(kRepCount, image.RepresentationCount());
const SkBitmap* bitmap = image.ToSkBitmap();
@@ -128,7 +127,7 @@ TEST_F(ImageTest, PlatformToSkia) {
EXPECT_FALSE(bitmap->isNull());
EXPECT_EQ(kRepCount, image.RepresentationCount());
- EXPECT_TRUE(gt::ToPlatformType(image));
+ EXPECT_TRUE(gt::IsPlatformImageValid(gt::ToPlatformType(image)));
EXPECT_EQ(kRepCount, image.RepresentationCount());
EXPECT_TRUE(image.HasRepresentation(gfx::Image::kImageRepSkia));
@@ -136,11 +135,11 @@ TEST_F(ImageTest, PlatformToSkia) {
TEST_F(ImageTest, PlatformToPlatform) {
gfx::Image image(gt::CreatePlatformImage());
- EXPECT_TRUE(gt::ToPlatformType(image));
+ EXPECT_TRUE(gt::IsPlatformImageValid(gt::ToPlatformType(image)));
EXPECT_EQ(1U, image.RepresentationCount());
// Make sure double conversion doesn't happen.
- EXPECT_TRUE(gt::ToPlatformType(image));
+ EXPECT_TRUE(gt::IsPlatformImageValid(gt::ToPlatformType(image)));
EXPECT_EQ(1U, image.RepresentationCount());
EXPECT_TRUE(image.HasRepresentation(gt::GetPlatformRepresentationType()));
@@ -221,7 +220,8 @@ TEST_F(ImageTest, SwapRepresentations) {
image1.SwapRepresentations(&image2);
EXPECT_EQ(bitmap2, image1.ToSkBitmap());
- EXPECT_EQ(platform_image, gt::ToPlatformType(image1));
+ EXPECT_TRUE(gt::PlatformImagesEqual(platform_image,
+ gt::ToPlatformType(image1)));
EXPECT_EQ(bitmap1, image2.ToSkBitmap());
EXPECT_EQ(kRepCount, image1.RepresentationCount());
EXPECT_EQ(1U, image2.RepresentationCount());
@@ -237,7 +237,7 @@ TEST_F(ImageTest, Copy) {
EXPECT_EQ(1U, image2.RepresentationCount());
EXPECT_EQ(image1.ToSkBitmap(), image2.ToSkBitmap());
- EXPECT_TRUE(gt::ToPlatformType(image2));
+ EXPECT_TRUE(gt::IsPlatformImageValid(gt::ToPlatformType(image2)));
EXPECT_EQ(kRepCount, image2.RepresentationCount());
EXPECT_EQ(kRepCount, image1.RepresentationCount());
}
@@ -258,8 +258,8 @@ TEST_F(ImageTest, MultiResolutionSkBitmap) {
const int height2 = 24;
std::vector<const SkBitmap*> bitmaps;
- bitmaps.push_back(gt::CreateBitmap(width1, height1));
- bitmaps.push_back(gt::CreateBitmap(width2, height2));
+ bitmaps.push_back(new SkBitmap(gt::CreateBitmap(width1, height1)));
+ bitmaps.push_back(new SkBitmap(gt::CreateBitmap(width2, height2)));
gfx::Image image(bitmaps);
EXPECT_EQ(1u, image.RepresentationCount());
« no previous file with comments | « ui/gfx/image/image_mac_unittest.mm ('k') | ui/gfx/image/image_unittest_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698