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 <errno.h> |
9 #include <sys/xattr.h> | 10 #include <sys/xattr.h> |
10 #include <errno.h> | |
11 | 11 |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
14 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
15 #include "base/memory/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
16 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "chrome/common/mac/app_mode_common.h" | 18 #include "chrome/common/mac/app_mode_common.h" |
19 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 #import "testing/gtest_mac.h" | 22 #import "testing/gtest_mac.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 23 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
25 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 gfx::Image product_logo = | 235 gfx::Image product_logo = |
236 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 236 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
237 IDR_PRODUCT_LOGO_32); | 237 IDR_PRODUCT_LOGO_32); |
238 info.favicon.Add(product_logo); | 238 info.favicon.Add(product_logo); |
239 WebAppShortcutCreatorMock shortcut_creator(temp_app_data_path.path(), info); | 239 WebAppShortcutCreatorMock shortcut_creator(temp_app_data_path.path(), info); |
240 | 240 |
241 ASSERT_TRUE(shortcut_creator.UpdateIcon(dst_path)); | 241 ASSERT_TRUE(shortcut_creator.UpdateIcon(dst_path)); |
242 base::FilePath icon_path = | 242 base::FilePath icon_path = |
243 dst_path.Append("Contents").Append("Resources").Append("app.icns"); | 243 dst_path.Append("Contents").Append("Resources").Append("app.icns"); |
244 | 244 |
245 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile: | 245 base::scoped_nsobject<NSImage> image([[NSImage alloc] |
246 base::mac::FilePathToNSString(icon_path)]); | 246 initWithContentsOfFile:base::mac::FilePathToNSString(icon_path)]); |
247 EXPECT_TRUE(image); | 247 EXPECT_TRUE(image); |
248 EXPECT_EQ(product_logo.Width(), [image size].width); | 248 EXPECT_EQ(product_logo.Width(), [image size].width); |
249 EXPECT_EQ(product_logo.Height(), [image size].height); | 249 EXPECT_EQ(product_logo.Height(), [image size].height); |
250 } | 250 } |
251 | 251 |
252 } // namespace web_app | 252 } // namespace web_app |
OLD | NEW |