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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/message_center_impl.h" 5 #include "ui/message_center/message_center_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 1076
1077 message_center()->AddNotification(std::move(notification)); 1077 message_center()->AddNotification(std::move(notification));
1078 1078
1079 // The notification should be in the queue. 1079 // The notification should be in the queue.
1080 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id)); 1080 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id));
1081 1081
1082 // Now try setting the icon to a different size. 1082 // Now try setting the icon to a different size.
1083 gfx::Size new_size(16, 16); 1083 gfx::Size new_size(16, 16);
1084 EXPECT_NE(original_size, new_size); 1084 EXPECT_NE(original_size, new_size);
1085 1085
1086 gfx::Canvas canvas(new_size, 1.0f, true); 1086 SkBitmap bitmap;
1087 canvas.DrawColor(SK_ColorBLUE); 1087 bitmap.allocN32Pixels(new_size.width(), new_size.height(), true);
1088 gfx::Image testImage(gfx::Image(gfx::ImageSkia(canvas.ExtractImageRep()))); 1088 sk_sp<SkSurface> surface = SkSurface::MakeRasterDirect(
1089 message_center()->SetNotificationIcon(id, testImage); 1089 bitmap.info(), bitmap.getPixels(), bitmap.rowBytes());
1090 message_center()->SetNotificationImage(id, testImage); 1090 surface->getCanvas()->drawColor(SK_ColorBLUE);
1091 message_center()->SetNotificationButtonIcon(id, 0, testImage); 1091 gfx::Image test_image(
1092 message_center()->SetNotificationButtonIcon(id, 1, testImage); 1092 gfx::Image(gfx::ImageSkia(gfx::ImageSkiaRep(bitmap, 1.f))));
1093 message_center()->SetNotificationIcon(id, test_image);
1094 message_center()->SetNotificationImage(id, test_image);
1095 message_center()->SetNotificationButtonIcon(id, 0, test_image);
1096 message_center()->SetNotificationButtonIcon(id, 1, test_image);
1093 1097
1094 // The notification should be in the queue. 1098 // The notification should be in the queue.
1095 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id)); 1099 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id));
1096 1100
1097 // Close the message center; then the update should have propagated. 1101 // Close the message center; then the update should have propagated.
1098 message_center()->SetVisibility(VISIBILITY_TRANSIENT); 1102 message_center()->SetVisibility(VISIBILITY_TRANSIENT);
1099 // The notification should no longer be in the queue. 1103 // The notification should no longer be in the queue.
1100 EXPECT_TRUE(message_center()->FindVisibleNotificationById(id)); 1104 EXPECT_TRUE(message_center()->FindVisibleNotificationById(id));
1101 1105
1102 Notification* mc_notification = 1106 Notification* mc_notification =
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 // Then open the message center. 1263 // Then open the message center.
1260 message_center()->SetVisibility(VISIBILITY_MESSAGE_CENTER); 1264 message_center()->SetVisibility(VISIBILITY_MESSAGE_CENTER);
1261 1265
1262 // Then update a notification; the update should have propagated. 1266 // Then update a notification; the update should have propagated.
1263 message_center()->RemoveNotification(id, false); 1267 message_center()->RemoveNotification(id, false);
1264 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id)); 1268 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id));
1265 } 1269 }
1266 1270
1267 } // namespace internal 1271 } // namespace internal
1268 } // namespace message_center 1272 } // namespace message_center
OLDNEW
« 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