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

Side by Side Diff: chrome/installer/util/installer_state_unittest.cc

Issue 520863005: Revert of Fix ProductTest.ProductInstallBasic and InstallerStateTest.InitializeTwice flakes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@regtest
Patch Set: Created 6 years, 3 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 | « no previous file | chrome/installer/util/product_unittest.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 <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"
11 #include "base/files/file_enumerator.h" 11 #include "base/files/file_enumerator.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/test/scoped_path_override.h"
19 #include "base/test/test_reg_util_win.h" 18 #include "base/test/test_reg_util_win.h"
20 #include "base/version.h" 19 #include "base/version.h"
21 #include "base/win/registry.h" 20 #include "base/win/registry.h"
22 #include "base/win/scoped_handle.h" 21 #include "base/win/scoped_handle.h"
23 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
24 #include "chrome/installer/test/alternate_version_generator.h" 23 #include "chrome/installer/test/alternate_version_generator.h"
25 #include "chrome/installer/util/fake_installation_state.h" 24 #include "chrome/installer/util/fake_installation_state.h"
26 #include "chrome/installer/util/fake_product_state.h" 25 #include "chrome/installer/util/fake_product_state.h"
27 #include "chrome/installer/util/google_update_constants.h" 26 #include "chrome/installer/util/google_update_constants.h"
28 #include "chrome/installer/util/helper.h" 27 #include "chrome/installer/util/helper.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 596 }
598 } 597 }
599 598
600 std::set<std::string>::const_iterator iter( 599 std::set<std::string>::const_iterator iter(
601 expected_remaining_dirs.begin()); 600 expected_remaining_dirs.begin());
602 for (; iter != expected_remaining_dirs.end(); ++iter) 601 for (; iter != expected_remaining_dirs.end(); ++iter)
603 ADD_FAILURE() << "Expected to find version dir for " << *iter; 602 ADD_FAILURE() << "Expected to find version dir for " << *iter;
604 } 603 }
605 604
606 TEST_F(InstallerStateTest, InitializeTwice) { 605 TEST_F(InstallerStateTest, InitializeTwice) {
607 // Override these paths so that they can be found after the registry override
608 // manager is in place.
609 base::FilePath temp;
610 PathService::Get(base::DIR_PROGRAM_FILES, &temp);
611 base::ScopedPathOverride program_files_override(base::DIR_PROGRAM_FILES,
612 temp);
613 PathService::Get(base::DIR_PROGRAM_FILESX86, &temp);
614 base::ScopedPathOverride program_filesx86_override(base::DIR_PROGRAM_FILESX86,
615 temp);
616 registry_util::RegistryOverrideManager override_manager;
617 override_manager.OverrideRegistry(HKEY_CURRENT_USER, base::string16());
618 override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE, base::string16());
619
620 InstallationState machine_state; 606 InstallationState machine_state;
621 machine_state.Initialize(); 607 machine_state.Initialize();
622 608
623 InstallerState installer_state; 609 InstallerState installer_state;
624 610
625 // Initialize the instance to install multi Chrome. 611 // Initialize the instance to install multi Chrome.
626 { 612 {
627 CommandLine cmd_line( 613 CommandLine cmd_line(
628 CommandLine::FromString(L"setup.exe --multi-install --chrome")); 614 CommandLine::FromString(L"setup.exe --multi-install --chrome"));
629 MasterPreferences prefs(cmd_line); 615 MasterPreferences prefs(cmd_line);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 // Critical update newer than the new version. 801 // Critical update newer than the new version.
816 EXPECT_FALSE( 802 EXPECT_FALSE(
817 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); 803 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid());
818 EXPECT_FALSE( 804 EXPECT_FALSE(
819 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) 805 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_)
820 .IsValid()); 806 .IsValid());
821 EXPECT_FALSE( 807 EXPECT_FALSE(
822 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) 808 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_)
823 .IsValid()); 809 .IsValid());
824 } 810 }
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/util/product_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698