diff options
author | Primiano Tucci <primiano@google.com> | 2014-09-30 14:45:55 +0100 |
---|---|---|
committer | Primiano Tucci <primiano@google.com> | 2014-09-30 14:45:55 +0100 |
commit | 1320f92c476a1ad9d19dba2a48c72b75566198e9 (patch) | |
tree | ea7f149ccad687b22c18a72b729646568b2d54fb /chrome/installer | |
parent | 39b78c562f50ad7d5551ee861121f899239525a2 (diff) | |
download | chromium_org-1320f92c476a1ad9d19dba2a48c72b75566198e9.tar.gz |
Merge from Chromium at DEPS revision 267aeeb8d85c
This commit was generated by merge_to_master.py.
Change-Id: Id3aac9713b301fae64408cdaee0888724eeb7c0e
Diffstat (limited to 'chrome/installer')
64 files changed, 244 insertions, 183 deletions
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc index 7253935521..ce03d857fd 100644 --- a/chrome/installer/gcapi/gcapi.cc +++ b/chrome/installer/gcapi/gcapi.cc @@ -478,7 +478,8 @@ BOOL __stdcall LaunchGoogleChrome() { if (process_handle.IsValid()) { HANDLE process_token = NULL; HANDLE user_token = NULL; - if (::OpenProcessToken(process_handle, TOKEN_DUPLICATE | TOKEN_QUERY, + if (::OpenProcessToken(process_handle.Get(), + TOKEN_DUPLICATE | TOKEN_QUERY, &process_token) && ::DuplicateTokenEx(process_token, TOKEN_IMPERSONATE | TOKEN_QUERY | @@ -672,7 +673,7 @@ BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code, return TRUE; } -BOOL __stdcall ReactivateChrome(wchar_t* brand_code, +BOOL __stdcall ReactivateChrome(const wchar_t* brand_code, int shell_mode, DWORD* error_code) { BOOL result = FALSE; diff --git a/chrome/installer/gcapi/gcapi.h b/chrome/installer/gcapi/gcapi.h index a35293e3d5..81a59b5136 100644 --- a/chrome/installer/gcapi/gcapi.h +++ b/chrome/installer/gcapi/gcapi.h @@ -113,7 +113,7 @@ BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code, // |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or // GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked // from an elevated or non-elevated process. -BOOL __stdcall ReactivateChrome(wchar_t* brand_code, +BOOL __stdcall ReactivateChrome(const wchar_t* brand_code, int shell_mode, DWORD* error_code); diff --git a/chrome/installer/gcapi/gcapi_last_run_test.cc b/chrome/installer/gcapi/gcapi_last_run_test.cc index 8f07a3b55a..85e7eed908 100644 --- a/chrome/installer/gcapi/gcapi_last_run_test.cc +++ b/chrome/installer/gcapi/gcapi_last_run_test.cc @@ -26,9 +26,7 @@ class GCAPILastRunTest : public ::testing::Test { protected: void SetUp() { // Override keys - this is undone during destruction. - std::wstring hkcu_override = base::StringPrintf( - L"hkcu_override\\%ls", base::ASCIIToWide(base::GenerateGUID())); - override_manager_.OverrideRegistry(HKEY_CURRENT_USER, hkcu_override); + override_manager_.OverrideRegistry(HKEY_CURRENT_USER); // Create the client state key in the right places. std::wstring reg_path(google_update::kRegPathClientState); diff --git a/chrome/installer/gcapi/gcapi_test.cc b/chrome/installer/gcapi/gcapi_test.cc index 477b15a98e..4e5d0a738e 100644 --- a/chrome/installer/gcapi/gcapi_test.cc +++ b/chrome/installer/gcapi/gcapi_test.cc @@ -25,7 +25,7 @@ void call_statically() { if (result_flag_off != result_flag_on) printf("Registry key flag is not being set properly."); - printf("Static call returned result as %d and reason as %d.\n", + printf("Static call returned result as %d and reason as %ld.\n", result_flag_on, reason); } @@ -50,7 +50,7 @@ void call_dynamically() { if (result_flag_off != result_flag_on) printf("Registry key flag is not being set properly."); - printf("Dynamic call returned result as %d and reason as %d.\n", + printf("Dynamic call returned result as %d and reason as %ld.\n", result_flag_on, reason); } else { printf("Couldn't find GoogleChromeCompatibilityCheck() in gcapi_dll.\n"); diff --git a/chrome/installer/gcapi/gcapi_test_registry_overrider.cc b/chrome/installer/gcapi/gcapi_test_registry_overrider.cc index be678a2a50..8f2b05d3a1 100644 --- a/chrome/installer/gcapi/gcapi_test_registry_overrider.cc +++ b/chrome/installer/gcapi/gcapi_test_registry_overrider.cc @@ -11,8 +11,8 @@ GCAPITestRegistryOverrider::GCAPITestRegistryOverrider() { // Override keys - this is undone during destruction. - override_manager_.OverrideRegistry(HKEY_CURRENT_USER, L"hkcu_override"); - override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE, L"hklm_override"); + override_manager_.OverrideRegistry(HKEY_CURRENT_USER); + override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE); } GCAPITestRegistryOverrider::~GCAPITestRegistryOverrider() { diff --git a/chrome/installer/launcher_support/chrome_launcher_support.cc b/chrome/installer/launcher_support/chrome_launcher_support.cc index 9e9ba92604..9574ae1356 100644 --- a/chrome/installer/launcher_support/chrome_launcher_support.cc +++ b/chrome/installer/launcher_support/chrome_launcher_support.cc @@ -6,8 +6,8 @@ #include <windows.h> -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/strings/string16.h" #include "base/win/registry.h" diff --git a/chrome/installer/linux/debian/build.sh b/chrome/installer/linux/debian/build.sh index 2bd4583705..21a4a4e9ba 100755 --- a/chrome/installer/linux/debian/build.sh +++ b/chrome/installer/linux/debian/build.sh @@ -8,6 +8,7 @@ # builds don't add the "${BUILDDIR}/installer/" files needed for packaging. set -e +set -o pipefail if [ "$VERBOSE" ]; then set -x fi @@ -260,7 +261,7 @@ touch debian/control # but it seems that we don't currently, so this is the most expediant fix. SAVE_LDLP=${LD_LIBRARY_PATH:-} unset LD_LIBRARY_PATH -DPKG_SHLIB_DEPS=$(dpkg-shlibdeps -O "$BUILDDIR/chrome" 2> /dev/null | \ +DPKG_SHLIB_DEPS=$(dpkg-shlibdeps -O "$BUILDDIR/chrome" | \ sed 's/^shlibs:Depends=//') if [ -n "$SAVE_LDLP" ]; then LD_LIBRARY_PATH=$SAVE_LDLP diff --git a/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py b/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py index 87158fc2ad..35b5a94752 100755 --- a/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py +++ b/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py @@ -80,11 +80,16 @@ def main(args): elif 'target_arch=ia32' in gyp_defines: host_arch = 'i386' else: - # Figure out host arch, like the host_arch variable in build/common.gypi. - machine_type = platform.machine() - if machine_type in ['amd64', 'x86_64']: + # Figure out host arch using build/detect_host_arch.py. + SRC_DIR = os.path.abspath( + os.path.join(SCRIPT_DIR, '..', '..', '..', '..')) + sys.path.append(os.path.join(SRC_DIR, 'build')) + import detect_host_arch + + detected_host_arch = detect_host_arch.HostArch() + if detected_host_arch == 'x64': host_arch = 'amd64' - elif re.match('(i[3-6]86|i86pc)$', machine_type): + elif detected_host_arch == 'ia32': host_arch = 'i386' if host_arch != options.arch: return 0 diff --git a/chrome/installer/mac/app_resource_rules.plist.in b/chrome/installer/mac/app_resource_rules.plist.in index 6fc6246b4b..f3d24cd199 100644 --- a/chrome/installer/mac/app_resource_rules.plist.in +++ b/chrome/installer/mac/app_resource_rules.plist.in @@ -68,8 +68,6 @@ </dict> <key>^Versions/@VERSION_REGEX@/</key> <dict> - <key>nested</key> - <true/> <key>weight</key> <real>20</real> </dict> @@ -80,6 +78,20 @@ <key>weight</key> <real>30</real> </dict> + <key>^Versions/@VERSION_REGEX@/.+/Resources/.+\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>30</real> + </dict> + <key>^Versions/@VERSION_REGEX@/.+/Resources Disabled/</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>40</real> + </dict> <key>/\.DS_Store$</key> <dict> <key>omit</key> diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release index 522980fee7..d2d0a2f9a3 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release @@ -22,7 +22,6 @@ chrome.dll: %(VersionDir)s\ chrome_100_percent.pak: %(VersionDir)s\ chrome_child.dll: %(VersionDir)s\ chrome_elf.dll: %(VersionDir)s\ -D3DCompiler_43.dll: %(VersionDir)s\ d3dcompiler_46.dll: %(VersionDir)s\ ffmpegsumo.dll: %(VersionDir)s\ icudt.dll: %(VersionDir)s\ diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc index da3cf91d5a..e00569c7fa 100644 --- a/chrome/installer/mini_installer/mini_installer.cc +++ b/chrome/installer/mini_installer/mini_installer.cc @@ -405,10 +405,12 @@ bool UnpackBinaryResources(const Configuration& configuration, HMODULE module, // If we found setup 'B7' resource, handle it. if (setup_path->length() > 0) { CommandString cmd_line; + PathString exe_path; // Get the path to setup.exe first. bool success = true; - if (!GetSetupExePathFromRegistry(configuration, cmd_line.get(), - cmd_line.capacity()) || + if (!GetSetupExePathFromRegistry(configuration, exe_path.get(), + exe_path.capacity()) || + !cmd_line.append(exe_path.get()) || !cmd_line.append(L" --") || !cmd_line.append(kCmdUpdateSetupExe) || !cmd_line.append(L"=\"") || @@ -429,7 +431,7 @@ bool UnpackBinaryResources(const Configuration& configuration, HMODULE module, ProcessExitCode exit_code = SUCCESS_EXIT_CODE; if (success && - (!RunProcessAndWait(NULL, cmd_line.get(), &exit_code) || + (!RunProcessAndWait(exe_path.get(), cmd_line.get(), &exit_code) || exit_code != SUCCESS_EXIT_CODE)) { success = false; } diff --git a/chrome/installer/setup/archive_patch_helper.cc b/chrome/installer/setup/archive_patch_helper.cc index 4ef6bc4004..959be3afd8 100644 --- a/chrome/installer/setup/archive_patch_helper.cc +++ b/chrome/installer/setup/archive_patch_helper.cc @@ -4,7 +4,7 @@ #include "chrome/installer/setup/archive_patch_helper.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "chrome/installer/util/lzma_util.h" #include "courgette/courgette.h" diff --git a/chrome/installer/setup/archive_patch_helper_unittest.cc b/chrome/installer/setup/archive_patch_helper_unittest.cc index 17ff00329b..9dd4f08703 100644 --- a/chrome/installer/setup/archive_patch_helper_unittest.cc +++ b/chrome/installer/setup/archive_patch_helper_unittest.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" #include "chrome/common/chrome_paths.h" diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index f1ab38dab8..a1bbed7eb8 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -10,8 +10,8 @@ #include <string> -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/numerics/safe_conversions.h" diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index 54b3629cd0..e617a19807 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc @@ -6,8 +6,8 @@ #include <string> -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index 727d4fe09c..d336630340 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -15,8 +15,8 @@ #include "base/bind.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index eda79e57fa..b02be692ed 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -14,9 +14,9 @@ #include "base/at_exit.h" #include "base/basictypes.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/file_version_info.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index 3f9c93703a..3e0a3d9dc6 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc @@ -10,9 +10,9 @@ #include "base/command_line.h" #include "base/cpu.h" -#include "base/file_util.h" #include "base/files/file_enumerator.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/process/kill.h" #include "base/process/launch.h" @@ -479,7 +479,8 @@ ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) tp.Privileges[0].Luid = privilege_luid; tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; DWORD return_length; - if (!::AdjustTokenPrivileges(token_, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), + if (!::AdjustTokenPrivileges(token_.Get(), FALSE, &tp, + sizeof(TOKEN_PRIVILEGES), &previous_privileges_, &return_length)) { token_.Close(); return; @@ -490,7 +491,7 @@ ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) ScopedTokenPrivilege::~ScopedTokenPrivilege() { if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { - ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, + ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, sizeof(TOKEN_PRIVILEGES), NULL, NULL); } } diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index 7f58d897a0..6f5752c06e 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -9,7 +9,7 @@ #include <string> #include "base/command_line.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/process/kill.h" @@ -21,8 +21,8 @@ #include "base/version.h" #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" -#include "chrome/installer/setup/setup_util.h" #include "chrome/installer/setup/setup_constants.h" +#include "chrome/installer/setup/setup_util.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/installation_state.h" #include "chrome/installer/util/installer_state.h" @@ -66,13 +66,15 @@ bool CurrentProcessHasPrivilege(const wchar_t* privilege_name) { // First get the size of the buffer needed for |privileges| below. DWORD size; - EXPECT_FALSE(::GetTokenInformation(token, TokenPrivileges, NULL, 0, &size)); + EXPECT_FALSE(::GetTokenInformation(token.Get(), TokenPrivileges, NULL, 0, + &size)); scoped_ptr<BYTE[]> privileges_bytes(new BYTE[size]); TOKEN_PRIVILEGES* privileges = reinterpret_cast<TOKEN_PRIVILEGES*>(privileges_bytes.get()); - if (!::GetTokenInformation(token, TokenPrivileges, privileges, size, &size)) { + if (!::GetTokenInformation(token.Get(), TokenPrivileges, privileges, size, + &size)) { ADD_FAILURE(); return false; } @@ -408,8 +410,7 @@ namespace { class MigrateMultiToSingleTest : public testing::Test { protected: virtual void SetUp() OVERRIDE { - registry_override_manager_.OverrideRegistry(kRootKey, - L"MigrateMultiToSingleTest"); + registry_override_manager_.OverrideRegistry(kRootKey); } static const bool kSystemLevel = false; diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index ce02a20b79..0d8293f0d6 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -11,8 +11,8 @@ #include <vector> #include "base/base_paths.h" -#include "base/file_util.h" #include "base/files/file_enumerator.h" +#include "base/files/file_util.h" #include "base/path_service.h" #include "base/process/kill.h" #include "base/strings/string16.h" @@ -282,13 +282,13 @@ void CloseChromeFrameHelperProcess() { ::GetWindowThreadProcessId(window, &pid); DCHECK_NE(pid, 0U); base::win::ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid)); - PLOG_IF(INFO, !process) << "Failed to open process: " << pid; + PLOG_IF(INFO, !process.IsValid()) << "Failed to open process: " << pid; bool kill = true; if (SendMessageTimeout(window, WM_CLOSE, 0, 0, SMTO_BLOCK, kWaitMs, NULL) && - process) { + process.IsValid()) { VLOG(1) << "Waiting for " << installer::kChromeFrameHelperExe; - DWORD wait = ::WaitForSingleObject(process, kWaitMs); + DWORD wait = ::WaitForSingleObject(process.Get(), kWaitMs); if (wait != WAIT_OBJECT_0) { LOG(WARNING) << "Wait for " << installer::kChromeFrameHelperExe << " to exit failed or timed out."; diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc index b5035bb4ed..0d505c844b 100644 --- a/chrome/installer/test/alternate_version_generator.cc +++ b/chrome/installer/test/alternate_version_generator.cc @@ -33,10 +33,10 @@ #include "base/basictypes.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file.h" #include "base/files/file_enumerator.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/path_service.h" #include "base/process/launch.h" diff --git a/chrome/installer/test/alternate_version_generator_main.cc b/chrome/installer/test/alternate_version_generator_main.cc index 85d925cfad..7d819f07bf 100644 --- a/chrome/installer/test/alternate_version_generator_main.cc +++ b/chrome/installer/test/alternate_version_generator_main.cc @@ -11,8 +11,8 @@ #include "base/at_exit.h" #include "base/basictypes.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/path_service.h" #include "chrome/installer/test/alternate_version_generator.h" diff --git a/chrome/installer/test/upgrade_test.cc b/chrome/installer/test/upgrade_test.cc index d50089ff43..b599521612 100644 --- a/chrome/installer/test/upgrade_test.cc +++ b/chrome/installer/test/upgrade_test.cc @@ -5,8 +5,8 @@ // Boilerplate for an upgrade scenario test. The mini_installer.exe residing in // the same directory as the host executable is re-versioned. -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/path_service.h" #include "chrome/installer/test/alternate_version_generator.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/installer/tools/validate_installation_main.cc b/chrome/installer/tools/validate_installation_main.cc index 65cb42a80a..dc95aaa5e6 100644 --- a/chrome/installer/tools/validate_installation_main.cc +++ b/chrome/installer/tools/validate_installation_main.cc @@ -11,7 +11,7 @@ #include "base/at_exit.h" #include "base/command_line.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/path_service.h" #include "chrome/installer/util/installation_validator.h" diff --git a/chrome/installer/util/channel_info.cc b/chrome/installer/util/channel_info.cc index 48a4e32127..cdf264bad0 100644 --- a/chrome/installer/util/channel_info.cc +++ b/chrome/installer/util/channel_info.cc @@ -27,7 +27,8 @@ const wchar_t kSfxMultiFail[] = L"-multifail"; const wchar_t* const kChannels[] = { installer::kChromeChannelBeta, - installer::kChromeChannelDev + installer::kChromeChannelDev, + installer::kChromeChannelStableExplicit }; const wchar_t* const kModifiers[] = { @@ -168,7 +169,11 @@ bool ChannelInfo::GetChannelName(std::wstring* channel_name) const { *const* end = &kChannels[arraysize(kChannels)]; scan != end; ++scan) { if (value_.find(*scan) != std::wstring::npos) { - channel_name->assign(*scan); + // Report channels with "stable" in them as stable (empty string). + if (*scan == installer::kChromeChannelStableExplicit) + channel_name->erase(); + else + channel_name->assign(*scan); return true; } } diff --git a/chrome/installer/util/channel_info_unittest.cc b/chrome/installer/util/channel_info_unittest.cc index d08f2c3104..71d908b6e2 100644 --- a/chrome/installer/util/channel_info_unittest.cc +++ b/chrome/installer/util/channel_info_unittest.cc @@ -50,6 +50,16 @@ TEST(ChannelInfoTest, Channels) { EXPECT_TRUE(ci.GetChannelName(&channel)); EXPECT_EQ(kChannelDev, channel); + ci.set_value(L"x64-dev"); + EXPECT_TRUE(ci.GetChannelName(&channel)); + EXPECT_EQ(kChannelDev, channel); + ci.set_value(L"x64-beta"); + EXPECT_TRUE(ci.GetChannelName(&channel)); + EXPECT_EQ(kChannelBeta, channel); + ci.set_value(L"x64-stable"); + EXPECT_TRUE(ci.GetChannelName(&channel)); + EXPECT_EQ(kChannelStable, channel); + ci.set_value(L"fuzzy"); EXPECT_FALSE(ci.GetChannelName(&channel)); } diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc index fc34094a8b..5f2a262c7c 100644 --- a/chrome/installer/util/chrome_browser_operations.cc +++ b/chrome/installer/util/chrome_browser_operations.cc @@ -5,8 +5,8 @@ #include "chrome/installer/util/chrome_browser_operations.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "chrome/installer/util/browser_distribution.h" diff --git a/chrome/installer/util/conditional_work_item_list.cc b/chrome/installer/util/conditional_work_item_list.cc index 56c8617009..ad669448a1 100644 --- a/chrome/installer/util/conditional_work_item_list.cc +++ b/chrome/installer/util/conditional_work_item_list.cc @@ -4,7 +4,7 @@ #include "chrome/installer/util/conditional_work_item_list.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" ConditionalWorkItemList::ConditionalWorkItemList(Condition* condition) diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc index 1ec3c8a837..88bc244ef5 100644 --- a/chrome/installer/util/copy_tree_work_item.cc +++ b/chrome/installer/util/copy_tree_work_item.cc @@ -6,7 +6,7 @@ #include <shlwapi.h> -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "chrome/installer/util/logging_installer.h" diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc index 72bdc56717..d89a03a782 100644 --- a/chrome/installer/util/copy_tree_work_item_unittest.cc +++ b/chrome/installer/util/copy_tree_work_item_unittest.cc @@ -7,7 +7,7 @@ #include <fstream> #include "base/base_paths.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -19,59 +19,61 @@ #include "testing/gtest/include/gtest/gtest.h" namespace { - class CopyTreeWorkItemTest : public testing::Test { - protected: - virtual void SetUp() { - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); - } - - virtual void TearDown() { - logging::CloseLogFile(); - } - - // the path to temporary directory used to contain the test operations - base::ScopedTempDir test_dir_; - base::ScopedTempDir temp_dir_; - }; - - // Simple function to dump some text into a new file. - void CreateTextFile(const std::wstring& filename, - const std::wstring& contents) { - std::ofstream file; - file.open(filename.c_str()); - ASSERT_TRUE(file.is_open()); - file << contents; - file.close(); + +class CopyTreeWorkItemTest : public testing::Test { + protected: + virtual void SetUp() { + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); } - bool IsFileInUse(const base::FilePath& path) { - if (!base::PathExists(path)) - return false; + virtual void TearDown() { + logging::CloseLogFile(); + } - HANDLE handle = ::CreateFile(path.value().c_str(), FILE_ALL_ACCESS, - NULL, NULL, OPEN_EXISTING, NULL, NULL); - if (handle == INVALID_HANDLE_VALUE) - return true; + // the path to temporary directory used to contain the test operations + base::ScopedTempDir test_dir_; + base::ScopedTempDir temp_dir_; +}; - CloseHandle(handle); +// Simple function to dump some text into a new file. +void CreateTextFile(const std::wstring& filename, + const std::wstring& contents) { + std::ofstream file; + file.open(filename.c_str()); + ASSERT_TRUE(file.is_open()); + file << contents; + file.close(); +} + +bool IsFileInUse(const base::FilePath& path) { + if (!base::PathExists(path)) return false; - } - // Simple function to read text from a file. - std::wstring ReadTextFile(const std::wstring& filename) { - WCHAR contents[64]; - std::wifstream file; - file.open(filename.c_str()); - EXPECT_TRUE(file.is_open()); - file.getline(contents, 64); - file.close(); - return std::wstring(contents); - } + HANDLE handle = ::CreateFile(path.value().c_str(), FILE_ALL_ACCESS, + NULL, NULL, OPEN_EXISTING, NULL, NULL); + if (handle == INVALID_HANDLE_VALUE) + return true; - wchar_t text_content_1[] = L"Gooooooooooooooooooooogle"; - wchar_t text_content_2[] = L"Overwrite Me"; -}; + CloseHandle(handle); + return false; +} + +// Simple function to read text from a file. +std::wstring ReadTextFile(const std::wstring& filename) { + WCHAR contents[64]; + std::wifstream file; + file.open(filename.c_str()); + EXPECT_TRUE(file.is_open()); + file.getline(contents, 64); + file.close(); + return std::wstring(contents); +} + +const wchar_t text_content_1[] = L"Gooooooooooooooooooooogle"; +const wchar_t text_content_2[] = L"Overwrite Me"; + +} // namespace // Copy one file from source to destination. TEST_F(CopyTreeWorkItemTest, CopyFile) { diff --git a/chrome/installer/util/create_dir_work_item.cc b/chrome/installer/util/create_dir_work_item.cc index 1eff7bf119..b2667c12cb 100644 --- a/chrome/installer/util/create_dir_work_item.cc +++ b/chrome/installer/util/create_dir_work_item.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "chrome/installer/util/create_dir_work_item.h" #include "chrome/installer/util/logging_installer.h" diff --git a/chrome/installer/util/create_dir_work_item_unittest.cc b/chrome/installer/util/create_dir_work_item_unittest.cc index 9ac5d5658d..09b610b4f9 100644 --- a/chrome/installer/util/create_dir_work_item_unittest.cc +++ b/chrome/installer/util/create_dir_work_item_unittest.cc @@ -5,7 +5,7 @@ #include <windows.h> #include "base/base_paths.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index fb7956ed26..b298d6a21b 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc @@ -15,8 +15,8 @@ #include <string> #include <vector> -#include "base/file_util.h" #include "base/files/file_enumerator.h" +#include "base/files/file_util.h" #include "base/strings/string_util.h" #include "base/win/registry.h" @@ -81,10 +81,10 @@ bool ScheduleFileSystemEntityForDeletion(const base::FilePath& path) { GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (file != INVALID_HANDLE_VALUE) { - LOG(INFO) << " file not in use: " << path.value(); + VLOG(1) << " file not in use: " << path.value(); ::CloseHandle(file); } else { - PLOG(INFO) << " file in use (or not found?): " << path.value(); + PLOG(WARNING) << " file in use (or not found?): " << path.value(); } } #endif diff --git a/chrome/installer/util/delete_after_reboot_helper_unittest.cc b/chrome/installer/util/delete_after_reboot_helper_unittest.cc index 4c635976cb..b6f5046961 100644 --- a/chrome/installer/util/delete_after_reboot_helper_unittest.cc +++ b/chrome/installer/util/delete_after_reboot_helper_unittest.cc @@ -5,7 +5,7 @@ #include <windows.h> #include <shlobj.h> -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_util.h" #include "base/win/registry.h" diff --git a/chrome/installer/util/delete_tree_work_item.cc b/chrome/installer/util/delete_tree_work_item.cc index 198a1d7f75..9cc47ede00 100644 --- a/chrome/installer/util/delete_tree_work_item.cc +++ b/chrome/installer/util/delete_tree_work_item.cc @@ -7,7 +7,7 @@ #include <algorithm> #include <limits> -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" namespace { diff --git a/chrome/installer/util/delete_tree_work_item_unittest.cc b/chrome/installer/util/delete_tree_work_item_unittest.cc index caa99e2cc2..4e580a3f13 100644 --- a/chrome/installer/util/delete_tree_work_item_unittest.cc +++ b/chrome/installer/util/delete_tree_work_item_unittest.cc @@ -7,7 +7,7 @@ #include <fstream> #include "base/base_paths.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -18,30 +18,31 @@ #include "testing/gtest/include/gtest/gtest.h" namespace { - class DeleteTreeWorkItemTest : public testing::Test { - protected: - virtual void SetUp() { - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - } - - // The temporary directory used to contain the test operations. - base::ScopedTempDir temp_dir_; - }; - - // Simple function to dump some text into a new file. - void CreateTextFile(const std::wstring& filename, - const std::wstring& contents) { - std::ofstream file; - file.open(filename.c_str()); - ASSERT_TRUE(file.is_open()); - file << contents; - file.close(); + +class DeleteTreeWorkItemTest : public testing::Test { + protected: + virtual void SetUp() { + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } - wchar_t text_content_1[] = L"delete me"; - wchar_t text_content_2[] = L"delete me as well"; + // The temporary directory used to contain the test operations. + base::ScopedTempDir temp_dir_; }; +// Simple function to dump some text into a new file. +void CreateTextFile(const std::wstring& filename, + const std::wstring& contents) { + std::ofstream file; + file.open(filename.c_str()); + ASSERT_TRUE(file.is_open()); + file << contents; + file.close(); +} + +const wchar_t text_content_1[] = L"delete me"; + +} // namespace + // Delete a tree without key path. Everything should be deleted. TEST_F(DeleteTreeWorkItemTest, DeleteTreeNoKeyPath) { // Create tree to be deleted. diff --git a/chrome/installer/util/duplicate_tree_detector.cc b/chrome/installer/util/duplicate_tree_detector.cc index 59583755d2..d52dbcfeff 100644 --- a/chrome/installer/util/duplicate_tree_detector.cc +++ b/chrome/installer/util/duplicate_tree_detector.cc @@ -5,8 +5,8 @@ #include "chrome/installer/util/duplicate_tree_detector.h" -#include "base/file_util.h" #include "base/files/file_enumerator.h" +#include "base/files/file_util.h" #include "base/logging.h" namespace installer { diff --git a/chrome/installer/util/duplicate_tree_detector_unittest.cc b/chrome/installer/util/duplicate_tree_detector_unittest.cc index 72650af9f6..65bb06eb4d 100644 --- a/chrome/installer/util/duplicate_tree_detector_unittest.cc +++ b/chrome/installer/util/duplicate_tree_detector_unittest.cc @@ -6,7 +6,7 @@ #include <fstream> -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/strings/string16.h" #include "base/strings/string_util.h" diff --git a/chrome/installer/util/eula_util.cc b/chrome/installer/util/eula_util.cc index c39fa6ff12..12e0bf27b3 100644 --- a/chrome/installer/util/eula_util.cc +++ b/chrome/installer/util/eula_util.cc @@ -4,7 +4,7 @@ #include "chrome/installer/util/eula_util.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/memory/scoped_ptr.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/install_util.h" diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc index 51e896b372..2069bf2c12 100644 --- a/chrome/installer/util/google_update_settings_unittest.cc +++ b/chrome/installer/util/google_update_settings_unittest.cc @@ -35,8 +35,8 @@ const wchar_t kTestExperimentLabel[] = L"test_label_value"; class GoogleUpdateSettingsTest : public testing::Test { protected: virtual void SetUp() OVERRIDE { - registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE, L"HKLM_pit"); - registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER, L"HKCU_pit"); + registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE); + registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER); } enum SystemUserInstall { @@ -1084,7 +1084,7 @@ void CollectStatsConsent::SetUp() { base::string16 reg_temp_name( stats_state.system_level() ? L"HKLM_" : L"HKCU_"); reg_temp_name += L"CollectStatsConsent"; - override_manager_.OverrideRegistry(root_key, reg_temp_name); + override_manager_.OverrideRegistry(root_key); if (stats_state.multi_install()) { MakeChromeMultiInstall(root_key); diff --git a/chrome/installer/util/google_update_util.cc b/chrome/installer/util/google_update_util.cc index d3013bac30..1b8c74d445 100644 --- a/chrome/installer/util/google_update_util.cc +++ b/chrome/installer/util/google_update_util.cc @@ -5,8 +5,8 @@ #include "chrome/installer/util/google_update_util.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/path_service.h" #include "base/process/kill.h" @@ -95,7 +95,8 @@ bool LaunchProcessAndWaitWithTimeout(const base::string16& cmd_string, if (!base::LaunchProcess(cmd_string, base::LaunchOptions(), &process)) { PLOG(ERROR) << "Failed to launch (" << cmd_string << ")"; - } else if (!base::WaitForExitCodeWithTimeout(process, &exit_code, timeout)) { + } else if (!base::WaitForExitCodeWithTimeout(process.Get(), &exit_code, + timeout)) { // The GetExitCodeProcess failed or timed-out. LOG(ERROR) <<"Command (" << cmd_string << ") is taking more than " << timeout.InMilliseconds() << " milliseconds to complete."; diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index e11cc02274..56cb944036 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -14,7 +14,7 @@ #include <algorithm> #include "base/command_line.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc index 42a83f7187..241db4b6ad 100644 --- a/chrome/installer/util/install_util_unittest.cc +++ b/chrome/installer/util/install_util_unittest.cc @@ -6,7 +6,7 @@ #include <utility> #include "base/command_line.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/strings/string_util.h" #include "base/test/test_reg_util_win.h" #include "base/win/registry.h" @@ -82,7 +82,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStageAP) { // Update the stage when there's no "ap" value. { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_inst_res"); + override_manager.OverrideRegistry(root); RegKey(root, state_key_path.c_str(), KEY_SET_VALUE); InstallUtil::UpdateInstallerStage(system_level, state_key_path, installer::BUILDING); @@ -96,7 +96,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStageAP) { // Update the stage when there is an "ap" value. { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_inst_res"); + override_manager.OverrideRegistry(root); RegKey(root, state_key_path.c_str(), KEY_SET_VALUE) .WriteValue(google_update::kRegApField, L"2.0-dev"); InstallUtil::UpdateInstallerStage(system_level, state_key_path, @@ -111,7 +111,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStageAP) { // Clear the stage. { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_inst_res"); + override_manager.OverrideRegistry(root); RegKey(root, state_key_path.c_str(), KEY_SET_VALUE) .WriteValue(google_update::kRegApField, L"2.0-dev-stage:building"); InstallUtil::UpdateInstallerStage(system_level, state_key_path, @@ -132,7 +132,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStage) { // Update the stage when there's no "InstallerExtraCode1" value. { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_inst_res"); + override_manager.OverrideRegistry(root); RegKey(root, state_key_path.c_str(), KEY_SET_VALUE) .DeleteValue(installer::kInstallerExtraCode1); InstallUtil::UpdateInstallerStage(system_level, state_key_path, @@ -147,7 +147,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStage) { // Update the stage when there is an "InstallerExtraCode1" value. { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_inst_res"); + override_manager.OverrideRegistry(root); RegKey(root, state_key_path.c_str(), KEY_SET_VALUE) .WriteValue(installer::kInstallerExtraCode1, static_cast<DWORD>(installer::UNPACKING)); @@ -163,7 +163,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStage) { // Clear the stage. { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_inst_res"); + override_manager.OverrideRegistry(root); RegKey(root, state_key_path.c_str(), KEY_SET_VALUE) .WriteValue(installer::kInstallerExtraCode1, static_cast<DWORD>(5)); InstallUtil::UpdateInstallerStage(system_level, state_key_path, @@ -185,7 +185,7 @@ TEST_F(InstallUtilTest, DeleteRegistryKeyIf) { { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_key"); + override_manager.OverrideRegistry(root); // Nothing to delete if the keys aren't even there. { MockRegistryValuePredicate pred; @@ -293,7 +293,7 @@ TEST_F(InstallUtilTest, DeleteRegistryValueIf) { { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_key"); + override_manager.OverrideRegistry(root); // Nothing to delete if the key isn't even there. { MockRegistryValuePredicate pred; @@ -357,7 +357,7 @@ TEST_F(InstallUtilTest, DeleteRegistryValueIf) { { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_key"); + override_manager.OverrideRegistry(root); // Default value matches: delete using empty string. { MockRegistryValuePredicate pred; @@ -378,7 +378,7 @@ TEST_F(InstallUtilTest, DeleteRegistryValueIf) { { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_key"); + override_manager.OverrideRegistry(root); // Default value matches: delete using NULL. { MockRegistryValuePredicate pred; diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index 0434906716..6ec0734713 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -9,9 +9,9 @@ #include <utility> #include "base/command_line.h" -#include "base/file_util.h" #include "base/file_version_info.h" #include "base/files/file_enumerator.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_util.h" diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index a9e4f06ef5..974cb86bb3 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -8,13 +8,14 @@ #include "base/base_paths.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file_enumerator.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_path_override.h" #include "base/test/test_reg_util_win.h" #include "base/version.h" #include "base/win/registry.h" @@ -352,7 +353,7 @@ TEST_F(InstallerStateTest, WithProduct) { { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_pit"); + override_manager.OverrideRegistry(root); BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_BROWSER); RegKey chrome_key(root, dist->GetVersionKey().c_str(), KEY_ALL_ACCESS); @@ -384,7 +385,7 @@ TEST_F(InstallerStateTest, InstallerResult) { // check results for a fresh install of single Chrome { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_inst_res"); + override_manager.OverrideRegistry(root); CommandLine cmd_line = CommandLine::FromString(L"setup.exe --system-level"); const MasterPreferences prefs(cmd_line); InstallationState machine_state; @@ -415,7 +416,7 @@ TEST_F(InstallerStateTest, InstallerResult) { // check results for a fresh install of multi Chrome { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_inst_res"); + override_manager.OverrideRegistry(root); CommandLine cmd_line = CommandLine::FromString( L"setup.exe --system-level --multi-install --chrome"); const MasterPreferences prefs(cmd_line); @@ -485,7 +486,7 @@ TEST_F(InstallerStateTest, IsFileInUse) { SYNCHRONIZE | FILE_EXECUTE, FILE_SHARE_DELETE | FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0)); - ASSERT_TRUE(temp_handle != NULL); + ASSERT_TRUE(temp_handle.IsValid()); // The file should now be in use. EXPECT_TRUE(MockInstallerState::IsFileInUse(temp_file)); @@ -603,6 +604,22 @@ TEST_F(InstallerStateTest, RemoveOldVersionDirs) { } TEST_F(InstallerStateTest, InitializeTwice) { + // Override these paths so that they can be found after the registry override + // manager is in place. + base::FilePath temp; + PathService::Get(base::DIR_PROGRAM_FILES, &temp); + base::ScopedPathOverride program_files_override(base::DIR_PROGRAM_FILES, + temp); + PathService::Get(base::DIR_PROGRAM_FILESX86, &temp); + base::ScopedPathOverride program_filesx86_override(base::DIR_PROGRAM_FILESX86, + temp); + PathService::Get(base::DIR_LOCAL_APP_DATA, &temp); + base::ScopedPathOverride local_app_data_override(base::DIR_LOCAL_APP_DATA, + temp); + registry_util::RegistryOverrideManager override_manager; + override_manager.OverrideRegistry(HKEY_CURRENT_USER); + override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE); + InstallationState machine_state; machine_state.Initialize(); diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index 18a734ec75..bf76a3e009 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -7,9 +7,9 @@ #include "chrome/installer/util/logging_installer.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/logging_win.h" #include "base/path_service.h" diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc index 19eef2f747..910f35d1c1 100644 --- a/chrome/installer/util/logging_installer_unittest.cc +++ b/chrome/installer/util/logging_installer_unittest.cc @@ -4,9 +4,9 @@ #include <string> -#include "base/file_util.h" #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/win/scoped_handle.h" #include "chrome/installer/util/logging_installer.h" diff --git a/chrome/installer/util/lzma_util.cc b/chrome/installer/util/lzma_util.cc index 324acd5978..dc7daf3502 100644 --- a/chrome/installer/util/lzma_util.cc +++ b/chrome/installer/util/lzma_util.cc @@ -4,7 +4,7 @@ #include "chrome/installer/util/lzma_util.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" diff --git a/chrome/installer/util/lzma_util_unittest.cc b/chrome/installer/util/lzma_util_unittest.cc index cc0b8e626b..ac4c4c6fec 100644 --- a/chrome/installer/util/lzma_util_unittest.cc +++ b/chrome/installer/util/lzma_util_unittest.cc @@ -4,7 +4,7 @@ #include <windows.h> -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" #include "chrome/common/chrome_paths.h" @@ -12,6 +12,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace { + class LzmaUtilTest : public testing::Test { protected: virtual void SetUp() { @@ -27,7 +28,8 @@ class LzmaUtilTest : public testing::Test { // The path to input data used in tests. base::FilePath data_dir_; }; -}; + +} // namespace // Test that we can open archives successfully. TEST_F(LzmaUtilTest, OpenArchiveTest) { diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 625a32dc8a..a5a6a640cf 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -5,7 +5,7 @@ #include "chrome/installer/util/master_preferences.h" #include "base/environment.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/json/json_string_value_serializer.h" #include "base/lazy_instance.h" #include "base/logging.h" diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index 4a6182f192..6c162d7977 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -4,7 +4,7 @@ // // Unit tests for master preferences related methods. -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/stringprintf.h" diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc index a1b7b031fc..5d6c070339 100644 --- a/chrome/installer/util/move_tree_work_item.cc +++ b/chrome/installer/util/move_tree_work_item.cc @@ -6,7 +6,7 @@ #include <shlwapi.h> -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "chrome/installer/util/duplicate_tree_detector.h" #include "chrome/installer/util/logging_installer.h" diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc index 8d60bd691c..2165cd7985 100644 --- a/chrome/installer/util/move_tree_work_item_unittest.cc +++ b/chrome/installer/util/move_tree_work_item_unittest.cc @@ -7,7 +7,7 @@ #include <fstream> #include "base/base_paths.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/memory_mapped_file.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" diff --git a/chrome/installer/util/product.cc b/chrome/installer/util/product.cc index c7f1b8f49d..96a42e34a4 100644 --- a/chrome/installer/util/product.cc +++ b/chrome/installer/util/product.cc @@ -117,16 +117,18 @@ bool Product::SetMsiMarker(bool system_install, bool set) const { RegKey client_state_key; LONG result = client_state_key.Open(reg_root, distribution_->GetStateKey().c_str(), - KEY_READ | KEY_WRITE | KEY_WOW64_32KEY); + KEY_SET_VALUE | KEY_WOW64_32KEY); if (result == ERROR_SUCCESS) { result = client_state_key.WriteValue(google_update::kRegMSIField, set ? 1 : 0); } - - LOG_IF(ERROR, result != ERROR_SUCCESS) << "Failed to Open or Write MSI value" - "to client state key. error: " << result; - - return (result == ERROR_SUCCESS); + if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { + LOG(ERROR) + << "Failed to Open or Write MSI value to client state key. error: " + << result; + return false; + } + return true; } bool Product::ShouldCreateUninstallEntry() const { diff --git a/chrome/installer/util/product_state_unittest.cc b/chrome/installer/util/product_state_unittest.cc index 42c4a99c07..64848e5114 100644 --- a/chrome/installer/util/product_state_unittest.cc +++ b/chrome/installer/util/product_state_unittest.cc @@ -67,7 +67,7 @@ void ProductStateTest::SetUp() { // directly because it doesn't suit itself to our use here. RegKey temp_key; - registry_override_manager_.OverrideRegistry(overridden_, L"ProductStateTest"); + registry_override_manager_.OverrideRegistry(overridden_); EXPECT_EQ(ERROR_SUCCESS, clients_.Create(overridden_, dist_->GetVersionKey().c_str(), diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc index eabade71f3..6c311d1b73 100644 --- a/chrome/installer/util/product_unittest.cc +++ b/chrome/installer/util/product_unittest.cc @@ -76,15 +76,15 @@ TEST_F(ProductTest, ProductInstallBasic) { EXPECT_EQ(std::wstring::npos, user_data_dir.value().find(program_files.value())); - // There should be no installed version in the registry. - machine_state.Initialize(); - EXPECT_TRUE(machine_state.GetProductState( - system_level, distribution->GetType()) == NULL); - HKEY root = installer_state.root_key(); { RegistryOverrideManager override_manager; - override_manager.OverrideRegistry(root, L"root_pit"); + override_manager.OverrideRegistry(root); + + // There should be no installed version in the registry. + machine_state.Initialize(); + EXPECT_TRUE(machine_state.GetProductState( + system_level, distribution->GetType()) == NULL); // Let's pretend chrome is installed. RegKey version_key(root, distribution->GetVersionKey().c_str(), diff --git a/chrome/installer/util/self_cleaning_temp_dir.cc b/chrome/installer/util/self_cleaning_temp_dir.cc index 8d62018b3a..19697bbe72 100644 --- a/chrome/installer/util/self_cleaning_temp_dir.cc +++ b/chrome/installer/util/self_cleaning_temp_dir.cc @@ -6,7 +6,7 @@ #include <windows.h> -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "chrome/installer/util/delete_after_reboot_helper.h" diff --git a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc index 9ff34254e0..3dffbd7c95 100644 --- a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc +++ b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc @@ -5,7 +5,7 @@ #include <windows.h> #include <wincrypt.h> -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 2893f75197..1e67163d91 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -17,9 +17,9 @@ #include "base/bind.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file_enumerator.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "base/md5.h" @@ -297,8 +297,6 @@ class RegistryEntry { entries->push_back(new RegistryEntry( chrome_html_prog_id, dist->GetBrowserProgIdDesc())); entries->push_back(new RegistryEntry( - chrome_html_prog_id, ShellUtil::kRegUrlProtocol, base::string16())); - entries->push_back(new RegistryEntry( chrome_html_prog_id + ShellUtil::kRegDefaultIcon, icon_path)); entries->push_back(new RegistryEntry( chrome_html_prog_id + ShellUtil::kRegShellOpen, open_cmd)); diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 9cca44a4e4..8ebad4caa3 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -8,8 +8,8 @@ #include "base/base_paths.h" #include "base/base_paths_win.h" -#include "base/file_util.h" #include "base/files/file_enumerator.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/md5.h" #include "base/memory/scoped_ptr.h" diff --git a/chrome/installer/util/user_experiment.cc b/chrome/installer/util/user_experiment.cc index 68e4eace8a..430fd47949 100644 --- a/chrome/installer/util/user_experiment.cc +++ b/chrome/installer/util/user_experiment.cc @@ -84,7 +84,8 @@ int GetDirectoryWriteTimeInHours(const wchar_t* path) { return -1; FILETIME time; - return ::GetFileTime(file, NULL, NULL, &time) ? FileTimeToHours(time) : -1; + return ::GetFileTime(file.Get(), NULL, NULL, &time) ? + FileTimeToHours(time) : -1; } // Returns the time in hours since the last write to the user data directory. @@ -513,7 +514,7 @@ void InactiveUserToastExperiment(int flavor, break; default: outcome = kToastExpTriesErrorGroup; - }; + } // Write to the |client| key for the last time. SetClient(experiment_group + outcome, true); diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index 67df18e4c4..82404b5a87 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -263,6 +263,7 @@ const wchar_t kChromeChannelCanary[] = L"canary"; const wchar_t kChromeChannelDev[] = L"dev"; const wchar_t kChromeChannelBeta[] = L"beta"; const wchar_t kChromeChannelStable[] = L""; +const wchar_t kChromeChannelStableExplicit[] = L"stable"; const size_t kMaxAppModelIdLength = 64U; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index da54a38c43..2bc9f3e729 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -256,6 +256,7 @@ extern const wchar_t kChromeChannelCanary[]; extern const wchar_t kChromeChannelDev[]; extern const wchar_t kChromeChannelBeta[]; extern const wchar_t kChromeChannelStable[]; +extern const wchar_t kChromeChannelStableExplicit[]; extern const size_t kMaxAppModelIdLength; diff --git a/chrome/installer/util/work_item_list_unittest.cc b/chrome/installer/util/work_item_list_unittest.cc index 3e4a77afab..9219789024 100644 --- a/chrome/installer/util/work_item_list_unittest.cc +++ b/chrome/installer/util/work_item_list_unittest.cc @@ -5,7 +5,7 @@ #include <windows.h> #include "base/base_paths.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" @@ -29,7 +29,7 @@ class WorkItemListTest : public testing::Test { protected: virtual void SetUp() { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER, L"root_pit"); + registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER); } virtual void TearDown() { |