OLD | NEW |
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" | 5 #include "chrome/browser/extensions/image_loading_tracker.h" |
6 | 6 |
7 #include "base/json/json_file_value_serializer.h" | 7 #include "base/json/json_file_value_serializer.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; | 237 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; |
238 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; | 238 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; |
239 if (img_rep1->pixel_width() > img_rep2->pixel_width()) { | 239 if (img_rep1->pixel_width() > img_rep2->pixel_width()) { |
240 std::swap(img_rep1, img_rep2); | 240 std::swap(img_rep1, img_rep2); |
241 } | 241 } |
242 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, | 242 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, |
243 img_rep1->pixel_width()); | 243 img_rep1->pixel_width()); |
244 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, | 244 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, |
245 img_rep2->pixel_width()); | 245 img_rep2->pixel_width()); |
246 } | 246 } |
247 | |
248 // Tests IsComponentExtensionResource function. | |
249 TEST_F(ImageLoadingTrackerTest, IsComponentExtensionResource) { | |
250 scoped_refptr<Extension> extension(CreateExtension( | |
251 "file_manager", Extension::COMPONENT)); | |
252 ASSERT_TRUE(extension.get() != NULL); | |
253 | |
254 ExtensionResource resource = | |
255 extension->GetIconResource(extension_misc::EXTENSION_ICON_BITTY, | |
256 ExtensionIconSet::MATCH_EXACTLY); | |
257 | |
258 #if defined(FILE_MANAGER_EXTENSION) | |
259 ImageLoadingTracker loader(this); | |
260 int resource_id; | |
261 ASSERT_EQ(true, | |
262 loader.IsComponentExtensionResource(extension.get(), | |
263 resource.relative_path(), | |
264 &resource_id)); | |
265 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id); | |
266 #endif | |
267 } | |
OLD | NEW |