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

Side by Side Diff: chrome/installer/setup/install_unittest.cc

Issue 1878313003: Convert //chrome/installer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert decompress.cc in mini_installer. Created 4 years, 8 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
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/setup/install_worker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/installer/setup/install.h"
6
5 #include <objbase.h> 7 #include <objbase.h>
6 #include <stddef.h> 8 #include <stddef.h>
7 9
10 #include <memory>
8 #include <string> 11 #include <string>
9 12
10 #include "base/base_paths.h" 13 #include "base/base_paths.h"
11 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
12 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
13 #include "base/files/scoped_temp_dir.h" 16 #include "base/files/scoped_temp_dir.h"
14 #include "base/macros.h" 17 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/path_service.h" 18 #include "base/path_service.h"
17 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
18 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
20 #include "base/test/scoped_path_override.h" 22 #include "base/test/scoped_path_override.h"
21 #include "base/test/test_shortcut_win.h" 23 #include "base/test/test_shortcut_win.h"
22 #include "base/version.h" 24 #include "base/version.h"
23 #include "base/win/shortcut.h" 25 #include "base/win/shortcut.h"
24 #include "chrome/installer/setup/install.h"
25 #include "chrome/installer/setup/install_worker.h" 26 #include "chrome/installer/setup/install_worker.h"
26 #include "chrome/installer/setup/setup_constants.h" 27 #include "chrome/installer/setup/setup_constants.h"
27 #include "chrome/installer/util/browser_distribution.h" 28 #include "chrome/installer/util/browser_distribution.h"
28 #include "chrome/installer/util/install_util.h" 29 #include "chrome/installer/util/install_util.h"
29 #include "chrome/installer/util/installer_state.h" 30 #include "chrome/installer/util/installer_state.h"
30 #include "chrome/installer/util/master_preferences.h" 31 #include "chrome/installer/util/master_preferences.h"
31 #include "chrome/installer/util/master_preferences_constants.h" 32 #include "chrome/installer/util/master_preferences_constants.h"
32 #include "chrome/installer/util/product.h" 33 #include "chrome/installer/util/product.h"
33 #include "chrome/installer/util/shell_util.h" 34 #include "chrome/installer/util/shell_util.h"
34 #include "chrome/installer/util/util_constants.h" 35 #include "chrome/installer/util/util_constants.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 GetNormalizedFilePath(target_path)); 255 GetNormalizedFilePath(target_path));
255 } 256 }
256 } 257 }
257 } 258 }
258 259
259 base::win::ShortcutProperties expected_properties_; 260 base::win::ShortcutProperties expected_properties_;
260 base::win::ShortcutProperties expected_start_menu_properties_; 261 base::win::ShortcutProperties expected_start_menu_properties_;
261 262
262 BrowserDistribution* dist_; 263 BrowserDistribution* dist_;
263 base::FilePath chrome_exe_; 264 base::FilePath chrome_exe_;
264 scoped_ptr<installer::Product> product_; 265 std::unique_ptr<installer::Product> product_;
265 scoped_ptr<installer::MasterPreferences> prefs_; 266 std::unique_ptr<installer::MasterPreferences> prefs_;
266 267
267 base::ScopedTempDir temp_dir_; 268 base::ScopedTempDir temp_dir_;
268 base::ScopedTempDir fake_user_desktop_; 269 base::ScopedTempDir fake_user_desktop_;
269 base::ScopedTempDir fake_common_desktop_; 270 base::ScopedTempDir fake_common_desktop_;
270 base::ScopedTempDir fake_user_quick_launch_; 271 base::ScopedTempDir fake_user_quick_launch_;
271 base::ScopedTempDir fake_start_menu_; 272 base::ScopedTempDir fake_start_menu_;
272 base::ScopedTempDir fake_common_start_menu_; 273 base::ScopedTempDir fake_common_start_menu_;
273 scoped_ptr<base::ScopedPathOverride> user_desktop_override_; 274 std::unique_ptr<base::ScopedPathOverride> user_desktop_override_;
274 scoped_ptr<base::ScopedPathOverride> common_desktop_override_; 275 std::unique_ptr<base::ScopedPathOverride> common_desktop_override_;
275 scoped_ptr<base::ScopedPathOverride> user_quick_launch_override_; 276 std::unique_ptr<base::ScopedPathOverride> user_quick_launch_override_;
276 scoped_ptr<base::ScopedPathOverride> start_menu_override_; 277 std::unique_ptr<base::ScopedPathOverride> start_menu_override_;
277 scoped_ptr<base::ScopedPathOverride> common_start_menu_override_; 278 std::unique_ptr<base::ScopedPathOverride> common_start_menu_override_;
278 279
279 base::FilePath user_desktop_shortcut_; 280 base::FilePath user_desktop_shortcut_;
280 base::FilePath user_quick_launch_shortcut_; 281 base::FilePath user_quick_launch_shortcut_;
281 base::FilePath user_start_menu_shortcut_; 282 base::FilePath user_start_menu_shortcut_;
282 base::FilePath user_start_menu_subdir_shortcut_; 283 base::FilePath user_start_menu_subdir_shortcut_;
283 base::FilePath system_desktop_shortcut_; 284 base::FilePath system_desktop_shortcut_;
284 base::FilePath system_start_menu_shortcut_; 285 base::FilePath system_start_menu_shortcut_;
285 base::FilePath system_start_menu_subdir_shortcut_; 286 base::FilePath system_start_menu_subdir_shortcut_;
286 }; 287 };
287 288
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 base::win::ValidateShortcut(system_desktop_shortcut_, expected_properties_); 339 base::win::ValidateShortcut(system_desktop_shortcut_, expected_properties_);
339 base::win::ValidateShortcut(system_start_menu_shortcut_, 340 base::win::ValidateShortcut(system_start_menu_shortcut_,
340 expected_start_menu_properties_); 341 expected_start_menu_properties_);
341 // The quick launch shortcut is always created per-user for the admin running 342 // The quick launch shortcut is always created per-user for the admin running
342 // the install (other users will get it via Active Setup). 343 // the install (other users will get it via Active Setup).
343 base::win::ValidateShortcut(user_quick_launch_shortcut_, 344 base::win::ValidateShortcut(user_quick_launch_shortcut_,
344 expected_properties_); 345 expected_properties_);
345 } 346 }
346 347
347 TEST_F(InstallShortcutTest, CreateAllShortcutsButDesktopShortcut) { 348 TEST_F(InstallShortcutTest, CreateAllShortcutsButDesktopShortcut) {
348 scoped_ptr<installer::MasterPreferences> prefs_no_desktop( 349 std::unique_ptr<installer::MasterPreferences> prefs_no_desktop(
349 GetFakeMasterPrefs(true, false)); 350 GetFakeMasterPrefs(true, false));
350 installer::CreateOrUpdateShortcuts( 351 installer::CreateOrUpdateShortcuts(
351 chrome_exe_, *product_, *prefs_no_desktop, installer::CURRENT_USER, 352 chrome_exe_, *product_, *prefs_no_desktop, installer::CURRENT_USER,
352 installer::INSTALL_SHORTCUT_CREATE_ALL); 353 installer::INSTALL_SHORTCUT_CREATE_ALL);
353 ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); 354 ASSERT_FALSE(base::PathExists(user_desktop_shortcut_));
354 base::win::ValidateShortcut(user_quick_launch_shortcut_, 355 base::win::ValidateShortcut(user_quick_launch_shortcut_,
355 expected_properties_); 356 expected_properties_);
356 base::win::ValidateShortcut(user_start_menu_shortcut_, 357 base::win::ValidateShortcut(user_start_menu_shortcut_,
357 expected_start_menu_properties_); 358 expected_start_menu_properties_);
358 } 359 }
359 360
360 TEST_F(InstallShortcutTest, CreateAllShortcutsButQuickLaunchShortcut) { 361 TEST_F(InstallShortcutTest, CreateAllShortcutsButQuickLaunchShortcut) {
361 scoped_ptr<installer::MasterPreferences> prefs_no_ql( 362 std::unique_ptr<installer::MasterPreferences> prefs_no_ql(
362 GetFakeMasterPrefs(false, true)); 363 GetFakeMasterPrefs(false, true));
363 installer::CreateOrUpdateShortcuts( 364 installer::CreateOrUpdateShortcuts(
364 chrome_exe_, *product_, *prefs_no_ql, installer::CURRENT_USER, 365 chrome_exe_, *product_, *prefs_no_ql, installer::CURRENT_USER,
365 installer::INSTALL_SHORTCUT_CREATE_ALL); 366 installer::INSTALL_SHORTCUT_CREATE_ALL);
366 base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); 367 base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_);
367 ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); 368 ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_));
368 base::win::ValidateShortcut(user_start_menu_shortcut_, 369 base::win::ValidateShortcut(user_start_menu_shortcut_,
369 expected_start_menu_properties_); 370 expected_start_menu_properties_);
370 } 371 }
371 372
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 installer::EscapeXmlAttributeValueInSingleQuotes(&val); 815 installer::EscapeXmlAttributeValueInSingleQuotes(&val);
815 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); 816 ASSERT_STREQ(kExpectedEscapedVal, val.c_str());
816 } 817 }
817 818
818 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { 819 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) {
819 base::string16 val(L"Google Chrome"); 820 base::string16 val(L"Google Chrome");
820 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; 821 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome";
821 installer::EscapeXmlAttributeValueInSingleQuotes(&val); 822 installer::EscapeXmlAttributeValueInSingleQuotes(&val);
822 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); 823 ASSERT_STREQ(kExpectedEscapedVal, val.c_str());
823 } 824 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/setup/install_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698