Commit af130f1b authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

installer: most remaining 'master' -> 'initial'

This change renames all remaining variables & updates all remaining
strings describing the master_preferences file except for strings/
variables/comments that are describing the filename on disk, which
remains unchanged. The next step in this work is to add support for
a new "initial_preferences" file, then deprecate support for the old
"master_preferences" file.

Bug: 1097209
Change-Id: I98ab16002669346239e9b7642302ad832429c3e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2551281Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830243}
parent d543ff67
......@@ -412,7 +412,7 @@ ProcessInitialPreferencesResult ProcessInitialPreferences(
return EULA_EXIT_NOW;
std::unique_ptr<base::DictionaryValue> initial_dictionary =
initial_prefs->master_dictionary().CreateDeepCopy();
initial_prefs->initial_dictionary().CreateDeepCopy();
// The distribution dictionary (and any prefs below it) are never registered
// for use in Chrome's PrefService. Strip them from the initial dictionary
// before mapping it to prefs.
......
......@@ -22,7 +22,7 @@ base::FilePath InitialPrefsPath() {
base::FilePath initial_prefs;
if (!base::PathService::Get(base::DIR_EXE, &initial_prefs))
return base::FilePath();
return initial_prefs.AppendASCII(installer::kDefaultMasterPrefs);
return initial_prefs.AppendASCII(installer::kDefaultInitialPrefs);
}
} // namespace internal
......
......@@ -157,7 +157,7 @@ base::FilePath InitialPrefsPath() {
base::FilePath initial_prefs;
if (!base::PathService::Get(base::DIR_EXE, &initial_prefs))
return base::FilePath();
return initial_prefs.AppendASCII(installer::kDefaultMasterPrefs);
return initial_prefs.AppendASCII(installer::kDefaultInitialPrefs);
}
} // namespace internal
......
......@@ -35,7 +35,7 @@ class FirstRunTest : public testing::Test {
TEST_F(FirstRunTest, SetupInitialPrefsFromInstallPrefs_NoVariationsSeed) {
installer::InitialPreferences install_prefs("{ }");
EXPECT_TRUE(install_prefs.master_dictionary().empty());
EXPECT_TRUE(install_prefs.initial_dictionary().empty());
EXPECT_TRUE(install_prefs.GetCompressedVariationsSeed().empty());
EXPECT_TRUE(install_prefs.GetVariationsSeedSignature().empty());
......@@ -46,12 +46,12 @@ TEST_F(FirstRunTest,
installer::InitialPreferences install_prefs(
"{\"variations_compressed_seed\":\"xyz\","
" \"variations_seed_signature\":\"abc\"}");
EXPECT_EQ(2U, install_prefs.master_dictionary().size());
EXPECT_EQ(2U, install_prefs.initial_dictionary().size());
EXPECT_EQ("xyz", install_prefs.GetCompressedVariationsSeed());
EXPECT_EQ("abc", install_prefs.GetVariationsSeedSignature());
// Variations prefs should have been extracted (removed) from the dictionary.
EXPECT_TRUE(install_prefs.master_dictionary().empty());
EXPECT_TRUE(install_prefs.initial_dictionary().empty());
}
// No switches and no sentinel present. This is the standard case for first run.
......
......@@ -148,9 +148,9 @@ void AddChromeToMediaPlayerList() {
void CopyPreferenceFileForFirstRun(const InstallerState& installer_state,
const base::FilePath& prefs_source_path) {
base::FilePath prefs_dest_path(
installer_state.target_path().AppendASCII(kDefaultMasterPrefs));
installer_state.target_path().AppendASCII(kDefaultInitialPrefs));
if (!base::CopyFile(prefs_source_path, prefs_dest_path)) {
VLOG(1) << "Failed to copy master preferences from:"
VLOG(1) << "Failed to copy initial preferences from:"
<< prefs_source_path.value() << " gle: " << ::GetLastError();
}
}
......@@ -578,7 +578,7 @@ void HandleOsUpgradeForBrowser(const InstallerState& installer_state,
// Read master_preferences copied beside chrome.exe at install.
const InitialPreferences prefs(
installer_state.target_path().AppendASCII(kDefaultMasterPrefs));
installer_state.target_path().AppendASCII(kDefaultInitialPrefs));
// Update shortcuts at this install level (per-user shortcuts on system-level
// installs will be updated through Active Setup).
......@@ -655,7 +655,7 @@ void HandleActiveSetupForBrowser(const InstallerState& installer_state,
// Read master_preferences copied beside chrome.exe at install for the sake of
// creating/updating shortcuts.
const base::FilePath installation_root = installer_state.target_path();
InitialPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
InitialPreferences prefs(installation_root.AppendASCII(kDefaultInitialPrefs));
base::FilePath chrome_exe(installation_root.Append(kChromeExe));
CreateOrUpdateShortcuts(chrome_exe, prefs, CURRENT_USER, install_operation);
......
......@@ -70,7 +70,7 @@ void CreateOrUpdateShortcuts(const base::FilePath& target,
// install status (failed, new_install, updated etc).
//
// install_params: See install_params.h
// prefs: master preferences. See chrome/installer/util/initial_preferences.h.
// prefs: initial preferences. See chrome/installer/util/initial_preferences.h.
//
// Note: since caller unpacks Chrome to install_temp_path\source, the caller
// is responsible for cleaning up install_temp_path.
......
......@@ -286,16 +286,16 @@ class InstallShortcutTest : public testing::Test {
do_not_create_quick_launch_shortcut},
};
std::string master_prefs("{\"distribution\":{");
std::string initial_prefs("{\"distribution\":{");
for (size_t i = 0; i < base::size(desired_prefs); ++i) {
master_prefs += (i == 0 ? "\"" : ",\"");
master_prefs += desired_prefs[i].pref_name;
master_prefs += "\":";
master_prefs += desired_prefs[i].is_desired ? "true" : "false";
initial_prefs += (i == 0 ? "\"" : ",\"");
initial_prefs += desired_prefs[i].pref_name;
initial_prefs += "\":";
initial_prefs += desired_prefs[i].is_desired ? "true" : "false";
}
master_prefs += "}}";
initial_prefs += "}}";
return new installer::InitialPreferences(master_prefs);
return new installer::InitialPreferences(initial_prefs);
}
base::win::ScopedCOMInitializer com_initializer_;
......
......@@ -26,7 +26,7 @@ class InstallationState;
class InitialPreferences;
// Encapsulates the state of the current installation operation. This class
// interprets the command-line arguments and master preferences and determines
// interprets the command-line arguments and initial preferences and determines
// the operations to be performed.
class InstallerState {
public:
......@@ -69,7 +69,7 @@ class InstallerState {
bool is_msi() const { return msi_; }
// True if the --verbose-logging command-line flag is set or if the
// verbose_logging master preferences option is true.
// verbose_logging initial preferences option is true.
bool verbose_logging() const { return verbose_logging_; }
HKEY root_key() const { return root_key_; }
......
......@@ -37,14 +37,14 @@ const install_static::InstallConstants* FindInstallMode(
void InitializeInstallDetails(
const base::CommandLine& command_line,
const installer::InitialPreferences& master_preferences) {
const installer::InitialPreferences& initial_preferences) {
install_static::InstallDetails::SetForProcess(
MakeInstallDetails(command_line, master_preferences));
MakeInstallDetails(command_line, initial_preferences));
}
std::unique_ptr<install_static::PrimaryInstallDetails> MakeInstallDetails(
const base::CommandLine& command_line,
const installer::InitialPreferences& master_preferences) {
const installer::InitialPreferences& initial_preferences) {
std::unique_ptr<install_static::PrimaryInstallDetails> details(
std::make_unique<install_static::PrimaryInstallDetails>());
......@@ -54,13 +54,13 @@ std::unique_ptr<install_static::PrimaryInstallDetails> MakeInstallDetails(
details->set_mode(mode);
// The install level may be set by any of:
// - distribution.system_level=true in master_preferences,
// - distribution.system_level=true in initial_preferences,
// - --system-level on the command line, or
// - the GoogleUpdateIsMachine=1 environment variable.
// In all three cases the value is sussed out in InitialPreferences
// initialization.
bool system_level = false;
master_preferences.GetBool(installer::initial_preferences::kSystemLevel,
initial_preferences.GetBool(installer::initial_preferences::kSystemLevel,
&system_level);
details->set_system_level(system_level);
......
......@@ -24,11 +24,11 @@ class InitialPreferences;
// global InstallDetails for the process.
void InitializeInstallDetails(
const base::CommandLine& command_line,
const installer::InitialPreferences& master_preferences);
const installer::InitialPreferences& initial_preferences);
// Returns a PrimaryInstallDetails instance for the installer.
std::unique_ptr<install_static::PrimaryInstallDetails> MakeInstallDetails(
const base::CommandLine& command_line,
const installer::InitialPreferences& master_preferences);
const installer::InitialPreferences& initial_preferences);
#endif // CHROME_INSTALLER_SETUP_SETUP_INSTALL_DETAILS_H_
......@@ -453,7 +453,7 @@ class MakeInstallDetailsTest : public testing::TestWithParam<TestData> {
command_line_(base::CommandLine::NO_PROGRAM) {
// Prepare the inputs from the process command line.
command_line_.ParseFromString(test_data_.command_line);
master_preferences_ =
initial_preferences_ =
std::make_unique<installer::InitialPreferences>(command_line_);
}
......@@ -482,8 +482,8 @@ class MakeInstallDetailsTest : public testing::TestWithParam<TestData> {
const base::CommandLine& command_line() const { return command_line_; }
const installer::InitialPreferences& master_preferences() const {
return *master_preferences_;
const installer::InitialPreferences& initial_preferences() const {
return *initial_preferences_;
}
private:
......@@ -528,14 +528,14 @@ class MakeInstallDetailsTest : public testing::TestWithParam<TestData> {
HKEY root_key_;
nt::ROOT_KEY nt_root_key_;
base::CommandLine command_line_;
std::unique_ptr<installer::InitialPreferences> master_preferences_;
std::unique_ptr<installer::InitialPreferences> initial_preferences_;
DISALLOW_COPY_AND_ASSIGN(MakeInstallDetailsTest);
};
TEST_P(MakeInstallDetailsTest, Test) {
std::unique_ptr<install_static::PrimaryInstallDetails> details(
MakeInstallDetails(command_line(), master_preferences()));
MakeInstallDetails(command_line(), initial_preferences()));
EXPECT_THAT(details->install_mode_index(), Eq(test_data().index));
EXPECT_THAT(details->system_level(), Eq(test_data().system_level));
EXPECT_THAT(details->channel(), Eq(test_data().channel));
......
......@@ -678,14 +678,14 @@ installer::InstallStatus InstallProducts(InstallationState& original_state,
DCHECK_NE(install_status, installer::UNKNOWN_STATUS);
}
// Delete the master preferences file if present. Note that we do not care
// Delete the initial preferences file if present. Note that we do not care
// about rollback here and we schedule for deletion on reboot if the delete
// fails. As such, we do not use DeleteTreeWorkItem.
if (cmd_line.HasSwitch(installer::switches::kInstallerData)) {
base::FilePath prefs_path(
cmd_line.GetSwitchValuePath(installer::switches::kInstallerData));
if (!base::DeleteFile(prefs_path)) {
LOG(ERROR) << "Failed deleting master preferences file "
LOG(ERROR) << "Failed deleting initial preferences file "
<< prefs_path.value()
<< ", scheduling for deletion after reboot.";
ScheduleFileSystemEntityForDeletion(prefs_path);
......@@ -1233,13 +1233,13 @@ InstallStatus InstallProductsHelper(InstallationState& original_state,
// If the installation completed successfully...
if (InstallUtil::GetInstallReturnCode(install_status) == 0) {
// Update the DisplayVersion created by an MSI-based install.
base::FilePath master_preferences_file(
base::FilePath initial_preferences_file(
installer_state.target_path().AppendASCII(
installer::kDefaultMasterPrefs));
installer::kDefaultInitialPrefs));
std::string install_id;
if (prefs.GetString(installer::initial_preferences::kMsiProductId,
&install_id)) {
// A currently active MSI install will have specified the master-
// A currently active MSI install will have specified the initial-
// preferences file on the command-line that includes the product-id.
// We must delay the setting of the DisplayVersion until after the
// grandparent "msiexec" process has exited.
......
......@@ -20,7 +20,7 @@ namespace installer {
std::unique_ptr<SetupSingleton> SetupSingleton::Acquire(
const base::CommandLine& command_line,
const InitialPreferences& master_preferences,
const InitialPreferences& initial_preferences,
InstallationState* original_state,
InstallerState* installer_state) {
DCHECK(original_state);
......@@ -84,7 +84,7 @@ std::unique_ptr<SetupSingleton> SetupSingleton::Acquire(
// Update |original_state| and |installer_state|.
original_state->Initialize();
installer_state->Initialize(command_line, master_preferences,
installer_state->Initialize(command_line, initial_preferences,
*original_state);
// UMA data indicates that this method succeeds > 99% of the time.
......
......@@ -34,11 +34,11 @@ class SetupSingleton {
// process the exclusive right to modify the Chrome installation described by
// |installer_state| (installation directory and associated registry keys).
// May block. |original_state| and |installer_state| are updated using
// |command_line| and |master_preferences| to reflect the new state of the
// |command_line| and |initial_preferences| to reflect the new state of the
// installation after acquisition. Returns nullptr on failure.
static std::unique_ptr<SetupSingleton> Acquire(
const base::CommandLine& command_line,
const InitialPreferences& master_preferences,
const InitialPreferences& initial_preferences,
InstallationState* original_state,
InstallerState* installer_state);
......
......@@ -334,14 +334,14 @@ void BeginUserExperiment(const InstallerState& installer_state,
// setup.exe immediately after a successful update or following user logon as a
// result of Active Setup.
void RunUserExperiment(const base::CommandLine& command_line,
const InitialPreferences& master_preferences,
const InitialPreferences& initial_preferences,
InstallationState* original_state,
InstallerState* installer_state) {
VLOG(1) << __func__;
ExperimentStorage storage;
std::unique_ptr<SetupSingleton> setup_singleton(SetupSingleton::Acquire(
command_line, master_preferences, original_state, installer_state));
command_line, initial_preferences, original_state, installer_state));
if (!setup_singleton) {
VLOG(1) << "Timed out while waiting for setup singleton";
WriteInitialState(&storage, ExperimentMetrics::kSingletonWaitTimeout);
......
......@@ -38,7 +38,7 @@ void BeginUserExperiment(const InstallerState& installer_state,
// Runs the experiment for the current user.
void RunUserExperiment(const base::CommandLine& command_line,
const InitialPreferences& master_preferences,
const InitialPreferences& initial_preferences,
InstallationState* original_state,
InstallerState* installer_state);
......
......@@ -27,7 +27,7 @@ namespace {
const char kFirstRunTabs[] = "first_run_tabs";
base::LazyInstance<installer::InitialPreferences>::DestructorAtExit
g_master_preferences = LAZY_INSTANCE_INITIALIZER;
g_initial_preferences = LAZY_INSTANCE_INITIALIZER;
bool GetURLFromValue(const base::Value* in_value, std::string* out_value) {
return in_value && out_value && in_value->GetAsString(out_value);
......@@ -62,11 +62,11 @@ base::DictionaryValue* ParseDistributionPreferences(
std::string error;
std::unique_ptr<base::Value> root(json.Deserialize(nullptr, &error));
if (!root.get()) {
LOG(WARNING) << "Failed to parse master prefs file: " << error;
LOG(WARNING) << "Failed to parse initial prefs file: " << error;
return nullptr;
}
if (!root->is_dict()) {
LOG(WARNING) << "Failed to parse master prefs file: "
LOG(WARNING) << "Failed to parse initial prefs file: "
<< "Root item must be a dictionary.";
return nullptr;
}
......@@ -103,10 +103,10 @@ void InitialPreferences::InitializeFromCommandLine(
cmd_line.GetSwitchValuePath(installer::switches::kInstallerData));
InitializeFromFilePath(prefs_path);
} else {
master_dictionary_.reset(new base::DictionaryValue());
initial_dictionary_.reset(new base::DictionaryValue());
}
DCHECK(master_dictionary_.get());
DCHECK(initial_dictionary_.get());
// A simple map from command line switches to equivalent switches in the
// distribution dictionary. Currently all switches added will be set to
......@@ -137,7 +137,7 @@ void InitialPreferences::InitializeFromCommandLine(
if (cmd_line.HasSwitch(translate_switches[i].cmd_line_switch)) {
name.assign(installer::initial_preferences::kDistroDict);
name.append(".").append(translate_switches[i].distribution_switch);
master_dictionary_->SetBoolean(name, true);
initial_dictionary_->SetBoolean(name, true);
}
}
......@@ -147,7 +147,7 @@ void InitialPreferences::InitializeFromCommandLine(
if (!str_value.empty()) {
name.assign(installer::initial_preferences::kDistroDict);
name.append(".").append(installer::initial_preferences::kLogFile);
master_dictionary_->SetString(name, str_value);
initial_dictionary_->SetString(name, str_value);
}
// Handle the special case of --system-level being implied by the presence of
......@@ -160,13 +160,13 @@ void InitialPreferences::InitializeFromCommandLine(
VLOG(1) << "Taking system-level from environment.";
name.assign(installer::initial_preferences::kDistroDict);
name.append(".").append(installer::initial_preferences::kSystemLevel);
master_dictionary_->SetBoolean(name, true);
initial_dictionary_->SetBoolean(name, true);
}
}
// Cache a pointer to the distribution dictionary. Ignore errors if any.
master_dictionary_->GetDictionary(installer::initial_preferences::kDistroDict,
&distribution_);
initial_dictionary_->GetDictionary(
installer::initial_preferences::kDistroDict, &distribution_);
#endif
}
......@@ -186,15 +186,15 @@ void InitialPreferences::InitializeFromFilePath(
bool InitialPreferences::InitializeFromString(const std::string& json_data) {
if (!json_data.empty())
master_dictionary_.reset(ParseDistributionPreferences(json_data));
initial_dictionary_.reset(ParseDistributionPreferences(json_data));
bool data_is_valid = true;
if (!master_dictionary_.get()) {
master_dictionary_.reset(new base::DictionaryValue());
if (!initial_dictionary_.get()) {
initial_dictionary_.reset(new base::DictionaryValue());
data_is_valid = false;
} else {
// Cache a pointer to the distribution dictionary.
master_dictionary_->GetDictionary(
initial_dictionary_->GetDictionary(
installer::initial_preferences::kDistroDict, &distribution_);
}
......@@ -221,8 +221,8 @@ void InitialPreferences::EnforceLegacyPreferences() {
installer::initial_preferences::kDoNotCreateQuickLaunchShortcut, true);
}
// Deprecated boolean import master preferences now mapped to their duplicates
// in prefs::.
// Deprecated boolean import initial preferences now mapped to their
// duplicates in prefs::.
static constexpr char kDistroImportHistoryPref[] = "import_history";
static constexpr char kDistroImportHomePagePref[] = "import_home_page";
static constexpr char kDistroImportSearchPref[] = "import_search_engine";
......@@ -241,7 +241,7 @@ void InitialPreferences::EnforceLegacyPreferences() {
for (const auto& mapping : kLegacyDistroImportPrefMappings) {
bool value = false;
if (GetBool(mapping.old_distro_pref_path, &value))
master_dictionary_->SetBoolean(mapping.modern_pref_path, value);
initial_dictionary_->SetBoolean(mapping.modern_pref_path, value);
}
#if BUILDFLAG(ENABLE_RLZ)
......@@ -250,7 +250,8 @@ void InitialPreferences::EnforceLegacyPreferences() {
static constexpr char kDistroPingDelay[] = "ping_delay";
int rlz_ping_delay = 0;
if (GetInt(kDistroPingDelay, &rlz_ping_delay))
master_dictionary_->SetInteger(prefs::kRlzPingDelaySeconds, rlz_ping_delay);
initial_dictionary_->SetInteger(prefs::kRlzPingDelaySeconds,
rlz_ping_delay);
#endif // BUILDFLAG(ENABLE_RLZ)
}
......@@ -277,12 +278,12 @@ bool InitialPreferences::GetString(const std::string& name,
}
std::vector<std::string> InitialPreferences::GetFirstRunTabs() const {
return GetNamedList(kFirstRunTabs, master_dictionary_.get());
return GetNamedList(kFirstRunTabs, initial_dictionary_.get());
}
bool InitialPreferences::GetExtensionsBlock(
base::DictionaryValue** extensions) const {
return master_dictionary_->GetDictionary(
return initial_dictionary_->GetDictionary(
initial_preferences::kExtensionsBlock, extensions);
}
......@@ -298,7 +299,7 @@ std::string InitialPreferences::ExtractPrefString(
const std::string& name) const {
std::string result;
std::unique_ptr<base::Value> pref_value;
if (master_dictionary_->Remove(name, &pref_value)) {
if (initial_dictionary_->Remove(name, &pref_value)) {
if (!pref_value->GetAsString(&result))
NOTREACHED();
}
......@@ -307,7 +308,7 @@ std::string InitialPreferences::ExtractPrefString(
// static
const InitialPreferences& InitialPreferences::ForCurrentProcess() {
return g_master_preferences.Get();
return g_initial_preferences.Get();
}
} // namespace installer
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file contains functions processing master preference file used by
// This file contains functions processing initial preference file used by
// setup and first run.
#ifndef CHROME_INSTALLER_UTIL_INITIAL_PREFERENCES_H_
......@@ -24,12 +24,12 @@ class FilePath;
namespace installer {
#if !defined(OS_MAC)
// This is the default name for the master preferences file used to pre-set
// This is the default name for the initial preferences file used to pre-set
// values in the user profile at first run.
const char kDefaultMasterPrefs[] = "master_preferences";
const char kDefaultInitialPrefs[] = "master_preferences";
#endif
// The master preferences is a JSON file with the same entries as the
// The initial preferences is a JSON file with the same entries as the
// 'Default\Preferences' file. This function parses the distribution
// section of the preferences file.
//
......@@ -75,12 +75,12 @@ const char kDefaultMasterPrefs[] = "master_preferences";
class InitialPreferences {
public:
// Construct a master preferences from the current process' current command
// Construct a initial preferences from the current process' current command
// line. Equivalent to calling
// InitialPreferences(*CommandLine::ForCurrentProcess()).
InitialPreferences();
// Parses the command line and optionally reads the master preferences file
// Parses the command line and optionally reads the initial preferences file
// to get distribution related install options (if the "installerdata" switch
// is present in the command line.
// The options from the preference file and command line are merged, with the
......@@ -104,7 +104,7 @@ class InitialPreferences {
bool GetInt(const std::string& name, int* value) const;
bool GetString(const std::string& name, std::string* value) const;
// As part of the master preferences an optional section indicates the tabs
// As part of the initial preferences an optional section indicates the tabs
// to open during first run. An example is the following:
//
// {
......@@ -119,10 +119,10 @@ class InitialPreferences {
// An empty vector is returned if the first_run_tabs preference is absent.
std::vector<std::string> GetFirstRunTabs() const;
// The master preferences can also contain a regular extensions
// The initial preferences can also contain a regular extensions
// preference block. If so, the extensions referenced there will be
// installed during the first run experience.
// An extension can go in the master prefs needs just the basic
// An extension can go in the initial prefs needs just the basic
// elements such as:
// 1- An extension entry under settings, assigned by the gallery
// 2- The "location" : 1 entry
......@@ -132,7 +132,7 @@ class InitialPreferences {
// 4- The "path" entry with the version as last component
// 5- The "state" : 1 entry
//
// The following is an example of a master pref file that installs
// The following is an example of a initial pref file that installs
// Google XYZ:
//
// {
......@@ -156,18 +156,19 @@ class InitialPreferences {
//
bool GetExtensionsBlock(base::DictionaryValue** extensions) const;
// Returns the compressed variations seed entry from the master prefs.
// Returns the compressed variations seed entry from the initial prefs.
std::string GetCompressedVariationsSeed() const;
// Returns the variations seed signature entry from the master prefs.
// Returns the variations seed signature entry from the initial prefs.
std::string GetVariationsSeedSignature() const;
// Returns true iff the master preferences were successfully read from a file.
// Returns true iff the initial preferences were successfully read from a
// file.
bool read_from_file() const { return preferences_read_from_file_; }
// Returns a reference to this InitialPreferences' root dictionary of values.
const base::DictionaryValue& master_dictionary() const {
return *master_dictionary_.get();
const base::DictionaryValue& initial_dictionary() const {
return *initial_dictionary_.get();
}
// Returns a static preference object that has been initialized with the
......@@ -188,12 +189,12 @@ class InitialPreferences {
// found in older master_preferences files.
void EnforceLegacyPreferences();
// Removes the specified string pref from the master preferences and returns
// its value. Should be used for master prefs that shouldn't be automatically
// Removes the specified string pref from the initial preferences and returns
// its value. Should be used for initial prefs that shouldn't be automatically
// copied over to profile preferences.
std::string ExtractPrefString(const std::string& name) const;
std::unique_ptr<base::DictionaryValue> master_dictionary_;
std::unique_ptr<base::DictionaryValue> initial_dictionary_;
base::DictionaryValue* distribution_ = nullptr;
bool preferences_read_from_file_ = false;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Unit tests for master preferences related methods.
// Unit tests for initial preferences related methods.
#include "chrome/installer/util/initial_preferences.h"
......@@ -221,7 +221,7 @@ TEST(MasterPrefsExtension, ValidateExtensionJSON) {
"behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.version", &version));
}
// Test that we are parsing master preferences correctly.
// Test that we are parsing initial preferences correctly.
TEST_F(InitialPreferencesTest, GetInstallPreferencesTest) {
// Create a temporary prefs file.
base::FilePath prefs_file;
......@@ -239,7 +239,7 @@ TEST_F(InitialPreferencesTest, GetInstallPreferencesTest) {
EXPECT_TRUE(
base::WriteFile(prefs_file, text, static_cast<int>(strlen(text))));
// Make sure command line values override the values in master preferences.
// Make sure command line values override the values in initial preferences.
std::wstring cmd_str(L"setup.exe --installerdata=\"" + prefs_file.value() +
L"\"");
cmd_str.append(L" --do-not-launch-chrome");
......@@ -263,7 +263,7 @@ TEST_F(InitialPreferencesTest, GetInstallPreferencesTest) {
// Delete temporary prefs file.
EXPECT_TRUE(base::DeleteFile(prefs_file));
// Check that if master prefs doesn't exist, we can still parse the common
// Check that if initial prefs doesn't exist, we can still parse the common
// prefs.
cmd_str = L"setup.exe --do-not-launch-chrome";
cmd_line.ParseFromString(cmd_str);
......@@ -326,22 +326,22 @@ TEST_F(InitialPreferencesTest, EnforceLegacyPreferences) {
EXPECT_FALSE(do_not_create_taskbar_shortcut);
bool actual_value = false;
EXPECT_TRUE(prefs.master_dictionary().GetBoolean(prefs::kImportBookmarks,
EXPECT_TRUE(prefs.initial_dictionary().GetBoolean(prefs::kImportBookmarks,
&actual_value));
EXPECT_TRUE(actual_value);
EXPECT_TRUE(prefs.master_dictionary().GetBoolean(prefs::kImportHistory,
EXPECT_TRUE(prefs.initial_dictionary().GetBoolean(prefs::kImportHistory,
&actual_value));
EXPECT_TRUE(actual_value);
EXPECT_TRUE(prefs.master_dictionary().GetBoolean(prefs::kImportHomepage,
EXPECT_TRUE(prefs.initial_dictionary().GetBoolean(prefs::kImportHomepage,
&actual_value));
EXPECT_TRUE(actual_value);
EXPECT_TRUE(prefs.master_dictionary().GetBoolean(prefs::kImportSearchEngine,
EXPECT_TRUE(prefs.initial_dictionary().GetBoolean(prefs::kImportSearchEngine,
&actual_value));
EXPECT_TRUE(actual_value);
#if BUILDFLAG(ENABLE_RLZ)
int rlz_ping_delay = 0;
EXPECT_TRUE(prefs.master_dictionary().GetInteger(prefs::kRlzPingDelaySeconds,
EXPECT_TRUE(prefs.initial_dictionary().GetInteger(prefs::kRlzPingDelaySeconds,
&rlz_ping_delay));
EXPECT_EQ(40, rlz_ping_delay);
#endif // BUILDFLAG(ENABLE_RLZ)
......
......@@ -76,7 +76,7 @@ const char kInputFile[] = "input-file";
// of an uncompressed archive).
const char kInstallArchive[] = "install-archive";
// Specify the file path of Chrome master preference file.
// Specify the file path of Chrome initial preference file.
const char kInstallerData[] = "installerdata";
// If present, specify file path to write logging info.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment