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

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: Rebase to HEAD. Created 7 years, 8 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 EXPECT_TRUE(shortcut_creator.CreateShortcut()); 153 EXPECT_TRUE(shortcut_creator.CreateShortcut());
154 EXPECT_TRUE(file_util::PathExists(expected_app_path)); 154 EXPECT_TRUE(file_util::PathExists(expected_app_path));
155 } 155 }
156 156
157 TEST(WebAppShortcutCreatorTest, UpdateIcon) { 157 TEST(WebAppShortcutCreatorTest, UpdateIcon) {
158 base::ScopedTempDir scoped_temp_dir; 158 base::ScopedTempDir scoped_temp_dir;
159 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); 159 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir());
160 base::FilePath dst_path = scoped_temp_dir.path(); 160 base::FilePath dst_path = scoped_temp_dir.path();
161 161
162 ShellIntegration::ShortcutInfo info = GetShortcutInfo(); 162 ShellIntegration::ShortcutInfo info = GetShortcutInfo();
163 info.favicon = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 163 gfx::Image product_logo =
164 IDR_PRODUCT_LOGO_32); 164 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
165 IDR_PRODUCT_LOGO_32);
166 info.favicon.Add(product_logo);
165 WebAppShortcutCreatorMock shortcut_creator(info); 167 WebAppShortcutCreatorMock shortcut_creator(info);
166 168
167 shortcut_creator.UpdateIcon(dst_path); 169 ASSERT_TRUE(shortcut_creator.UpdateIcon(dst_path));
168 base::FilePath icon_path = 170 base::FilePath icon_path =
169 dst_path.Append("Contents").Append("Resources").Append("app.icns"); 171 dst_path.Append("Contents").Append("Resources").Append("app.icns");
170 172
171 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile: 173 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile:
172 base::mac::FilePathToNSString(icon_path)]); 174 base::mac::FilePathToNSString(icon_path)]);
173 EXPECT_TRUE(image); 175 EXPECT_TRUE(image);
174 EXPECT_EQ(info.favicon.ToSkBitmap()->width(), [image size].width); 176 EXPECT_EQ(product_logo.Width(), [image size].width);
175 EXPECT_EQ(info.favicon.ToSkBitmap()->height(), [image size].height); 177 EXPECT_EQ(product_logo.Height(), [image size].height);
176 } 178 }
177 179
178 } // namespace web_app 180 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698