| 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 #include "chrome/browser/shell_integration_win.h" | 5 #include "chrome/browser/shell_integration_win.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.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/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/test/test_shortcut_win.h" | 18 #include "base/test/test_shortcut_win.h" |
| 19 #include "base/win/scoped_com_initializer.h" | 19 #include "base/win/scoped_com_initializer.h" |
| 20 #include "base/win/windows_version.h" | |
| 21 #include "chrome/browser/web_applications/web_app.h" | 20 #include "chrome/browser/web_applications/web_app.h" |
| 22 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/chrome_paths_internal.h" | 22 #include "chrome/common/chrome_paths_internal.h" |
| 24 #include "chrome/install_static/install_util.h" | 23 #include "chrome/install_static/install_util.h" |
| 25 #include "chrome/installer/util/install_util.h" | 24 #include "chrome/installer/util/install_util.h" |
| 26 #include "chrome/installer/util/shell_util.h" | 25 #include "chrome/installer/util/shell_util.h" |
| 27 #include "chrome/installer/util/util_constants.h" | 26 #include "chrome/installer/util/util_constants.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 29 | 28 |
| 30 namespace shell_integration { | 29 namespace shell_integration { |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // The app id of the example app for the non-default profile. | 249 // The app id of the example app for the non-default profile. |
| 251 base::string16 non_default_profile_extension_app_id_; | 250 base::string16 non_default_profile_extension_app_id_; |
| 252 | 251 |
| 253 private: | 252 private: |
| 254 DISALLOW_COPY_AND_ASSIGN(ShellIntegrationWinMigrateShortcutTest); | 253 DISALLOW_COPY_AND_ASSIGN(ShellIntegrationWinMigrateShortcutTest); |
| 255 }; | 254 }; |
| 256 | 255 |
| 257 } // namespace | 256 } // namespace |
| 258 | 257 |
| 259 TEST_F(ShellIntegrationWinMigrateShortcutTest, ClearDualModeAndAdjustAppIds) { | 258 TEST_F(ShellIntegrationWinMigrateShortcutTest, ClearDualModeAndAdjustAppIds) { |
| 260 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
| 261 return; | |
| 262 | |
| 263 // 9 shortcuts should have their app id updated below and shortcut 11 should | 259 // 9 shortcuts should have their app id updated below and shortcut 11 should |
| 264 // be migrated away from dual_mode for a total of 10 shortcuts migrated. | 260 // be migrated away from dual_mode for a total of 10 shortcuts migrated. |
| 265 EXPECT_EQ(10, | 261 EXPECT_EQ(10, |
| 266 MigrateShortcutsInPathInternal(chrome_exe_, temp_dir_.GetPath())); | 262 MigrateShortcutsInPathInternal(chrome_exe_, temp_dir_.GetPath())); |
| 267 | 263 |
| 268 // Shortcut 1, 3, 4, 5, 6, 7, 8, 9, and 10 should have had their app_id fixed. | 264 // Shortcut 1, 3, 4, 5, 6, 7, 8, 9, and 10 should have had their app_id fixed. |
| 269 shortcuts_[1].properties.set_app_id(chrome_app_id_); | 265 shortcuts_[1].properties.set_app_id(chrome_app_id_); |
| 270 shortcuts_[3].properties.set_app_id(chrome_app_id_); | 266 shortcuts_[3].properties.set_app_id(chrome_app_id_); |
| 271 shortcuts_[4].properties.set_app_id(chrome_app_id_); | 267 shortcuts_[4].properties.set_app_id(chrome_app_id_); |
| 272 shortcuts_[5].properties.set_app_id(chrome_app_id_); | 268 shortcuts_[5].properties.set_app_id(chrome_app_id_); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // profile info. | 306 // profile info. |
| 311 base::FilePath profile_path(FILE_PATH_LITERAL("root")); | 307 base::FilePath profile_path(FILE_PATH_LITERAL("root")); |
| 312 profile_path = profile_path.Append(FILE_PATH_LITERAL("udd")); | 308 profile_path = profile_path.Append(FILE_PATH_LITERAL("udd")); |
| 313 profile_path = profile_path.Append(FILE_PATH_LITERAL("User Data - Test")); | 309 profile_path = profile_path.Append(FILE_PATH_LITERAL("User Data - Test")); |
| 314 EXPECT_EQ(base_app_id + L".udd.UserDataTest", | 310 EXPECT_EQ(base_app_id + L".udd.UserDataTest", |
| 315 GetAppModelIdForProfile(base_app_id, profile_path)); | 311 GetAppModelIdForProfile(base_app_id, profile_path)); |
| 316 } | 312 } |
| 317 | 313 |
| 318 } // namespace win | 314 } // namespace win |
| 319 } // namespace shell_integration | 315 } // namespace shell_integration |
| OLD | NEW |