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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator_unittest.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
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;
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_win.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698