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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 public IconImage::Observer { | 118 public IconImage::Observer { |
119 public: | 119 public: |
120 ExtensionIconImageTest() | 120 ExtensionIconImageTest() |
121 : image_loaded_count_(0), | 121 : image_loaded_count_(0), |
122 quit_in_image_loaded_(false), | 122 quit_in_image_loaded_(false), |
123 ui_thread_(BrowserThread::UI, &ui_loop_), | 123 ui_thread_(BrowserThread::UI, &ui_loop_), |
124 file_thread_(BrowserThread::FILE), | 124 file_thread_(BrowserThread::FILE), |
125 io_thread_(BrowserThread::IO), | 125 io_thread_(BrowserThread::IO), |
126 notification_service_(content::NotificationService::Create()) {} | 126 notification_service_(content::NotificationService::Create()) {} |
127 | 127 |
128 virtual ~ExtensionIconImageTest() {} | 128 ~ExtensionIconImageTest() override {} |
129 | 129 |
130 void WaitForImageLoad() { | 130 void WaitForImageLoad() { |
131 quit_in_image_loaded_ = true; | 131 quit_in_image_loaded_ = true; |
132 base::MessageLoop::current()->Run(); | 132 base::MessageLoop::current()->Run(); |
133 quit_in_image_loaded_ = false; | 133 quit_in_image_loaded_ = false; |
134 } | 134 } |
135 | 135 |
136 int ImageLoadedCount() { | 136 int ImageLoadedCount() { |
137 int result = image_loaded_count_; | 137 int result = image_loaded_count_; |
138 image_loaded_count_ = 0; | 138 image_loaded_count_ = 0; |
(...skipping 21 matching lines...) Expand all Loading... |
160 | 160 |
161 EXPECT_TRUE(valid_value.get()); | 161 EXPECT_TRUE(valid_value.get()); |
162 if (!valid_value) | 162 if (!valid_value) |
163 return NULL; | 163 return NULL; |
164 | 164 |
165 return Extension::Create(test_file, location, *valid_value, | 165 return Extension::Create(test_file, location, *valid_value, |
166 Extension::NO_FLAGS, &error); | 166 Extension::NO_FLAGS, &error); |
167 } | 167 } |
168 | 168 |
169 // testing::Test overrides: | 169 // testing::Test overrides: |
170 virtual void SetUp() override { | 170 void SetUp() override { |
171 file_thread_.Start(); | 171 file_thread_.Start(); |
172 io_thread_.Start(); | 172 io_thread_.Start(); |
173 } | 173 } |
174 | 174 |
175 // IconImage::Delegate overrides: | 175 // IconImage::Delegate overrides: |
176 void OnExtensionIconImageChanged(IconImage* image) override { | 176 void OnExtensionIconImageChanged(IconImage* image) override { |
177 image_loaded_count_++; | 177 image_loaded_count_++; |
178 if (quit_in_image_loaded_) | 178 if (quit_in_image_loaded_) |
179 base::MessageLoop::current()->Quit(); | 179 base::MessageLoop::current()->Quit(); |
180 } | 180 } |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 // image of the size. It could be blank or a rescale from the existing 1.0f | 556 // image of the size. It could be blank or a rescale from the existing 1.0f |
557 // icon. | 557 // icon. |
558 representation = image_skia.GetRepresentation(2.0f); | 558 representation = image_skia.GetRepresentation(2.0f); |
559 | 559 |
560 EXPECT_EQ(16, representation.GetWidth()); | 560 EXPECT_EQ(16, representation.GetWidth()); |
561 EXPECT_EQ(16, representation.GetHeight()); | 561 EXPECT_EQ(16, representation.GetHeight()); |
562 EXPECT_EQ(2.0f, representation.scale()); | 562 EXPECT_EQ(2.0f, representation.scale()); |
563 } | 563 } |
564 | 564 |
565 } // namespace extensions | 565 } // namespace extensions |
OLD | NEW |