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

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

Issue 521703002: Fix ProductTest.ProductInstallBasic and InstallerStateTest.InitializeTwice flakes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@regtest
Patch Set: robertshield fix 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"
18 #include "base/test/test_reg_util_win.h" 19 #include "base/test/test_reg_util_win.h"
19 #include "base/version.h" 20 #include "base/version.h"
20 #include "base/win/registry.h" 21 #include "base/win/registry.h"
21 #include "base/win/scoped_handle.h" 22 #include "base/win/scoped_handle.h"
22 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
23 #include "chrome/installer/test/alternate_version_generator.h" 24 #include "chrome/installer/test/alternate_version_generator.h"
24 #include "chrome/installer/util/fake_installation_state.h" 25 #include "chrome/installer/util/fake_installation_state.h"
25 #include "chrome/installer/util/fake_product_state.h" 26 #include "chrome/installer/util/fake_product_state.h"
26 #include "chrome/installer/util/google_update_constants.h" 27 #include "chrome/installer/util/google_update_constants.h"
27 #include "chrome/installer/util/helper.h" 28 #include "chrome/installer/util/helper.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 597 }
597 } 598 }
598 599
599 std::set<std::string>::const_iterator iter( 600 std::set<std::string>::const_iterator iter(
600 expected_remaining_dirs.begin()); 601 expected_remaining_dirs.begin());
601 for (; iter != expected_remaining_dirs.end(); ++iter) 602 for (; iter != expected_remaining_dirs.end(); ++iter)
602 ADD_FAILURE() << "Expected to find version dir for " << *iter; 603 ADD_FAILURE() << "Expected to find version dir for " << *iter;
603 } 604 }
604 605
605 TEST_F(InstallerStateTest, InitializeTwice) { 606 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::ScopedPathOverride program_files_override(
610 base::DIR_PROGRAM_FILES,
611 base::FilePath(FILE_PATH_LITERAL("C:\\Program Files (x86)")));
robertshield 2014/08/29 19:08:40 Should this path not contain the (x86) bit? Also,
grt (UTC plus 2) 2014/08/29 19:13:07 Ultimately, it doesn't matter what the strings are
612 base::ScopedPathOverride program_filesx86_override(
613 base::DIR_PROGRAM_FILESX86,
614 base::FilePath(FILE_PATH_LITERAL("C:\\Program Files (x86)")));
615 registry_util::RegistryOverrideManager override_manager;
616 override_manager.OverrideRegistry(HKEY_CURRENT_USER, base::string16());
617 override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE, base::string16());
618
606 InstallationState machine_state; 619 InstallationState machine_state;
607 machine_state.Initialize(); 620 machine_state.Initialize();
608 621
609 InstallerState installer_state; 622 InstallerState installer_state;
610 623
611 // Initialize the instance to install multi Chrome. 624 // Initialize the instance to install multi Chrome.
612 { 625 {
613 CommandLine cmd_line( 626 CommandLine cmd_line(
614 CommandLine::FromString(L"setup.exe --multi-install --chrome")); 627 CommandLine::FromString(L"setup.exe --multi-install --chrome"));
615 MasterPreferences prefs(cmd_line); 628 MasterPreferences prefs(cmd_line);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 // Critical update newer than the new version. 814 // Critical update newer than the new version.
802 EXPECT_FALSE( 815 EXPECT_FALSE(
803 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); 816 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid());
804 EXPECT_FALSE( 817 EXPECT_FALSE(
805 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) 818 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_)
806 .IsValid()); 819 .IsValid());
807 EXPECT_FALSE( 820 EXPECT_FALSE(
808 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) 821 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_)
809 .IsValid()); 822 .IsValid());
810 } 823 }
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