| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/image_loader.h" | 5 #include "extensions/browser/image_loader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/run_loop.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/test/test_browser_context.h" | 17 #include "content/public/test/test_browser_context.h" |
| 17 #include "content/public/test/test_browser_thread.h" | 18 #include "content/public/test/test_browser_thread.h" |
| 18 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
| 19 #include "extensions/browser/extensions_browser_client.h" | 20 #include "extensions/browser/extensions_browser_client.h" |
| 20 #include "extensions/browser/extensions_test.h" | 21 #include "extensions/browser/extensions_test.h" |
| 21 #include "extensions/common/constants.h" | 22 #include "extensions/common/constants.h" |
| 22 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 23 #include "extensions/common/extension_icon_set.h" | 24 #include "extensions/common/extension_icon_set.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 57 |
| 57 void OnImageFamilyLoaded(const gfx::ImageFamily& image_family) { | 58 void OnImageFamilyLoaded(const gfx::ImageFamily& image_family) { |
| 58 image_loaded_count_++; | 59 image_loaded_count_++; |
| 59 if (quit_in_image_loaded_) | 60 if (quit_in_image_loaded_) |
| 60 base::MessageLoop::current()->QuitWhenIdle(); | 61 base::MessageLoop::current()->QuitWhenIdle(); |
| 61 image_family_ = image_family; | 62 image_family_ = image_family; |
| 62 } | 63 } |
| 63 | 64 |
| 64 void WaitForImageLoad() { | 65 void WaitForImageLoad() { |
| 65 quit_in_image_loaded_ = true; | 66 quit_in_image_loaded_ = true; |
| 66 base::MessageLoop::current()->Run(); | 67 base::RunLoop().Run(); |
| 67 quit_in_image_loaded_ = false; | 68 quit_in_image_loaded_ = false; |
| 68 } | 69 } |
| 69 | 70 |
| 70 int image_loaded_count() { | 71 int image_loaded_count() { |
| 71 int result = image_loaded_count_; | 72 int result = image_loaded_count_; |
| 72 image_loaded_count_ = 0; | 73 image_loaded_count_ = 0; |
| 73 return result; | 74 return result; |
| 74 } | 75 } |
| 75 | 76 |
| 76 scoped_refptr<Extension> CreateExtension(const char* dir_name, | 77 scoped_refptr<Extension> CreateExtension(const char* dir_name, |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 306 |
| 306 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; | 307 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; |
| 307 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; | 308 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; |
| 308 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width()); | 309 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width()); |
| 309 EXPECT_EQ(1.0f, img_rep1->scale()); | 310 EXPECT_EQ(1.0f, img_rep1->scale()); |
| 310 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width()); | 311 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width()); |
| 311 EXPECT_EQ(2.0f, img_rep2->scale()); | 312 EXPECT_EQ(2.0f, img_rep2->scale()); |
| 312 } | 313 } |
| 313 | 314 |
| 314 } // namespace extensions | 315 } // namespace extensions |
| OLD | NEW |