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

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

Issue 10825012: chromeos: Fix pixelated icons in app list and launcher (part 2) (by xiyuan) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 "chrome/browser/extensions/image_loading_tracker.h"
6
7 #include <algorithm>
tbarzic 2012/07/25 19:37:34 pkotwicz 2012/07/25 02:00:39 Nit: I don't think yo
tbarzic 2012/07/25 19:53:53 Done.
8
5 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
6 #include "base/message_loop.h" 10 #include "base/message_loop.h"
7 #include "base/path_service.h" 11 #include "base/path_service.h"
8 #include "chrome/browser/extensions/image_loading_tracker.h"
9 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
10 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
11 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/extension_icon_set.h" 15 #include "chrome/common/extensions/extension_icon_set.h"
13 #include "chrome/common/extensions/extension_resource.h" 16 #include "chrome/common/extensions/extension_resource.h"
14 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
15 #include "content/public/test/test_browser_thread.h" 18 #include "content/public/test/test_browser_thread.h"
16 #include "grit/component_extension_resources.h" 19 #include "grit/component_extension_resources.h"
17 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 EXPECT_EQ(ExtensionIconSet::EXTENSION_ICON_SMALLISH, 193 EXPECT_EQ(ExtensionIconSet::EXTENSION_ICON_SMALLISH,
191 image_.ToSkBitmap()->width()); 194 image_.ToSkBitmap()->width());
192 } 195 }
193 196
194 // Tests loading multiple dimensions of the same image. 197 // Tests loading multiple dimensions of the same image.
195 TEST_F(ImageLoadingTrackerTest, MultipleImages) { 198 TEST_F(ImageLoadingTrackerTest, MultipleImages) {
196 scoped_refptr<Extension> extension(CreateExtension( 199 scoped_refptr<Extension> extension(CreateExtension(
197 "image_loading_tracker", Extension::INVALID)); 200 "image_loading_tracker", Extension::INVALID));
198 ASSERT_TRUE(extension.get() != NULL); 201 ASSERT_TRUE(extension.get() != NULL);
199 202
200 std::vector<ImageLoadingTracker::ImageInfo> info_list; 203 std::vector<ImageLoadingTracker::ImageRepInfo> info_list;
201 int sizes[] = {ExtensionIconSet::EXTENSION_ICON_SMALLISH, 204 int sizes[] = {ExtensionIconSet::EXTENSION_ICON_SMALLISH,
202 ExtensionIconSet::EXTENSION_ICON_BITTY}; 205 ExtensionIconSet::EXTENSION_ICON_BITTY};
203 for (size_t i = 0; i < arraysize(sizes); ++i) { 206 for (size_t i = 0; i < arraysize(sizes); ++i) {
204 ExtensionResource resource = 207 ExtensionResource resource =
205 extension->GetIconResource(sizes[i], ExtensionIconSet::MATCH_EXACTLY); 208 extension->GetIconResource(sizes[i], ExtensionIconSet::MATCH_EXACTLY);
206 info_list.push_back(ImageLoadingTracker::ImageInfo( 209 info_list.push_back(ImageLoadingTracker::ImageRepInfo(
207 resource, gfx::Size(sizes[i], sizes[i]))); 210 resource,
211 ImageLoadingTracker::ImageRepInfo::RESIZE_WHEN_LARGER,
212 gfx::Size(sizes[i], sizes[i]),
213 ui::SCALE_FACTOR_NONE));
208 } 214 }
209 215
210 ImageLoadingTracker loader(this); 216 ImageLoadingTracker loader(this);
211 loader.LoadImages(extension.get(), info_list, ImageLoadingTracker::CACHE); 217 loader.LoadImages(extension.get(), info_list, ImageLoadingTracker::CACHE);
212 218
213 // The image isn't cached, so we should not have received notification. 219 // The image isn't cached, so we should not have received notification.
214 EXPECT_EQ(0, image_loaded_count()); 220 EXPECT_EQ(0, image_loaded_count());
215 221
216 WaitForImageLoad(); 222 WaitForImageLoad();
217 223
(...skipping 28 matching lines...) Expand all
246 #if defined(FILE_MANAGER_EXTENSION) 252 #if defined(FILE_MANAGER_EXTENSION)
247 ImageLoadingTracker loader(this); 253 ImageLoadingTracker loader(this);
248 int resource_id; 254 int resource_id;
249 ASSERT_EQ(true, 255 ASSERT_EQ(true,
250 loader.IsComponentExtensionResource(extension.get(), 256 loader.IsComponentExtensionResource(extension.get(),
251 resource, 257 resource,
252 resource_id)); 258 resource_id));
253 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id); 259 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id);
254 #endif 260 #endif
255 } 261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698