| 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 EXPECT_EQ(system_level, installer_state.system_install()); | 346 EXPECT_EQ(system_level, installer_state.system_install()); |
| 347 | 347 |
| 348 const char kCurrentVersion[] = "1.2.3.4"; | 348 const char kCurrentVersion[] = "1.2.3.4"; |
| 349 Version current_version(kCurrentVersion); | 349 Version current_version(kCurrentVersion); |
| 350 | 350 |
| 351 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 351 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 352 EXPECT_EQ(root, installer_state.root_key()); | 352 EXPECT_EQ(root, installer_state.root_key()); |
| 353 | 353 |
| 354 { | 354 { |
| 355 RegistryOverrideManager override_manager; | 355 RegistryOverrideManager override_manager; |
| 356 override_manager.OverrideRegistry(root, L"root_pit"); | 356 override_manager.OverrideRegistry(root); |
| 357 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( | 357 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( |
| 358 BrowserDistribution::CHROME_BROWSER); | 358 BrowserDistribution::CHROME_BROWSER); |
| 359 RegKey chrome_key(root, dist->GetVersionKey().c_str(), KEY_ALL_ACCESS); | 359 RegKey chrome_key(root, dist->GetVersionKey().c_str(), KEY_ALL_ACCESS); |
| 360 EXPECT_TRUE(chrome_key.Valid()); | 360 EXPECT_TRUE(chrome_key.Valid()); |
| 361 if (chrome_key.Valid()) { | 361 if (chrome_key.Valid()) { |
| 362 chrome_key.WriteValue(google_update::kRegVersionField, | 362 chrome_key.WriteValue(google_update::kRegVersionField, |
| 363 base::UTF8ToWide( | 363 base::UTF8ToWide( |
| 364 current_version.GetString()).c_str()); | 364 current_version.GetString()).c_str()); |
| 365 machine_state.Initialize(); | 365 machine_state.Initialize(); |
| 366 // TODO(tommi): Also test for when there exists a new_chrome.exe. | 366 // TODO(tommi): Also test for when there exists a new_chrome.exe. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 378 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 378 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 379 | 379 |
| 380 RegKey key; | 380 RegKey key; |
| 381 std::wstring launch_cmd = L"hey diddle diddle"; | 381 std::wstring launch_cmd = L"hey diddle diddle"; |
| 382 std::wstring value; | 382 std::wstring value; |
| 383 DWORD dw_value; | 383 DWORD dw_value; |
| 384 | 384 |
| 385 // check results for a fresh install of single Chrome | 385 // check results for a fresh install of single Chrome |
| 386 { | 386 { |
| 387 RegistryOverrideManager override_manager; | 387 RegistryOverrideManager override_manager; |
| 388 override_manager.OverrideRegistry(root, L"root_inst_res"); | 388 override_manager.OverrideRegistry(root); |
| 389 CommandLine cmd_line = CommandLine::FromString(L"setup.exe --system-level"); | 389 CommandLine cmd_line = CommandLine::FromString(L"setup.exe --system-level"); |
| 390 const MasterPreferences prefs(cmd_line); | 390 const MasterPreferences prefs(cmd_line); |
| 391 InstallationState machine_state; | 391 InstallationState machine_state; |
| 392 machine_state.Initialize(); | 392 machine_state.Initialize(); |
| 393 InstallerState state; | 393 InstallerState state; |
| 394 state.Initialize(cmd_line, prefs, machine_state); | 394 state.Initialize(cmd_line, prefs, machine_state); |
| 395 state.WriteInstallerResult(installer::FIRST_INSTALL_SUCCESS, | 395 state.WriteInstallerResult(installer::FIRST_INSTALL_SUCCESS, |
| 396 IDS_INSTALL_OS_ERROR_BASE, &launch_cmd); | 396 IDS_INSTALL_OS_ERROR_BASE, &launch_cmd); |
| 397 BrowserDistribution* distribution = | 397 BrowserDistribution* distribution = |
| 398 BrowserDistribution::GetSpecificDistribution( | 398 BrowserDistribution::GetSpecificDistribution( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 409 key.ReadValue(installer::kInstallerResultUIString, &value)); | 409 key.ReadValue(installer::kInstallerResultUIString, &value)); |
| 410 EXPECT_FALSE(value.empty()); | 410 EXPECT_FALSE(value.empty()); |
| 411 EXPECT_EQ(ERROR_SUCCESS, | 411 EXPECT_EQ(ERROR_SUCCESS, |
| 412 key.ReadValue(installer::kInstallerSuccessLaunchCmdLine, &value)); | 412 key.ReadValue(installer::kInstallerSuccessLaunchCmdLine, &value)); |
| 413 EXPECT_EQ(launch_cmd, value); | 413 EXPECT_EQ(launch_cmd, value); |
| 414 } | 414 } |
| 415 | 415 |
| 416 // check results for a fresh install of multi Chrome | 416 // check results for a fresh install of multi Chrome |
| 417 { | 417 { |
| 418 RegistryOverrideManager override_manager; | 418 RegistryOverrideManager override_manager; |
| 419 override_manager.OverrideRegistry(root, L"root_inst_res"); | 419 override_manager.OverrideRegistry(root); |
| 420 CommandLine cmd_line = CommandLine::FromString( | 420 CommandLine cmd_line = CommandLine::FromString( |
| 421 L"setup.exe --system-level --multi-install --chrome"); | 421 L"setup.exe --system-level --multi-install --chrome"); |
| 422 const MasterPreferences prefs(cmd_line); | 422 const MasterPreferences prefs(cmd_line); |
| 423 InstallationState machine_state; | 423 InstallationState machine_state; |
| 424 machine_state.Initialize(); | 424 machine_state.Initialize(); |
| 425 InstallerState state; | 425 InstallerState state; |
| 426 state.Initialize(cmd_line, prefs, machine_state); | 426 state.Initialize(cmd_line, prefs, machine_state); |
| 427 state.WriteInstallerResult(installer::FIRST_INSTALL_SUCCESS, 0, | 427 state.WriteInstallerResult(installer::FIRST_INSTALL_SUCCESS, 0, |
| 428 &launch_cmd); | 428 &launch_cmd); |
| 429 BrowserDistribution* distribution = | 429 BrowserDistribution* distribution = |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 PathService::Get(base::DIR_PROGRAM_FILES, &temp); | 610 PathService::Get(base::DIR_PROGRAM_FILES, &temp); |
| 611 base::ScopedPathOverride program_files_override(base::DIR_PROGRAM_FILES, | 611 base::ScopedPathOverride program_files_override(base::DIR_PROGRAM_FILES, |
| 612 temp); | 612 temp); |
| 613 PathService::Get(base::DIR_PROGRAM_FILESX86, &temp); | 613 PathService::Get(base::DIR_PROGRAM_FILESX86, &temp); |
| 614 base::ScopedPathOverride program_filesx86_override(base::DIR_PROGRAM_FILESX86, | 614 base::ScopedPathOverride program_filesx86_override(base::DIR_PROGRAM_FILESX86, |
| 615 temp); | 615 temp); |
| 616 PathService::Get(base::DIR_LOCAL_APP_DATA, &temp); | 616 PathService::Get(base::DIR_LOCAL_APP_DATA, &temp); |
| 617 base::ScopedPathOverride local_app_data_override(base::DIR_LOCAL_APP_DATA, | 617 base::ScopedPathOverride local_app_data_override(base::DIR_LOCAL_APP_DATA, |
| 618 temp); | 618 temp); |
| 619 registry_util::RegistryOverrideManager override_manager; | 619 registry_util::RegistryOverrideManager override_manager; |
| 620 override_manager.OverrideRegistry(HKEY_CURRENT_USER, base::string16()); | 620 override_manager.OverrideRegistry(HKEY_CURRENT_USER); |
| 621 override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE, base::string16()); | 621 override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE); |
| 622 | 622 |
| 623 InstallationState machine_state; | 623 InstallationState machine_state; |
| 624 machine_state.Initialize(); | 624 machine_state.Initialize(); |
| 625 | 625 |
| 626 InstallerState installer_state; | 626 InstallerState installer_state; |
| 627 | 627 |
| 628 // Initialize the instance to install multi Chrome. | 628 // Initialize the instance to install multi Chrome. |
| 629 { | 629 { |
| 630 CommandLine cmd_line( | 630 CommandLine cmd_line( |
| 631 CommandLine::FromString(L"setup.exe --multi-install --chrome")); | 631 CommandLine::FromString(L"setup.exe --multi-install --chrome")); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 // Critical update newer than the new version. | 818 // Critical update newer than the new version. |
| 819 EXPECT_FALSE( | 819 EXPECT_FALSE( |
| 820 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); | 820 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); |
| 821 EXPECT_FALSE( | 821 EXPECT_FALSE( |
| 822 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) | 822 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) |
| 823 .IsValid()); | 823 .IsValid()); |
| 824 EXPECT_FALSE( | 824 EXPECT_FALSE( |
| 825 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) | 825 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) |
| 826 .IsValid()); | 826 .IsValid()); |
| 827 } | 827 } |
| OLD | NEW |