Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/web_applications/web_app_mac_unittest.mm

Issue 12881003: ShortcutInfo::favicon is now a gfx::ImageFamily instead of gfx::Image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added test suite for icon_family. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "chrome/browser/web_applications/web_app_mac.h" 5 #import "chrome/browser/web_applications/web_app_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include <sys/xattr.h> 9 #include <sys/xattr.h>
10 #include <errno.h> 10 #include <errno.h>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 .WillRepeatedly(Return(base::FilePath("/non-existant/path/"))); 125 .WillRepeatedly(Return(base::FilePath("/non-existant/path/")));
126 EXPECT_FALSE(shortcut_creator.CreateShortcut()); 126 EXPECT_FALSE(shortcut_creator.CreateShortcut());
127 } 127 }
128 128
129 TEST(WebAppShortcutCreatorTest, UpdateIcon) { 129 TEST(WebAppShortcutCreatorTest, UpdateIcon) {
130 base::ScopedTempDir scoped_temp_dir; 130 base::ScopedTempDir scoped_temp_dir;
131 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); 131 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir());
132 base::FilePath dst_path = scoped_temp_dir.path(); 132 base::FilePath dst_path = scoped_temp_dir.path();
133 133
134 ShellIntegration::ShortcutInfo info = GetShortcutInfo(); 134 ShellIntegration::ShortcutInfo info = GetShortcutInfo();
135 info.favicon = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 135 gfx::Image product_logo =
136 IDR_PRODUCT_LOGO_32); 136 ui::ResourceBundle::GetSharedInstance().GetImageNamed(
137 IDR_PRODUCT_LOGO_32);
138 info.favicon.Add(product_logo);
137 WebAppShortcutCreatorMock shortcut_creator(info); 139 WebAppShortcutCreatorMock shortcut_creator(info);
138 140
139 shortcut_creator.UpdateIcon(dst_path); 141 shortcut_creator.UpdateIcon(dst_path);
140 base::FilePath icon_path = 142 base::FilePath icon_path =
141 dst_path.Append("Contents").Append("Resources").Append("app.icns"); 143 dst_path.Append("Contents").Append("Resources").Append("app.icns");
142 144
143 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile: 145 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile:
144 base::mac::FilePathToNSString(icon_path)]); 146 base::mac::FilePathToNSString(icon_path)]);
145 EXPECT_TRUE(image); 147 EXPECT_TRUE(image);
146 EXPECT_EQ(info.favicon.ToSkBitmap()->width(), [image size].width); 148 EXPECT_EQ(product_logo.ToSkBitmap()->width(), [image size].width);
147 EXPECT_EQ(info.favicon.ToSkBitmap()->height(), [image size].height); 149 EXPECT_EQ(product_logo.ToSkBitmap()->height(), [image size].height);
148 } 150 }
149 151
150 } // namespace web_app 152 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698