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

Unified Diff: ui/message_center/message_center_impl_unittest.cc

Issue 2760133002: ui: Remove a bunch of uses of gfx::Canvas::ExtractImageRep() (Closed)
Patch Set: canvasbounds: ashnit Created 3 years, 9 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 | « components/favicon/core/fallback_icon_service.cc ('k') | ui/views/controls/button/blue_button_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/message_center_impl_unittest.cc
diff --git a/ui/message_center/message_center_impl_unittest.cc b/ui/message_center/message_center_impl_unittest.cc
index b9b6a6e2c8edd912e8569b011da0e3819dc3b5a0..a238bc49ff02497c62e67fcc5c54f2f169440ab6 100644
--- a/ui/message_center/message_center_impl_unittest.cc
+++ b/ui/message_center/message_center_impl_unittest.cc
@@ -1083,13 +1083,17 @@ TEST_F(MessageCenterImplTestWithChangeQueue, QueuedDirectUpdates) {
gfx::Size new_size(16, 16);
EXPECT_NE(original_size, new_size);
- gfx::Canvas canvas(new_size, 1.0f, true);
- canvas.DrawColor(SK_ColorBLUE);
- gfx::Image testImage(gfx::Image(gfx::ImageSkia(canvas.ExtractImageRep())));
- message_center()->SetNotificationIcon(id, testImage);
- message_center()->SetNotificationImage(id, testImage);
- message_center()->SetNotificationButtonIcon(id, 0, testImage);
- message_center()->SetNotificationButtonIcon(id, 1, testImage);
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(new_size.width(), new_size.height(), true);
+ sk_sp<SkSurface> surface = SkSurface::MakeRasterDirect(
+ bitmap.info(), bitmap.getPixels(), bitmap.rowBytes());
+ surface->getCanvas()->drawColor(SK_ColorBLUE);
+ gfx::Image test_image(
+ gfx::Image(gfx::ImageSkia(gfx::ImageSkiaRep(bitmap, 1.f))));
+ message_center()->SetNotificationIcon(id, test_image);
+ message_center()->SetNotificationImage(id, test_image);
+ message_center()->SetNotificationButtonIcon(id, 0, test_image);
+ message_center()->SetNotificationButtonIcon(id, 1, test_image);
// The notification should be in the queue.
EXPECT_FALSE(message_center()->FindVisibleNotificationById(id));
« no previous file with comments | « components/favicon/core/fallback_icon_service.cc ('k') | ui/views/controls/button/blue_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698