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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // testing::Test overrides: | 122 // testing::Test overrides: |
123 void SetUp() override { | 123 void SetUp() override { |
124 file_thread_.Start(); | 124 file_thread_.Start(); |
125 io_thread_.Start(); | 125 io_thread_.Start(); |
126 } | 126 } |
127 | 127 |
128 // IconImage::Delegate overrides: | 128 // IconImage::Delegate overrides: |
129 void OnExtensionIconImageChanged(IconImage* image) override { | 129 void OnExtensionIconImageChanged(IconImage* image) override { |
130 image_loaded_count_++; | 130 image_loaded_count_++; |
131 if (quit_in_image_loaded_) | 131 if (quit_in_image_loaded_) |
132 base::MessageLoop::current()->Quit(); | 132 base::MessageLoop::current()->QuitWhenIdle(); |
133 } | 133 } |
134 | 134 |
135 gfx::ImageSkia GetDefaultIcon() { | 135 gfx::ImageSkia GetDefaultIcon() { |
136 return gfx::ImageSkia(gfx::ImageSkiaRep(gfx::Size(16, 16), 1.0f)); | 136 return gfx::ImageSkia(gfx::ImageSkiaRep(gfx::Size(16, 16), 1.0f)); |
137 } | 137 } |
138 | 138 |
139 private: | 139 private: |
140 int image_loaded_count_; | 140 int image_loaded_count_; |
141 bool quit_in_image_loaded_; | 141 bool quit_in_image_loaded_; |
142 base::MessageLoop ui_loop_; | 142 base::MessageLoop ui_loop_; |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // because image storage is shared, so when we created one from the first | 544 // because image storage is shared, so when we created one from the first |
545 // image, all other images should also have that representation... | 545 // image, all other images should also have that representation... |
546 gfx::Image image2 = icon_image->image(); | 546 gfx::Image image2 = icon_image->image(); |
547 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); | 547 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); |
548 | 548 |
549 // ...even images that were copied before the representation was constructed. | 549 // ...even images that were copied before the representation was constructed. |
550 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); | 550 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); |
551 } | 551 } |
552 | 552 |
553 } // namespace extensions | 553 } // namespace extensions |
OLD | NEW |