Index: chrome/browser/tab_contents/thumbnail_generator_unittest.cc |
=================================================================== |
--- chrome/browser/tab_contents/thumbnail_generator_unittest.cc (revision 82144) |
+++ chrome/browser/tab_contents/thumbnail_generator_unittest.cc (working copy) |
@@ -190,11 +190,12 @@ |
TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_SingleColor) { |
const SkColor kBlack = SkColorSetRGB(0, 0, 0); |
const gfx::Size kSize(20, 10); |
- gfx::CanvasSkia canvas(kSize.width(), kSize.height(), true); |
+ gfx::CanvasSkia canvas; |
+ ASSERT_TRUE(canvas.Init(kSize.width(), kSize.height(), true)); |
// Fill all pixesl in black. |
canvas.FillRectInt(kBlack, 0, 0, kSize.width(), kSize.height()); |
- SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
+ SkBitmap bitmap = canvas.skia_canvas()->getTopDevice()->accessBitmap(false); |
// The thumbnail should deserve the highest boring score. |
EXPECT_DOUBLE_EQ(1.0, ThumbnailGenerator::CalculateBoringScore(&bitmap)); |
} |
@@ -204,13 +205,14 @@ |
const SkColor kWhite = SkColorSetRGB(0xFF, 0xFF, 0xFF); |
const gfx::Size kSize(20, 10); |
- gfx::CanvasSkia canvas(kSize.width(), kSize.height(), true); |
+ gfx::CanvasSkia canvas; |
+ ASSERT_TRUE(canvas.Init(kSize.width(), kSize.height(), true)); |
// Fill all pixesl in black. |
canvas.FillRectInt(kBlack, 0, 0, kSize.width(), kSize.height()); |
// Fill the left half pixels in white. |
canvas.FillRectInt(kWhite, 0, 0, kSize.width() / 2, kSize.height()); |
- SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
+ SkBitmap bitmap = canvas.skia_canvas()->getTopDevice()->accessBitmap(false); |
ASSERT_EQ(kSize.width(), bitmap.width()); |
ASSERT_EQ(kSize.height(), bitmap.height()); |
// The thumbnail should be less boring because two colors are used. |
@@ -219,8 +221,10 @@ |
TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_TallerThanWide) { |
// The input bitmap is vertically long. |
- gfx::CanvasSkia canvas(40, 90, true); |
- const SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
+ gfx::CanvasSkia canvas; |
+ ASSERT_TRUE(canvas.Init(40, 90, true)); |
+ const SkBitmap& bitmap = |
+ canvas.skia_canvas()->getTopDevice()->accessBitmap(false); |
// The desired size is square. |
ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped; |
@@ -235,8 +239,10 @@ |
TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_WiderThanTall) { |
// The input bitmap is horizontally long. |
- gfx::CanvasSkia canvas(90, 40, true); |
- const SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
+ gfx::CanvasSkia canvas; |
+ ASSERT_TRUE(canvas.Init(90, 40, true)); |
+ const SkBitmap& bitmap = |
+ canvas.skia_canvas()->getTopDevice()->accessBitmap(false); |
// The desired size is square. |
ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped; |
@@ -251,8 +257,10 @@ |
TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NotClipped) { |
// The input bitmap is square. |
- gfx::CanvasSkia canvas(40, 40, true); |
- const SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
+ gfx::CanvasSkia canvas; |
+ ASSERT_TRUE(canvas.Init(40, 40, true)); |
+ const SkBitmap& bitmap = |
+ canvas.skia_canvas()->getTopDevice()->accessBitmap(false); |
// The desired size is square. |
ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped; |
@@ -267,8 +275,10 @@ |
TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NonSquareOutput) { |
// The input bitmap is square. |
- gfx::CanvasSkia canvas(40, 40, true); |
- const SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
+ gfx::CanvasSkia canvas; |
+ ASSERT_TRUE(canvas.Init(40, 40, true)); |
+ const SkBitmap& bitmap = |
+ canvas.skia_canvas()->getTopDevice()->accessBitmap(false); |
// The desired size is horizontally long. |
ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped; |