| Index: chrome/browser/ui/cocoa/menu_controller_unittest.mm
|
| diff --git a/chrome/browser/ui/cocoa/menu_controller_unittest.mm b/chrome/browser/ui/cocoa/menu_controller_unittest.mm
|
| index 0fd9a87a0a842fea26ef2fc3b450574dea4d9507..c275005260724b0ee70039fc7ed60616a58a30da 100644
|
| --- a/chrome/browser/ui/cocoa/menu_controller_unittest.mm
|
| +++ b/chrome/browser/ui/cocoa/menu_controller_unittest.mm
|
| @@ -14,7 +14,7 @@
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| #include "ui/base/models/simple_menu_model.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| -#include "ui/gfx/image/image_skia.h"
|
| +#include "ui/gfx/image/image.h"
|
|
|
| namespace {
|
|
|
| @@ -75,23 +75,23 @@ class Delegate : public ui::SimpleMenuModel::Delegate {
|
| // the label/icon in the model are reflected in the menu.
|
| class DynamicDelegate : public Delegate {
|
| public:
|
| - DynamicDelegate() : icon_(NULL) {}
|
| + DynamicDelegate() {}
|
| virtual bool IsItemForCommandIdDynamic(int command_id) const { return true; }
|
| virtual string16 GetLabelForCommandId(int command_id) const { return label_; }
|
| - virtual bool GetIconForCommandId(int command_id, gfx::ImageSkia* icon) const {
|
| - if (icon_) {
|
| - *icon = *icon_;
|
| - return true;
|
| - } else {
|
| + virtual bool GetIconForCommandId(int command_id, gfx::Image* icon) const {
|
| + if (icon_.IsEmpty()) {
|
| return false;
|
| + } else {
|
| + *icon = icon_;
|
| + return true;
|
| }
|
| }
|
| void SetDynamicLabel(string16 label) { label_ = label; }
|
| - void SetDynamicIcon(SkBitmap* icon) { icon_ = icon; }
|
| + void SetDynamicIcon(const gfx::Image& icon) { icon_ = icon; }
|
|
|
| private:
|
| string16 label_;
|
| - SkBitmap* icon_;
|
| + gfx::Image icon_;
|
| };
|
|
|
| TEST_F(MenuControllerTest, EmptyMenu) {
|
| @@ -280,16 +280,16 @@ TEST_F(MenuControllerTest, Dynamic) {
|
| // Now update the item to have a label of "second" and an icon.
|
| string16 second = ASCIIToUTF16("second");
|
| delegate.SetDynamicLabel(second);
|
| - SkBitmap* bitmap =
|
| - ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_THROBBER);
|
| - delegate.SetDynamicIcon(bitmap);
|
| + const gfx::Image& icon =
|
| + ResourceBundle::GetSharedInstance().GetNativeImageNamed(IDR_THROBBER);
|
| + delegate.SetDynamicIcon(icon);
|
| // Simulate opening the menu and validate that the item label + icon changes.
|
| Validate(menu.get(), [menu menu]);
|
| EXPECT_EQ(second, base::SysNSStringToUTF16([item title]));
|
| EXPECT_TRUE([item image] != nil);
|
|
|
| // Now get rid of the icon and make sure it goes away.
|
| - delegate.SetDynamicIcon(NULL);
|
| + delegate.SetDynamicIcon(gfx::Image());
|
| Validate(menu.get(), [menu menu]);
|
| EXPECT_EQ(second, base::SysNSStringToUTF16([item title]));
|
| EXPECT_EQ(nil, [item image]);
|
|
|