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

Side by Side Diff: chrome/browser/extensions/image_loading_tracker_unittest.cc

Issue 10245003: Makes ImageSkia more like SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated comment Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/json/json_file_value_serializer.h" 5 #include "base/json/json_file_value_serializer.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "chrome/browser/extensions/image_loading_tracker.h" 8 #include "chrome/browser/extensions/image_loading_tracker.h"
9 #include "chrome/common/chrome_notification_types.h" 9 #include "chrome/common/chrome_notification_types.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 // The image isn't cached, so we should not have received notification. 212 // The image isn't cached, so we should not have received notification.
213 EXPECT_EQ(0, image_loaded_count()); 213 EXPECT_EQ(0, image_loaded_count());
214 214
215 WaitForImageLoad(); 215 WaitForImageLoad();
216 216
217 // We should have gotten the image. 217 // We should have gotten the image.
218 EXPECT_EQ(1, image_loaded_count()); 218 EXPECT_EQ(1, image_loaded_count());
219 219
220 // Check that all images were loaded. 220 // Check that all images were loaded.
221 const std::vector<const SkBitmap*>& bitmaps = 221 const std::vector<SkBitmap> bitmaps = image_.ToImageSkia()->bitmaps();
222 image_.ToImageSkia()->bitmaps();
223 ASSERT_EQ(2u, bitmaps.size()); 222 ASSERT_EQ(2u, bitmaps.size());
224 const SkBitmap* bmp1 = bitmaps[0]; 223 const SkBitmap* bmp1 = &bitmaps[0];
225 const SkBitmap* bmp2 = bitmaps[1]; 224 const SkBitmap* bmp2 = &bitmaps[1];
226 if (bmp1->width() > bmp2->width()) { 225 if (bmp1->width() > bmp2->width()) {
227 std::swap(bmp1, bmp2); 226 std::swap(bmp1, bmp2);
228 } 227 }
229 EXPECT_EQ(ExtensionIconSet::EXTENSION_ICON_BITTY, bmp1->width()); 228 EXPECT_EQ(ExtensionIconSet::EXTENSION_ICON_BITTY, bmp1->width());
230 EXPECT_EQ(ExtensionIconSet::EXTENSION_ICON_SMALLISH, bmp2->width()); 229 EXPECT_EQ(ExtensionIconSet::EXTENSION_ICON_SMALLISH, bmp2->width());
231 } 230 }
232 231
233 // Tests IsComponentExtensionResource function. 232 // Tests IsComponentExtensionResource function.
234 TEST_F(ImageLoadingTrackerTest, IsComponentExtensionResource) { 233 TEST_F(ImageLoadingTrackerTest, IsComponentExtensionResource) {
235 scoped_refptr<Extension> extension(CreateExtension( 234 scoped_refptr<Extension> extension(CreateExtension(
236 "file_manager", Extension::COMPONENT)); 235 "file_manager", Extension::COMPONENT));
237 ASSERT_TRUE(extension.get() != NULL); 236 ASSERT_TRUE(extension.get() != NULL);
238 237
239 ExtensionResource resource = 238 ExtensionResource resource =
240 extension->GetIconResource(ExtensionIconSet::EXTENSION_ICON_BITTY, 239 extension->GetIconResource(ExtensionIconSet::EXTENSION_ICON_BITTY,
241 ExtensionIconSet::MATCH_EXACTLY); 240 ExtensionIconSet::MATCH_EXACTLY);
242 241
243 #if defined(FILE_MANAGER_EXTENSION) 242 #if defined(FILE_MANAGER_EXTENSION)
244 ImageLoadingTracker loader(this); 243 ImageLoadingTracker loader(this);
245 int resource_id; 244 int resource_id;
246 ASSERT_EQ(true, 245 ASSERT_EQ(true,
247 loader.IsComponentExtensionResource(extension.get(), 246 loader.IsComponentExtensionResource(extension.get(),
248 resource, 247 resource,
249 resource_id)); 248 resource_id));
250 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id); 249 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id);
251 #endif 250 #endif
252 } 251 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.cc ('k') | chrome/browser/themes/browser_theme_pack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698