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

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

Issue 9423048: Add user data dir field to Mac platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 8 years, 10 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
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 12 matching lines...) Expand all
23 using ::testing::_; 23 using ::testing::_;
24 using ::testing::Return; 24 using ::testing::Return;
25 using ::testing::NiceMock; 25 using ::testing::NiceMock;
26 26
27 namespace { 27 namespace {
28 28
29 class WebAppShortcutCreatorMock : public web_app::WebAppShortcutCreator { 29 class WebAppShortcutCreatorMock : public web_app::WebAppShortcutCreator {
30 public: 30 public:
31 explicit WebAppShortcutCreatorMock( 31 explicit WebAppShortcutCreatorMock(
32 const ShellIntegration::ShortcutInfo& shortcut_info) 32 const ShellIntegration::ShortcutInfo& shortcut_info)
33 : WebAppShortcutCreator(shortcut_info) { 33 : WebAppShortcutCreator(FilePath(), shortcut_info) {
34 } 34 }
35 35
36 MOCK_CONST_METHOD1(GetDestinationPath, FilePath(const FilePath&)); 36 MOCK_CONST_METHOD1(GetDestinationPath, FilePath(const FilePath&));
37 }; 37 };
38 38
39 ShellIntegration::ShortcutInfo GetShortcutInfo() { 39 ShellIntegration::ShortcutInfo GetShortcutInfo() {
40 ShellIntegration::ShortcutInfo info; 40 ShellIntegration::ShortcutInfo info;
41 info.extension_id = "extension_id"; 41 info.extension_id = "extension_id";
42 info.title = ASCIIToUTF16("Shortcut Title"); 42 info.title = ASCIIToUTF16("Shortcut Title");
43 info.url = GURL("http://example.com/"); 43 info.url = GURL("http://example.com/");
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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).ToSkBitmap();
94 web_app::WebAppShortcutCreator 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.width(), [image size].width);
104 EXPECT_EQ(info.favicon.height(), [image size].height); 104 EXPECT_EQ(info.favicon.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') | chrome/browser/web_applications/web_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698