| 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/extension_icon_image.h" | 5 #include "extensions/browser/extension_icon_image.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/run_loop.h" |
| 13 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 14 #include "content/public/test/test_browser_context.h" | 15 #include "content/public/test/test_browser_context.h" |
| 15 #include "content/public/test/test_browser_thread.h" | 16 #include "content/public/test/test_browser_thread.h" |
| 16 #include "extensions/browser/extensions_test.h" | 17 #include "extensions/browser/extensions_test.h" |
| 17 #include "extensions/browser/image_loader.h" | 18 #include "extensions/browser/image_loader.h" |
| 18 #include "extensions/browser/test_image_loader.h" | 19 #include "extensions/browser/test_image_loader.h" |
| 19 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 20 #include "extensions/common/extension_paths.h" | 21 #include "extensions/common/extension_paths.h" |
| 21 #include "extensions/common/manifest.h" | 22 #include "extensions/common/manifest.h" |
| 22 #include "extensions/common/manifest_handlers/icons_handler.h" | 23 #include "extensions/common/manifest_handlers/icons_handler.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 quit_in_image_loaded_(false), | 76 quit_in_image_loaded_(false), |
| 76 ui_thread_(BrowserThread::UI, &ui_loop_), | 77 ui_thread_(BrowserThread::UI, &ui_loop_), |
| 77 file_thread_(BrowserThread::FILE), | 78 file_thread_(BrowserThread::FILE), |
| 78 io_thread_(BrowserThread::IO), | 79 io_thread_(BrowserThread::IO), |
| 79 notification_service_(content::NotificationService::Create()) {} | 80 notification_service_(content::NotificationService::Create()) {} |
| 80 | 81 |
| 81 ~ExtensionIconImageTest() override {} | 82 ~ExtensionIconImageTest() override {} |
| 82 | 83 |
| 83 void WaitForImageLoad() { | 84 void WaitForImageLoad() { |
| 84 quit_in_image_loaded_ = true; | 85 quit_in_image_loaded_ = true; |
| 85 base::MessageLoop::current()->Run(); | 86 base::RunLoop().Run(); |
| 86 quit_in_image_loaded_ = false; | 87 quit_in_image_loaded_ = false; |
| 87 } | 88 } |
| 88 | 89 |
| 89 int ImageLoadedCount() { | 90 int ImageLoadedCount() { |
| 90 int result = image_loaded_count_; | 91 int result = image_loaded_count_; |
| 91 image_loaded_count_ = 0; | 92 image_loaded_count_ = 0; |
| 92 return result; | 93 return result; |
| 93 } | 94 } |
| 94 | 95 |
| 95 scoped_refptr<Extension> CreateExtension(const char* name, | 96 scoped_refptr<Extension> CreateExtension(const char* name, |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // because image storage is shared, so when we created one from the first | 538 // because image storage is shared, so when we created one from the first |
| 538 // image, all other images should also have that representation... | 539 // image, all other images should also have that representation... |
| 539 gfx::Image image2 = icon_image->image(); | 540 gfx::Image image2 = icon_image->image(); |
| 540 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); | 541 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); |
| 541 | 542 |
| 542 // ...even images that were copied before the representation was constructed. | 543 // ...even images that were copied before the representation was constructed. |
| 543 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); | 544 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); |
| 544 } | 545 } |
| 545 | 546 |
| 546 } // namespace extensions | 547 } // namespace extensions |
| OLD | NEW |