| 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 "base/json/json_file_value_serializer.h" | 5 #include "base/json/json_file_value_serializer.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/run_loop.h" |
| 9 #include "base/values.h" | 10 #include "base/values.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "chrome/browser/extensions/extension_icon_manager.h" | 12 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 12 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 14 #include "components/crx_file/id_util.h" | 15 #include "components/crx_file/id_util.h" |
| 15 #include "content/public/test/test_browser_thread.h" | 16 #include "content/public/test/test_browser_thread.h" |
| 16 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "ui/gfx/skia_util.h" | 19 #include "ui/gfx/skia_util.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 37 void ImageLoadObserved() { | 38 void ImageLoadObserved() { |
| 38 unwaited_image_loads_++; | 39 unwaited_image_loads_++; |
| 39 if (waiting_) { | 40 if (waiting_) { |
| 40 base::MessageLoop::current()->QuitWhenIdle(); | 41 base::MessageLoop::current()->QuitWhenIdle(); |
| 41 } | 42 } |
| 42 } | 43 } |
| 43 | 44 |
| 44 void WaitForImageLoad() { | 45 void WaitForImageLoad() { |
| 45 if (unwaited_image_loads_ == 0) { | 46 if (unwaited_image_loads_ == 0) { |
| 46 waiting_ = true; | 47 waiting_ = true; |
| 47 base::MessageLoop::current()->Run(); | 48 base::RunLoop().Run(); |
| 48 waiting_ = false; | 49 waiting_ = false; |
| 49 } | 50 } |
| 50 ASSERT_GT(unwaited_image_loads_, 0); | 51 ASSERT_GT(unwaited_image_loads_, 0); |
| 51 unwaited_image_loads_--; | 52 unwaited_image_loads_--; |
| 52 } | 53 } |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 void SetUp() override { | 56 void SetUp() override { |
| 56 file_thread_.Start(); | 57 file_thread_.Start(); |
| 57 io_thread_.Start(); | 58 io_thread_.Start(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Now re-load the icon - we should get the same result bitmap (and not the | 177 // Now re-load the icon - we should get the same result bitmap (and not the |
| 177 // default icon). | 178 // default icon). |
| 178 icon_manager.LoadIcon(profile.get(), extension.get()); | 179 icon_manager.LoadIcon(profile.get(), extension.get()); |
| 179 WaitForImageLoad(); | 180 WaitForImageLoad(); |
| 180 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); | 181 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); |
| 181 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); | 182 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); |
| 182 | 183 |
| 183 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); | 184 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); |
| 184 } | 185 } |
| 185 #endif | 186 #endif |
| OLD | NEW |