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 <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/xattr.h> | 10 #include <sys/xattr.h> |
11 | 11 |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
16 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
17 #include "base/mac/foundation_util.h" | 17 #include "base/mac/foundation_util.h" |
18 #include "base/mac/scoped_nsobject.h" | 18 #include "base/mac/scoped_nsobject.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/strings/sys_string_conversions.h" | 21 #include "base/strings/sys_string_conversions.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #import "chrome/common/mac/app_mode_common.h" | 25 #import "chrome/common/mac/app_mode_common.h" |
26 #include "chrome/grit/theme_resources.h" | 26 #include "chrome/grit/theme_resources.h" |
27 #include "components/version_info/version_info.h" | 27 #include "components/version_info/version_info.h" |
| 28 #include "content/public/test/test_browser_thread_bundle.h" |
28 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
30 #import "testing/gtest_mac.h" | 31 #import "testing/gtest_mac.h" |
31 #include "third_party/skia/include/core/SkBitmap.h" | 32 #include "third_party/skia/include/core/SkBitmap.h" |
32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/gfx/image/image.h" | 34 #include "ui/gfx/image/image.h" |
34 | 35 |
35 using ::testing::_; | 36 using ::testing::_; |
36 using ::testing::Return; | 37 using ::testing::Return; |
37 using ::testing::NiceMock; | 38 using ::testing::NiceMock; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 app_data_dir_ = temp_app_data_dir_.GetPath(); | 81 app_data_dir_ = temp_app_data_dir_.GetPath(); |
81 destination_dir_ = temp_destination_dir_.GetPath(); | 82 destination_dir_ = temp_destination_dir_.GetPath(); |
82 | 83 |
83 info_ = GetShortcutInfo(); | 84 info_ = GetShortcutInfo(); |
84 shim_base_name_ = base::FilePath(info_->profile_path.BaseName().value() + | 85 shim_base_name_ = base::FilePath(info_->profile_path.BaseName().value() + |
85 " " + info_->extension_id + ".app"); | 86 " " + info_->extension_id + ".app"); |
86 internal_shim_path_ = app_data_dir_.Append(shim_base_name_); | 87 internal_shim_path_ = app_data_dir_.Append(shim_base_name_); |
87 shim_path_ = destination_dir_.Append(shim_base_name_); | 88 shim_path_ = destination_dir_.Append(shim_base_name_); |
88 } | 89 } |
89 | 90 |
| 91 // Needed by DCHECK_CURRENTLY_ON in ShortcutInfo destructor. |
| 92 content::TestBrowserThreadBundle thread_bundle_; |
| 93 |
90 base::ScopedTempDir temp_app_data_dir_; | 94 base::ScopedTempDir temp_app_data_dir_; |
91 base::ScopedTempDir temp_destination_dir_; | 95 base::ScopedTempDir temp_destination_dir_; |
92 base::FilePath app_data_dir_; | 96 base::FilePath app_data_dir_; |
93 base::FilePath destination_dir_; | 97 base::FilePath destination_dir_; |
94 | 98 |
95 std::unique_ptr<web_app::ShortcutInfo> info_; | 99 std::unique_ptr<web_app::ShortcutInfo> info_; |
96 base::FilePath shim_base_name_; | 100 base::FilePath shim_base_name_; |
97 base::FilePath internal_shim_path_; | 101 base::FilePath internal_shim_path_; |
98 base::FilePath shim_path_; | 102 base::FilePath shim_path_; |
99 | 103 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 .Times(0); | 333 .Times(0); |
330 EXPECT_TRUE(shortcut_creator.CreateShortcuts( | 334 EXPECT_TRUE(shortcut_creator.CreateShortcuts( |
331 SHORTCUT_CREATION_AUTOMATED, web_app::ShortcutLocations())); | 335 SHORTCUT_CREATION_AUTOMATED, web_app::ShortcutLocations())); |
332 | 336 |
333 EXPECT_CALL(shortcut_creator, RevealAppShimInFinder()); | 337 EXPECT_CALL(shortcut_creator, RevealAppShimInFinder()); |
334 EXPECT_TRUE(shortcut_creator.CreateShortcuts( | 338 EXPECT_TRUE(shortcut_creator.CreateShortcuts( |
335 SHORTCUT_CREATION_BY_USER, web_app::ShortcutLocations())); | 339 SHORTCUT_CREATION_BY_USER, web_app::ShortcutLocations())); |
336 } | 340 } |
337 | 341 |
338 } // namespace web_app | 342 } // namespace web_app |
OLD | NEW |