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 <utility> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
9 #include "base/json/json_file_value_serializer.h" | 11 #include "base/json/json_file_value_serializer.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
12 #include "base/path_service.h" | 14 #include "base/path_service.h" |
13 #include "build/build_config.h" | 15 #include "build/build_config.h" |
14 #include "chrome/browser/extensions/extension_action.h" | 16 #include "chrome/browser/extensions/extension_action.h" |
15 #include "chrome/browser/extensions/extension_action_manager.h" | 17 #include "chrome/browser/extensions/extension_action_manager.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 ASSERT_FALSE(browser_action->default_icon()); | 260 ASSERT_FALSE(browser_action->default_icon()); |
259 ASSERT_TRUE(browser_action->GetExplicitlySetIcon(0 /*tab id*/).IsEmpty()); | 261 ASSERT_TRUE(browser_action->GetExplicitlySetIcon(0 /*tab id*/).IsEmpty()); |
260 | 262 |
261 gfx::Image default_icon = | 263 gfx::Image default_icon = |
262 EnsureImageSize(LoadIcon("browser_action/no_icon/icon.png"), 19); | 264 EnsureImageSize(LoadIcon("browser_action/no_icon/icon.png"), 19); |
263 ASSERT_FALSE(default_icon.IsEmpty()); | 265 ASSERT_FALSE(default_icon.IsEmpty()); |
264 | 266 |
265 scoped_ptr<ExtensionIconSet> default_icon_set(new ExtensionIconSet()); | 267 scoped_ptr<ExtensionIconSet> default_icon_set(new ExtensionIconSet()); |
266 default_icon_set->Add(19, "icon.png"); | 268 default_icon_set->Add(19, "icon.png"); |
267 | 269 |
268 browser_action->SetDefaultIconForTest(default_icon_set.Pass()); | 270 browser_action->SetDefaultIconForTest(std::move(default_icon_set)); |
269 ASSERT_TRUE(browser_action->default_icon()); | 271 ASSERT_TRUE(browser_action->default_icon()); |
270 | 272 |
271 ExtensionActionIconFactory icon_factory( | 273 ExtensionActionIconFactory icon_factory( |
272 profile(), extension.get(), browser_action, this); | 274 profile(), extension.get(), browser_action, this); |
273 | 275 |
274 gfx::Image icon = icon_factory.GetIcon(0); | 276 gfx::Image icon = icon_factory.GetIcon(0); |
275 | 277 |
276 // The icon should be loaded asynchronously. Initially a transparent icon | 278 // The icon should be loaded asynchronously. Initially a transparent icon |
277 // should be returned. | 279 // should be returned. |
278 EXPECT_TRUE(ImageRepsAreEqual( | 280 EXPECT_TRUE(ImageRepsAreEqual( |
(...skipping 13 matching lines...) Expand all Loading... |
292 icon = icon_factory.GetIcon(1); | 294 icon = icon_factory.GetIcon(1); |
293 | 295 |
294 EXPECT_TRUE(ImageRepsAreEqual( | 296 EXPECT_TRUE(ImageRepsAreEqual( |
295 default_icon.ToImageSkia()->GetRepresentation(1.0f), | 297 default_icon.ToImageSkia()->GetRepresentation(1.0f), |
296 icon.ToImageSkia()->GetRepresentation(1.0f))); | 298 icon.ToImageSkia()->GetRepresentation(1.0f))); |
297 | 299 |
298 } | 300 } |
299 | 301 |
300 } // namespace | 302 } // namespace |
301 } // namespace extensions | 303 } // namespace extensions |
OLD | NEW |