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 #include <errno.h> | 8 #include <errno.h> |
9 #include <sys/xattr.h> | 9 #include <sys/xattr.h> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/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/mac/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/strings/sys_string_conversions.h" | 18 #include "base/strings/sys_string_conversions.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/chrome_version_info.h" | |
23 #import "chrome/common/mac/app_mode_common.h" | 22 #import "chrome/common/mac/app_mode_common.h" |
| 23 #include "components/version_info/version_info.h" |
24 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
25 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
27 #import "testing/gtest_mac.h" | 27 #import "testing/gtest_mac.h" |
28 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/gfx/image/image.h" | 30 #include "ui/gfx/image/image.h" |
31 | 31 |
32 using ::testing::_; | 32 using ::testing::_; |
33 using ::testing::Return; | 33 using ::testing::Return; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 shim_path_.Append("Contents").Append("Info.plist"); | 128 shim_path_.Append("Contents").Append("Info.plist"); |
129 NSDictionary* plist = [NSDictionary dictionaryWithContentsOfFile: | 129 NSDictionary* plist = [NSDictionary dictionaryWithContentsOfFile: |
130 base::mac::FilePathToNSString(plist_path)]; | 130 base::mac::FilePathToNSString(plist_path)]; |
131 EXPECT_NSEQ(base::SysUTF8ToNSString(info_->extension_id), | 131 EXPECT_NSEQ(base::SysUTF8ToNSString(info_->extension_id), |
132 [plist objectForKey:app_mode::kCrAppModeShortcutIDKey]); | 132 [plist objectForKey:app_mode::kCrAppModeShortcutIDKey]); |
133 EXPECT_NSEQ(base::SysUTF16ToNSString(info_->title), | 133 EXPECT_NSEQ(base::SysUTF16ToNSString(info_->title), |
134 [plist objectForKey:app_mode::kCrAppModeShortcutNameKey]); | 134 [plist objectForKey:app_mode::kCrAppModeShortcutNameKey]); |
135 EXPECT_NSEQ(base::SysUTF8ToNSString(info_->url.spec()), | 135 EXPECT_NSEQ(base::SysUTF8ToNSString(info_->url.spec()), |
136 [plist objectForKey:app_mode::kCrAppModeShortcutURLKey]); | 136 [plist objectForKey:app_mode::kCrAppModeShortcutURLKey]); |
137 | 137 |
138 EXPECT_NSEQ(base::SysUTF8ToNSString(chrome::VersionInfo().Version()), | 138 EXPECT_NSEQ(base::SysUTF8ToNSString(version_info::GetVersionNumber()), |
139 [plist objectForKey:app_mode::kCrBundleVersionKey]); | 139 [plist objectForKey:app_mode::kCrBundleVersionKey]); |
140 EXPECT_NSEQ(base::SysUTF8ToNSString(info_->version_for_display), | 140 EXPECT_NSEQ(base::SysUTF8ToNSString(info_->version_for_display), |
141 [plist objectForKey:app_mode::kCFBundleShortVersionStringKey]); | 141 [plist objectForKey:app_mode::kCFBundleShortVersionStringKey]); |
142 | 142 |
143 // Make sure all values in the plist are actually filled in. | 143 // Make sure all values in the plist are actually filled in. |
144 for (id key in plist) { | 144 for (id key in plist) { |
145 id value = [plist valueForKey:key]; | 145 id value = [plist valueForKey:key]; |
146 if (!base::mac::ObjCCast<NSString>(value)) | 146 if (!base::mac::ObjCCast<NSString>(value)) |
147 continue; | 147 continue; |
148 | 148 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 [file_handler_1 objectForKey:app_mode::kCFBundleTypeRoleKey]); | 386 [file_handler_1 objectForKey:app_mode::kCFBundleTypeRoleKey]); |
387 NSArray* file_handler_1_extensions = | 387 NSArray* file_handler_1_extensions = |
388 [file_handler_1 objectForKey:app_mode::kCFBundleTypeExtensionsKey]; | 388 [file_handler_1 objectForKey:app_mode::kCFBundleTypeExtensionsKey]; |
389 EXPECT_TRUE([file_handler_1_extensions containsObject:@"ext2"]); | 389 EXPECT_TRUE([file_handler_1_extensions containsObject:@"ext2"]); |
390 NSArray* file_handler_1_types = | 390 NSArray* file_handler_1_types = |
391 [file_handler_1 objectForKey:app_mode::kCFBundleTypeMIMETypesKey]; | 391 [file_handler_1 objectForKey:app_mode::kCFBundleTypeMIMETypesKey]; |
392 EXPECT_TRUE([file_handler_1_types containsObject:@"type2"]); | 392 EXPECT_TRUE([file_handler_1_types containsObject:@"type2"]); |
393 } | 393 } |
394 | 394 |
395 } // namespace web_app | 395 } // namespace web_app |
OLD | NEW |