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 #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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 .WillRepeatedly(Return(non_existent_path)); | 130 .WillRepeatedly(Return(non_existent_path)); |
131 EXPECT_FALSE(shortcut_creator.CreateShortcut()); | 131 EXPECT_FALSE(shortcut_creator.CreateShortcut()); |
132 } | 132 } |
133 | 133 |
134 TEST(WebAppShortcutCreatorTest, UpdateIcon) { | 134 TEST(WebAppShortcutCreatorTest, UpdateIcon) { |
135 base::ScopedTempDir scoped_temp_dir; | 135 base::ScopedTempDir scoped_temp_dir; |
136 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); | 136 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); |
137 base::FilePath dst_path = scoped_temp_dir.path(); | 137 base::FilePath dst_path = scoped_temp_dir.path(); |
138 | 138 |
139 ShellIntegration::ShortcutInfo info = GetShortcutInfo(); | 139 ShellIntegration::ShortcutInfo info = GetShortcutInfo(); |
140 info.favicon = ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 140 gfx::Image product_logo = |
141 IDR_PRODUCT_LOGO_32); | 141 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
Robert Sesek
2013/04/04 18:39:02
GetNativeImageNamed
Matt Giuca
2013/04/05 06:30:13
Done.
| |
142 IDR_PRODUCT_LOGO_32); | |
143 info.favicon.Add(product_logo); | |
142 WebAppShortcutCreatorMock shortcut_creator(info); | 144 WebAppShortcutCreatorMock shortcut_creator(info); |
143 | 145 |
144 shortcut_creator.UpdateIcon(dst_path); | 146 shortcut_creator.UpdateIcon(dst_path); |
145 base::FilePath icon_path = | 147 base::FilePath icon_path = |
146 dst_path.Append("Contents").Append("Resources").Append("app.icns"); | 148 dst_path.Append("Contents").Append("Resources").Append("app.icns"); |
147 | 149 |
148 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile: | 150 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile: |
149 base::mac::FilePathToNSString(icon_path)]); | 151 base::mac::FilePathToNSString(icon_path)]); |
150 EXPECT_TRUE(image); | 152 EXPECT_TRUE(image); |
151 EXPECT_EQ(info.favicon.ToSkBitmap()->width(), [image size].width); | 153 EXPECT_EQ(product_logo.ToSkBitmap()->width(), [image size].width); |
Robert Sesek
2013/04/04 18:39:02
Use ->Width() and ->Height()
Matt Giuca
2013/04/05 06:30:13
Done.
| |
152 EXPECT_EQ(info.favicon.ToSkBitmap()->height(), [image size].height); | 154 EXPECT_EQ(product_logo.ToSkBitmap()->height(), [image size].height); |
153 } | 155 } |
154 | 156 |
155 } // namespace web_app | 157 } // namespace web_app |
OLD | NEW |