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 "chrome/browser/extensions/extension_action_icon_factory.h" | 5 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 ASSERT_FALSE(browser_action->default_icon()); | 256 ASSERT_FALSE(browser_action->default_icon()); |
257 ASSERT_TRUE(browser_action->GetExplicitlySetIcon(0 /*tab id*/).isNull()); | 257 ASSERT_TRUE(browser_action->GetExplicitlySetIcon(0 /*tab id*/).isNull()); |
258 | 258 |
259 gfx::Image default_icon = | 259 gfx::Image default_icon = |
260 EnsureImageSize(LoadIcon("browser_action/no_icon/icon.png"), 19); | 260 EnsureImageSize(LoadIcon("browser_action/no_icon/icon.png"), 19); |
261 ASSERT_FALSE(default_icon.IsEmpty()); | 261 ASSERT_FALSE(default_icon.IsEmpty()); |
262 | 262 |
263 scoped_ptr<ExtensionIconSet> default_icon_set(new ExtensionIconSet()); | 263 scoped_ptr<ExtensionIconSet> default_icon_set(new ExtensionIconSet()); |
264 default_icon_set->Add(19, "icon.png"); | 264 default_icon_set->Add(19, "icon.png"); |
265 | 265 |
266 browser_action->set_default_icon(default_icon_set.Pass()); | 266 browser_action->SetDefaultIconForTest(default_icon_set.Pass()); |
267 ASSERT_TRUE(browser_action->default_icon()); | 267 ASSERT_TRUE(browser_action->default_icon()); |
268 | 268 |
269 ExtensionActionIconFactory icon_factory( | 269 ExtensionActionIconFactory icon_factory( |
270 profile(), extension.get(), browser_action, this); | 270 profile(), extension.get(), browser_action, this); |
271 | 271 |
272 gfx::Image icon = icon_factory.GetIcon(0); | 272 gfx::Image icon = icon_factory.GetIcon(0); |
273 | 273 |
274 // The icon should be loaded asynchronously. Initially a transparent icon | 274 // The icon should be loaded asynchronously. Initially a transparent icon |
275 // should be returned. | 275 // should be returned. |
276 EXPECT_TRUE(ImageRepsAreEqual( | 276 EXPECT_TRUE(ImageRepsAreEqual( |
(...skipping 13 matching lines...) Expand all Loading... |
290 icon = icon_factory.GetIcon(1); | 290 icon = icon_factory.GetIcon(1); |
291 | 291 |
292 EXPECT_TRUE(ImageRepsAreEqual( | 292 EXPECT_TRUE(ImageRepsAreEqual( |
293 default_icon.ToImageSkia()->GetRepresentation(1.0f), | 293 default_icon.ToImageSkia()->GetRepresentation(1.0f), |
294 icon.ToImageSkia()->GetRepresentation(1.0f))); | 294 icon.ToImageSkia()->GetRepresentation(1.0f))); |
295 | 295 |
296 } | 296 } |
297 | 297 |
298 } // namespace | 298 } // namespace |
299 } // namespace extensions | 299 } // namespace extensions |
OLD | NEW |