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

Side by Side Diff: ui/message_center/message_center_impl_unittest.cc

Issue 2764163002: Use SkCanvas::SkCanvas(SkBitmap) instead of going thru SkSurface (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/ui/webui/app_launcher_login_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SkBitmap bitmap; 1086 SkBitmap bitmap;
1087 bitmap.allocN32Pixels(new_size.width(), new_size.height(), true); 1087 bitmap.allocN32Pixels(new_size.width(), new_size.height(), true);
1088 sk_sp<SkSurface> surface = SkSurface::MakeRasterDirect( 1088 SkCanvas canvas(bitmap);
1089 bitmap.info(), bitmap.getPixels(), bitmap.rowBytes()); 1089 canvas.drawColor(SK_ColorBLUE);
1090 surface->getCanvas()->drawColor(SK_ColorBLUE);
1091 gfx::Image test_image( 1090 gfx::Image test_image(
1092 gfx::Image(gfx::ImageSkia(gfx::ImageSkiaRep(bitmap, 1.f)))); 1091 gfx::Image(gfx::ImageSkia(gfx::ImageSkiaRep(bitmap, 1.f))));
1093 message_center()->SetNotificationIcon(id, test_image); 1092 message_center()->SetNotificationIcon(id, test_image);
1094 message_center()->SetNotificationImage(id, test_image); 1093 message_center()->SetNotificationImage(id, test_image);
1095 message_center()->SetNotificationButtonIcon(id, 0, test_image); 1094 message_center()->SetNotificationButtonIcon(id, 0, test_image);
1096 message_center()->SetNotificationButtonIcon(id, 1, test_image); 1095 message_center()->SetNotificationButtonIcon(id, 1, test_image);
1097 1096
1098 // The notification should be in the queue. 1097 // The notification should be in the queue.
1099 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id)); 1098 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id));
1100 1099
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 // Then open the message center. 1262 // Then open the message center.
1264 message_center()->SetVisibility(VISIBILITY_MESSAGE_CENTER); 1263 message_center()->SetVisibility(VISIBILITY_MESSAGE_CENTER);
1265 1264
1266 // Then update a notification; the update should have propagated. 1265 // Then update a notification; the update should have propagated.
1267 message_center()->RemoveNotification(id, false); 1266 message_center()->RemoveNotification(id, false);
1268 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id)); 1267 EXPECT_FALSE(message_center()->FindVisibleNotificationById(id));
1269 } 1268 }
1270 1269
1271 } // namespace internal 1270 } // namespace internal
1272 } // namespace message_center 1271 } // namespace message_center
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/app_launcher_login_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698