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

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

Issue 9586018: Add support for multiple icon sizes for Mac platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/web_applications/web_app_mac.mm ('k') | ui/gfx/image/image.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/web_applications/web_app_mac.h" 5 #include "chrome/browser/web_applications/web_app_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 .WillRepeatedly(Return(FilePath("/non-existant/path/"))); 82 .WillRepeatedly(Return(FilePath("/non-existant/path/")));
83 EXPECT_FALSE(shortcut_creator.CreateShortcut()); 83 EXPECT_FALSE(shortcut_creator.CreateShortcut());
84 } 84 }
85 85
86 TEST(WebAppShortcutCreatorTest, UpdateIcon) { 86 TEST(WebAppShortcutCreatorTest, UpdateIcon) {
87 ScopedTempDir scoped_temp_dir; 87 ScopedTempDir scoped_temp_dir;
88 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); 88 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir());
89 FilePath dst_path = scoped_temp_dir.path(); 89 FilePath dst_path = scoped_temp_dir.path();
90 90
91 ShellIntegration::ShortcutInfo info = GetShortcutInfo(); 91 ShellIntegration::ShortcutInfo info = GetShortcutInfo();
92 info.favicon = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( 92 info.favicon = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
93 IDR_PRODUCT_LOGO_32).ToSkBitmap(); 93 IDR_PRODUCT_LOGO_32);
94 WebAppShortcutCreatorMock shortcut_creator(info); 94 WebAppShortcutCreatorMock shortcut_creator(info);
95 95
96 shortcut_creator.UpdateIcon(dst_path); 96 shortcut_creator.UpdateIcon(dst_path);
97 FilePath icon_path = 97 FilePath icon_path =
98 dst_path.Append("Contents").Append("Resources").Append("app.icns"); 98 dst_path.Append("Contents").Append("Resources").Append("app.icns");
99 99
100 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile: 100 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile:
101 base::mac::FilePathToNSString(icon_path)]); 101 base::mac::FilePathToNSString(icon_path)]);
102 EXPECT_TRUE(image); 102 EXPECT_TRUE(image);
103 EXPECT_EQ(info.favicon.width(), [image size].width); 103 EXPECT_EQ(info.favicon.ToSkBitmap()->width(), [image size].width);
104 EXPECT_EQ(info.favicon.height(), [image size].height); 104 EXPECT_EQ(info.favicon.ToSkBitmap()->height(), [image size].height);
105 } 105 }
106 106
107 } // namespace web_app 107 } // namespace web_app
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app_mac.mm ('k') | ui/gfx/image/image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698