| 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 // Implementation of the installation validator. | 5 // Implementation of the installation validator. |
| 6 | 6 |
| 7 #include "chrome/installer/util/installation_validator.h" | 7 #include "chrome/installer/util/installation_validator.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 CHROME_APP_HOST_CHROME_FRAME_SINGLE, | 162 CHROME_APP_HOST_CHROME_FRAME_SINGLE, |
| 163 CHROME_APP_HOST_CHROME_FRAME_SINGLE_CHROME_MULTI, | 163 CHROME_APP_HOST_CHROME_FRAME_SINGLE_CHROME_MULTI, |
| 164 CHROME_APP_HOST_CHROME_FRAME_MULTI, | 164 CHROME_APP_HOST_CHROME_FRAME_MULTI, |
| 165 CHROME_APP_HOST_CHROME_FRAME_MULTI_CHROME_MULTI, | 165 CHROME_APP_HOST_CHROME_FRAME_MULTI_CHROME_MULTI, |
| 166 CHROME_APP_HOST_CHROME_MULTI, | 166 CHROME_APP_HOST_CHROME_MULTI, |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 void InstallationValidator::ValidateAppCommandFlags( | 169 void InstallationValidator::ValidateAppCommandFlags( |
| 170 const ProductContext& ctx, | 170 const ProductContext& ctx, |
| 171 const AppCommand& app_cmd, | 171 const AppCommand& app_cmd, |
| 172 const std::set<string16>& flags_exp, | 172 const std::set<base::string16>& flags_exp, |
| 173 const string16& name, | 173 const base::string16& name, |
| 174 bool* is_valid) { | 174 bool* is_valid) { |
| 175 const struct { | 175 const struct { |
| 176 const string16 exp_key; | 176 const base::string16 exp_key; |
| 177 bool val; | 177 bool val; |
| 178 const char* msg; | 178 const char* msg; |
| 179 } check_list[] = { | 179 } check_list[] = { |
| 180 {google_update::kRegSendsPingsField, | 180 {google_update::kRegSendsPingsField, |
| 181 app_cmd.sends_pings(), | 181 app_cmd.sends_pings(), |
| 182 "be configured to send pings"}, | 182 "be configured to send pings"}, |
| 183 {google_update::kRegWebAccessibleField, | 183 {google_update::kRegWebAccessibleField, |
| 184 app_cmd.is_web_accessible(), | 184 app_cmd.is_web_accessible(), |
| 185 "be web accessible"}, | 185 "be web accessible"}, |
| 186 {google_update::kRegAutoRunOnOSUpgradeField, | 186 {google_update::kRegAutoRunOnOSUpgradeField, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 206 void InstallationValidator::ValidateInstallCommand( | 206 void InstallationValidator::ValidateInstallCommand( |
| 207 const ProductContext& ctx, | 207 const ProductContext& ctx, |
| 208 const AppCommand& app_cmd, | 208 const AppCommand& app_cmd, |
| 209 const wchar_t* expected_command, | 209 const wchar_t* expected_command, |
| 210 const wchar_t* expected_app_name, | 210 const wchar_t* expected_app_name, |
| 211 const char* expected_switch, | 211 const char* expected_switch, |
| 212 bool* is_valid) { | 212 bool* is_valid) { |
| 213 DCHECK(is_valid); | 213 DCHECK(is_valid); |
| 214 | 214 |
| 215 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); | 215 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); |
| 216 string16 name(expected_command); | 216 base::string16 name(expected_command); |
| 217 | 217 |
| 218 base::FilePath expected_path( | 218 base::FilePath expected_path( |
| 219 installer::GetChromeInstallPath(ctx.system_install, ctx.dist) | 219 installer::GetChromeInstallPath(ctx.system_install, ctx.dist) |
| 220 .Append(expected_app_name)); | 220 .Append(expected_app_name)); |
| 221 | 221 |
| 222 if (!base::FilePath::CompareEqualIgnoreCase(expected_path.value(), | 222 if (!base::FilePath::CompareEqualIgnoreCase(expected_path.value(), |
| 223 cmd_line.GetProgram().value())) { | 223 cmd_line.GetProgram().value())) { |
| 224 *is_valid = false; | 224 *is_valid = false; |
| 225 LOG(ERROR) << name << "'s path is not " | 225 LOG(ERROR) << name << "'s path is not " |
| 226 << expected_path.value() << ": " | 226 << expected_path.value() << ": " |
| 227 << cmd_line.GetProgram().value(); | 227 << cmd_line.GetProgram().value(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 SwitchExpectations expected; | 230 SwitchExpectations expected; |
| 231 expected.push_back(std::make_pair(std::string(expected_switch), true)); | 231 expected.push_back(std::make_pair(std::string(expected_switch), true)); |
| 232 | 232 |
| 233 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); | 233 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); |
| 234 | 234 |
| 235 std::set<string16> flags_exp; | 235 std::set<base::string16> flags_exp; |
| 236 flags_exp.insert(google_update::kRegSendsPingsField); | 236 flags_exp.insert(google_update::kRegSendsPingsField); |
| 237 flags_exp.insert(google_update::kRegWebAccessibleField); | 237 flags_exp.insert(google_update::kRegWebAccessibleField); |
| 238 flags_exp.insert(google_update::kRegRunAsUserField); | 238 flags_exp.insert(google_update::kRegRunAsUserField); |
| 239 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); | 239 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); |
| 240 } | 240 } |
| 241 | 241 |
| 242 // Validates the "install-application" Google Update product command. | 242 // Validates the "install-application" Google Update product command. |
| 243 void InstallationValidator::ValidateInstallAppCommand( | 243 void InstallationValidator::ValidateInstallAppCommand( |
| 244 const ProductContext& ctx, | 244 const ProductContext& ctx, |
| 245 const AppCommand& app_cmd, | 245 const AppCommand& app_cmd, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 260 } | 260 } |
| 261 | 261 |
| 262 // Validates the "on-os-upgrade" Google Update internal command. | 262 // Validates the "on-os-upgrade" Google Update internal command. |
| 263 void InstallationValidator::ValidateOnOsUpgradeCommand( | 263 void InstallationValidator::ValidateOnOsUpgradeCommand( |
| 264 const ProductContext& ctx, | 264 const ProductContext& ctx, |
| 265 const AppCommand& app_cmd, | 265 const AppCommand& app_cmd, |
| 266 bool* is_valid) { | 266 bool* is_valid) { |
| 267 DCHECK(is_valid); | 267 DCHECK(is_valid); |
| 268 | 268 |
| 269 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); | 269 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); |
| 270 string16 name(kCmdOnOsUpgrade); | 270 base::string16 name(kCmdOnOsUpgrade); |
| 271 | 271 |
| 272 ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); | 272 ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); |
| 273 | 273 |
| 274 SwitchExpectations expected; | 274 SwitchExpectations expected; |
| 275 expected.push_back(std::make_pair(std::string(switches::kOnOsUpgrade), true)); | 275 expected.push_back(std::make_pair(std::string(switches::kOnOsUpgrade), true)); |
| 276 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), | 276 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), |
| 277 ctx.system_install)); | 277 ctx.system_install)); |
| 278 expected.push_back(std::make_pair(std::string(switches::kMultiInstall), | 278 expected.push_back(std::make_pair(std::string(switches::kMultiInstall), |
| 279 ctx.state.is_multi_install())); | 279 ctx.state.is_multi_install())); |
| 280 // Expecting kChrome if and only if kMultiInstall. | 280 // Expecting kChrome if and only if kMultiInstall. |
| 281 expected.push_back(std::make_pair(std::string(switches::kChrome), | 281 expected.push_back(std::make_pair(std::string(switches::kChrome), |
| 282 ctx.state.is_multi_install())); | 282 ctx.state.is_multi_install())); |
| 283 | 283 |
| 284 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); | 284 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); |
| 285 | 285 |
| 286 std::set<string16> flags_exp; | 286 std::set<base::string16> flags_exp; |
| 287 flags_exp.insert(google_update::kRegAutoRunOnOSUpgradeField); | 287 flags_exp.insert(google_update::kRegAutoRunOnOSUpgradeField); |
| 288 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); | 288 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // Validates the "query-eula-acceptance" Google Update product command. | 291 // Validates the "query-eula-acceptance" Google Update product command. |
| 292 void InstallationValidator::ValidateQueryEULAAcceptanceCommand( | 292 void InstallationValidator::ValidateQueryEULAAcceptanceCommand( |
| 293 const ProductContext& ctx, | 293 const ProductContext& ctx, |
| 294 const AppCommand& app_cmd, | 294 const AppCommand& app_cmd, |
| 295 bool* is_valid) { | 295 bool* is_valid) { |
| 296 DCHECK(is_valid); | 296 DCHECK(is_valid); |
| 297 | 297 |
| 298 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); | 298 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); |
| 299 string16 name(kCmdQueryEULAAcceptance); | 299 base::string16 name(kCmdQueryEULAAcceptance); |
| 300 | 300 |
| 301 ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); | 301 ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); |
| 302 | 302 |
| 303 SwitchExpectations expected; | 303 SwitchExpectations expected; |
| 304 expected.push_back(std::make_pair(std::string(switches::kQueryEULAAcceptance), | 304 expected.push_back(std::make_pair(std::string(switches::kQueryEULAAcceptance), |
| 305 true)); | 305 true)); |
| 306 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), | 306 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), |
| 307 ctx.system_install)); | 307 ctx.system_install)); |
| 308 | 308 |
| 309 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); | 309 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); |
| 310 | 310 |
| 311 std::set<string16> flags_exp; | 311 std::set<base::string16> flags_exp; |
| 312 flags_exp.insert(google_update::kRegWebAccessibleField); | 312 flags_exp.insert(google_update::kRegWebAccessibleField); |
| 313 flags_exp.insert(google_update::kRegRunAsUserField); | 313 flags_exp.insert(google_update::kRegRunAsUserField); |
| 314 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); | 314 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); |
| 315 } | 315 } |
| 316 | 316 |
| 317 // Validates the "quick-enable-application-host" Google Update product command. | 317 // Validates the "quick-enable-application-host" Google Update product command. |
| 318 void InstallationValidator::ValidateQuickEnableApplicationHostCommand( | 318 void InstallationValidator::ValidateQuickEnableApplicationHostCommand( |
| 319 const ProductContext& ctx, | 319 const ProductContext& ctx, |
| 320 const AppCommand& app_cmd, | 320 const AppCommand& app_cmd, |
| 321 bool* is_valid) { | 321 bool* is_valid) { |
| 322 DCHECK(is_valid); | 322 DCHECK(is_valid); |
| 323 | 323 |
| 324 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); | 324 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); |
| 325 string16 name(kCmdQuickEnableApplicationHost); | 325 base::string16 name(kCmdQuickEnableApplicationHost); |
| 326 | 326 |
| 327 ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); | 327 ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); |
| 328 | 328 |
| 329 SwitchExpectations expected; | 329 SwitchExpectations expected; |
| 330 | 330 |
| 331 expected.push_back(std::make_pair( | 331 expected.push_back(std::make_pair( |
| 332 std::string(switches::kChromeAppLauncher), true)); | 332 std::string(switches::kChromeAppLauncher), true)); |
| 333 expected.push_back(std::make_pair( | 333 expected.push_back(std::make_pair( |
| 334 std::string(switches::kSystemLevel), false)); | 334 std::string(switches::kSystemLevel), false)); |
| 335 expected.push_back(std::make_pair( | 335 expected.push_back(std::make_pair( |
| 336 std::string(switches::kMultiInstall), true)); | 336 std::string(switches::kMultiInstall), true)); |
| 337 expected.push_back(std::make_pair( | 337 expected.push_back(std::make_pair( |
| 338 std::string(switches::kEnsureGoogleUpdatePresent), true)); | 338 std::string(switches::kEnsureGoogleUpdatePresent), true)); |
| 339 | 339 |
| 340 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); | 340 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); |
| 341 | 341 |
| 342 std::set<string16> flags_exp; | 342 std::set<base::string16> flags_exp; |
| 343 flags_exp.insert(google_update::kRegSendsPingsField); | 343 flags_exp.insert(google_update::kRegSendsPingsField); |
| 344 flags_exp.insert(google_update::kRegWebAccessibleField); | 344 flags_exp.insert(google_update::kRegWebAccessibleField); |
| 345 flags_exp.insert(google_update::kRegRunAsUserField); | 345 flags_exp.insert(google_update::kRegRunAsUserField); |
| 346 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); | 346 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); |
| 347 } | 347 } |
| 348 | 348 |
| 349 // Validates a product's set of Google Update product commands against a | 349 // Validates a product's set of Google Update product commands against a |
| 350 // collection of expectations. | 350 // collection of expectations. |
| 351 void InstallationValidator::ValidateAppCommandExpectations( | 351 void InstallationValidator::ValidateAppCommandExpectations( |
| 352 const ProductContext& ctx, | 352 const ProductContext& ctx, |
| 353 const CommandExpectations& expectations, | 353 const CommandExpectations& expectations, |
| 354 bool* is_valid) { | 354 bool* is_valid) { |
| 355 DCHECK(is_valid); | 355 DCHECK(is_valid); |
| 356 | 356 |
| 357 CommandExpectations the_expectations(expectations); | 357 CommandExpectations the_expectations(expectations); |
| 358 | 358 |
| 359 AppCommands::CommandMapRange cmd_iterators( | 359 AppCommands::CommandMapRange cmd_iterators( |
| 360 ctx.state.commands().GetIterators()); | 360 ctx.state.commands().GetIterators()); |
| 361 CommandExpectations::iterator expectation; | 361 CommandExpectations::iterator expectation; |
| 362 for (; cmd_iterators.first != cmd_iterators.second; ++cmd_iterators.first) { | 362 for (; cmd_iterators.first != cmd_iterators.second; ++cmd_iterators.first) { |
| 363 const string16& cmd_id = cmd_iterators.first->first; | 363 const base::string16& cmd_id = cmd_iterators.first->first; |
| 364 // Do we have an expectation for this command? | 364 // Do we have an expectation for this command? |
| 365 expectation = the_expectations.find(cmd_id); | 365 expectation = the_expectations.find(cmd_id); |
| 366 if (expectation != the_expectations.end()) { | 366 if (expectation != the_expectations.end()) { |
| 367 (expectation->second)(ctx, cmd_iterators.first->second, is_valid); | 367 (expectation->second)(ctx, cmd_iterators.first->second, is_valid); |
| 368 // Remove this command from the set of expectations since we found it. | 368 // Remove this command from the set of expectations since we found it. |
| 369 the_expectations.erase(expectation); | 369 the_expectations.erase(expectation); |
| 370 } else { | 370 } else { |
| 371 *is_valid = false; | 371 *is_valid = false; |
| 372 LOG(ERROR) << ctx.dist->GetDisplayName() | 372 LOG(ERROR) << ctx.dist->GetDisplayName() |
| 373 << " has an unexpected Google Update product command named \"" | 373 << " has an unexpected Google Update product command named \"" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 binaries_rules); | 499 binaries_rules); |
| 500 | 500 |
| 501 ValidateBinariesCommands(ctx, is_valid); | 501 ValidateBinariesCommands(ctx, is_valid); |
| 502 | 502 |
| 503 ValidateUsageStats(ctx, is_valid); | 503 ValidateUsageStats(ctx, is_valid); |
| 504 } | 504 } |
| 505 | 505 |
| 506 // Validates the path to |setup_exe| for the product described by |ctx|. | 506 // Validates the path to |setup_exe| for the product described by |ctx|. |
| 507 void InstallationValidator::ValidateSetupPath(const ProductContext& ctx, | 507 void InstallationValidator::ValidateSetupPath(const ProductContext& ctx, |
| 508 const base::FilePath& setup_exe, | 508 const base::FilePath& setup_exe, |
| 509 const string16& purpose, | 509 const base::string16& purpose, |
| 510 bool* is_valid) { | 510 bool* is_valid) { |
| 511 DCHECK(is_valid); | 511 DCHECK(is_valid); |
| 512 | 512 |
| 513 BrowserDistribution* bins_dist = ctx.dist; | 513 BrowserDistribution* bins_dist = ctx.dist; |
| 514 if (ctx.state.is_multi_install()) { | 514 if (ctx.state.is_multi_install()) { |
| 515 bins_dist = BrowserDistribution::GetSpecificDistribution( | 515 bins_dist = BrowserDistribution::GetSpecificDistribution( |
| 516 BrowserDistribution::CHROME_BINARIES); | 516 BrowserDistribution::CHROME_BINARIES); |
| 517 } | 517 } |
| 518 | 518 |
| 519 base::FilePath expected_path = installer::GetChromeInstallPath( | 519 base::FilePath expected_path = installer::GetChromeInstallPath( |
| 520 ctx.system_install, bins_dist); | 520 ctx.system_install, bins_dist); |
| 521 expected_path = expected_path | 521 expected_path = expected_path |
| 522 .AppendASCII(ctx.state.version().GetString()) | 522 .AppendASCII(ctx.state.version().GetString()) |
| 523 .Append(installer::kInstallerDir) | 523 .Append(installer::kInstallerDir) |
| 524 .Append(installer::kSetupExe); | 524 .Append(installer::kSetupExe); |
| 525 if (!base::FilePath::CompareEqualIgnoreCase(expected_path.value(), | 525 if (!base::FilePath::CompareEqualIgnoreCase(expected_path.value(), |
| 526 setup_exe.value())) { | 526 setup_exe.value())) { |
| 527 *is_valid = false; | 527 *is_valid = false; |
| 528 LOG(ERROR) << ctx.dist->GetDisplayName() << " path to " << purpose | 528 LOG(ERROR) << ctx.dist->GetDisplayName() << " path to " << purpose |
| 529 << " is not " << expected_path.value() << ": " | 529 << " is not " << expected_path.value() << ": " |
| 530 << setup_exe.value(); | 530 << setup_exe.value(); |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 | 533 |
| 534 // Validates that |command| meets the expectations described in |expected|. | 534 // Validates that |command| meets the expectations described in |expected|. |
| 535 void InstallationValidator::ValidateCommandExpectations( | 535 void InstallationValidator::ValidateCommandExpectations( |
| 536 const ProductContext& ctx, | 536 const ProductContext& ctx, |
| 537 const CommandLine& command, | 537 const CommandLine& command, |
| 538 const SwitchExpectations& expected, | 538 const SwitchExpectations& expected, |
| 539 const string16& source, | 539 const base::string16& source, |
| 540 bool* is_valid) { | 540 bool* is_valid) { |
| 541 for (SwitchExpectations::size_type i = 0, size = expected.size(); i < size; | 541 for (SwitchExpectations::size_type i = 0, size = expected.size(); i < size; |
| 542 ++i) { | 542 ++i) { |
| 543 const SwitchExpectations::value_type& expectation = expected[i]; | 543 const SwitchExpectations::value_type& expectation = expected[i]; |
| 544 if (command.HasSwitch(expectation.first) != expectation.second) { | 544 if (command.HasSwitch(expectation.first) != expectation.second) { |
| 545 *is_valid = false; | 545 *is_valid = false; |
| 546 LOG(ERROR) << ctx.dist->GetDisplayName() << " " << source | 546 LOG(ERROR) << ctx.dist->GetDisplayName() << " " << source |
| 547 << (expectation.second ? " is missing" : " has") << " \"" | 547 << (expectation.second ? " is missing" : " has") << " \"" |
| 548 << expectation.first << "\"" | 548 << expectation.first << "\"" |
| 549 << (expectation.second ? "" : " but shouldn't") << ": " | 549 << (expectation.second ? "" : " but shouldn't") << ": " |
| 550 << command.GetCommandLineString(); | 550 << command.GetCommandLineString(); |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 } | 553 } |
| 554 | 554 |
| 555 // Validates that |command|, originating from |source|, is formed properly for | 555 // Validates that |command|, originating from |source|, is formed properly for |
| 556 // the product described by |ctx| | 556 // the product described by |ctx| |
| 557 void InstallationValidator::ValidateUninstallCommand(const ProductContext& ctx, | 557 void InstallationValidator::ValidateUninstallCommand( |
| 558 const CommandLine& command, | 558 const ProductContext& ctx, |
| 559 const string16& source, | 559 const CommandLine& command, |
| 560 bool* is_valid) { | 560 const base::string16& source, |
| 561 bool* is_valid) { |
| 561 DCHECK(is_valid); | 562 DCHECK(is_valid); |
| 562 | 563 |
| 563 ValidateSetupPath(ctx, command.GetProgram(), ASCIIToUTF16("uninstaller"), | 564 ValidateSetupPath(ctx, command.GetProgram(), ASCIIToUTF16("uninstaller"), |
| 564 is_valid); | 565 is_valid); |
| 565 | 566 |
| 566 const bool is_multi_install = ctx.state.is_multi_install(); | 567 const bool is_multi_install = ctx.state.is_multi_install(); |
| 567 SwitchExpectations expected; | 568 SwitchExpectations expected; |
| 568 | 569 |
| 569 expected.push_back(std::make_pair(std::string(switches::kUninstall), true)); | 570 expected.push_back(std::make_pair(std::string(switches::kUninstall), true)); |
| 570 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), | 571 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), |
| 571 ctx.system_install)); | 572 ctx.system_install)); |
| 572 expected.push_back(std::make_pair(std::string(switches::kMultiInstall), | 573 expected.push_back(std::make_pair(std::string(switches::kMultiInstall), |
| 573 is_multi_install)); | 574 is_multi_install)); |
| 574 ctx.rules.AddUninstallSwitchExpectations(ctx, &expected); | 575 ctx.rules.AddUninstallSwitchExpectations(ctx, &expected); |
| 575 | 576 |
| 576 ValidateCommandExpectations(ctx, command, expected, source, is_valid); | 577 ValidateCommandExpectations(ctx, command, expected, source, is_valid); |
| 577 } | 578 } |
| 578 | 579 |
| 579 // Validates the rename command for the product described by |ctx|. | 580 // Validates the rename command for the product described by |ctx|. |
| 580 void InstallationValidator::ValidateRenameCommand(const ProductContext& ctx, | 581 void InstallationValidator::ValidateRenameCommand(const ProductContext& ctx, |
| 581 bool* is_valid) { | 582 bool* is_valid) { |
| 582 DCHECK(is_valid); | 583 DCHECK(is_valid); |
| 583 DCHECK(!ctx.state.rename_cmd().empty()); | 584 DCHECK(!ctx.state.rename_cmd().empty()); |
| 584 | 585 |
| 585 CommandLine command = CommandLine::FromString(ctx.state.rename_cmd()); | 586 CommandLine command = CommandLine::FromString(ctx.state.rename_cmd()); |
| 586 string16 name(ASCIIToUTF16("in-use renamer")); | 587 base::string16 name(ASCIIToUTF16("in-use renamer")); |
| 587 | 588 |
| 588 ValidateSetupPath(ctx, command.GetProgram(), name, is_valid); | 589 ValidateSetupPath(ctx, command.GetProgram(), name, is_valid); |
| 589 | 590 |
| 590 SwitchExpectations expected; | 591 SwitchExpectations expected; |
| 591 | 592 |
| 592 expected.push_back(std::make_pair(std::string(switches::kRenameChromeExe), | 593 expected.push_back(std::make_pair(std::string(switches::kRenameChromeExe), |
| 593 true)); | 594 true)); |
| 594 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), | 595 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), |
| 595 ctx.system_install)); | 596 ctx.system_install)); |
| 596 expected.push_back(std::make_pair(std::string(switches::kMultiInstall), | 597 expected.push_back(std::make_pair(std::string(switches::kMultiInstall), |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 InstallationType* type) { | 813 InstallationType* type) { |
| 813 DCHECK(type); | 814 DCHECK(type); |
| 814 InstallationState machine_state; | 815 InstallationState machine_state; |
| 815 | 816 |
| 816 machine_state.Initialize(); | 817 machine_state.Initialize(); |
| 817 | 818 |
| 818 return ValidateInstallationTypeForState(machine_state, system_level, type); | 819 return ValidateInstallationTypeForState(machine_state, system_level, type); |
| 819 } | 820 } |
| 820 | 821 |
| 821 } // namespace installer | 822 } // namespace installer |
| OLD | NEW |