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/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_icon_manager.h" | 9 #include "chrome/browser/extensions/extension_icon_manager.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 waiting_(false), | 28 waiting_(false), |
29 ui_thread_(BrowserThread::UI, &ui_loop_), | 29 ui_thread_(BrowserThread::UI, &ui_loop_), |
30 file_thread_(BrowserThread::FILE), | 30 file_thread_(BrowserThread::FILE), |
31 io_thread_(BrowserThread::IO) {} | 31 io_thread_(BrowserThread::IO) {} |
32 | 32 |
33 ~ExtensionIconManagerTest() override {} | 33 ~ExtensionIconManagerTest() override {} |
34 | 34 |
35 void ImageLoadObserved() { | 35 void ImageLoadObserved() { |
36 unwaited_image_loads_++; | 36 unwaited_image_loads_++; |
37 if (waiting_) { | 37 if (waiting_) { |
38 base::MessageLoop::current()->Quit(); | 38 base::MessageLoop::current()->QuitWhenIdle(); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 void WaitForImageLoad() { | 42 void WaitForImageLoad() { |
43 if (unwaited_image_loads_ == 0) { | 43 if (unwaited_image_loads_ == 0) { |
44 waiting_ = true; | 44 waiting_ = true; |
45 base::MessageLoop::current()->Run(); | 45 base::MessageLoop::current()->Run(); |
46 waiting_ = false; | 46 waiting_ = false; |
47 } | 47 } |
48 ASSERT_GT(unwaited_image_loads_, 0); | 48 ASSERT_GT(unwaited_image_loads_, 0); |
(...skipping 127 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 | 176 // Now re-load the icon - we should get the same result bitmap (and not the |
177 // default icon). | 177 // default icon). |
178 icon_manager.LoadIcon(profile.get(), extension.get()); | 178 icon_manager.LoadIcon(profile.get(), extension.get()); |
179 WaitForImageLoad(); | 179 WaitForImageLoad(); |
180 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); | 180 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); |
181 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); | 181 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); |
182 | 182 |
183 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); | 183 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); |
184 } | 184 } |
185 #endif | 185 #endif |
OLD | NEW |