| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 int channel_modifiers, | 79 int channel_modifiers, |
| 80 Vehicle vehicle); | 80 Vehicle vehicle); |
| 81 void AddOsUpgradeCommand(BrowserDistribution::Type dist_type, | 81 void AddOsUpgradeCommand(BrowserDistribution::Type dist_type, |
| 82 Level install_level, | 82 Level install_level, |
| 83 const char* version, | 83 const char* version, |
| 84 int channel_modifiers); | 84 int channel_modifiers); |
| 85 void AddQueryEULAAcceptanceCommand(BrowserDistribution::Type dist_type, | 85 void AddQueryEULAAcceptanceCommand(BrowserDistribution::Type dist_type, |
| 86 Level install_level, | 86 Level install_level, |
| 87 const char* version, | 87 const char* version, |
| 88 int channel_modifiers); | 88 int channel_modifiers); |
| 89 void AddQuickEnableApplicationHostCommand(BrowserDistribution::Type dist_type, | |
| 90 Level install_level, | |
| 91 const char* version, | |
| 92 int channel_modifiers); | |
| 93 void set_multi_install(bool is_multi_install) { | 89 void set_multi_install(bool is_multi_install) { |
| 94 multi_install_ = is_multi_install; | 90 multi_install_ = is_multi_install; |
| 95 } | 91 } |
| 96 installer::AppCommands& commands() { return commands_; } | 92 installer::AppCommands& commands() { return commands_; } |
| 97 | 93 |
| 98 protected: | 94 protected: |
| 99 struct ChannelMethodForModifier { | 95 struct ChannelMethodForModifier { |
| 100 ChannelModifier modifier; | 96 ChannelModifier modifier; |
| 101 bool (ChannelInfo::*method)(bool value); | 97 bool (ChannelInfo::*method)(bool value); |
| 102 }; | 98 }; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 cmd_line.AppendSwitch(installer::switches::kQueryEULAAcceptance); | 238 cmd_line.AppendSwitch(installer::switches::kQueryEULAAcceptance); |
| 243 if (install_level == SYSTEM_LEVEL) | 239 if (install_level == SYSTEM_LEVEL) |
| 244 cmd_line.AppendSwitch(installer::switches::kSystemLevel); | 240 cmd_line.AppendSwitch(installer::switches::kSystemLevel); |
| 245 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); | 241 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); |
| 246 AppCommand app_cmd(cmd_line.GetCommandLineString()); | 242 AppCommand app_cmd(cmd_line.GetCommandLineString()); |
| 247 app_cmd.set_is_web_accessible(true); | 243 app_cmd.set_is_web_accessible(true); |
| 248 app_cmd.set_is_run_as_user(true); | 244 app_cmd.set_is_run_as_user(true); |
| 249 commands_.Set(installer::kCmdQueryEULAAcceptance, app_cmd); | 245 commands_.Set(installer::kCmdQueryEULAAcceptance, app_cmd); |
| 250 } | 246 } |
| 251 | 247 |
| 252 // Adds the "quick-enable-application-host" Google Update product command. | |
| 253 void FakeProductState::AddQuickEnableApplicationHostCommand( | |
| 254 BrowserDistribution::Type dist_type, | |
| 255 Level install_level, | |
| 256 const char* version, | |
| 257 int channel_modifiers) { | |
| 258 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); | |
| 259 DCHECK_NE(channel_modifiers & CM_MULTI, 0); | |
| 260 | |
| 261 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, | |
| 262 channel_modifiers)); | |
| 263 cmd_line.AppendSwitch(installer::switches::kMultiInstall); | |
| 264 cmd_line.AppendSwitch(installer::switches::kChromeAppLauncher); | |
| 265 cmd_line.AppendSwitch(installer::switches::kEnsureGoogleUpdatePresent); | |
| 266 AppCommand app_cmd(cmd_line.GetCommandLineString()); | |
| 267 app_cmd.set_sends_pings(true); | |
| 268 app_cmd.set_is_web_accessible(true); | |
| 269 app_cmd.set_is_run_as_user(true); | |
| 270 commands_.Set(installer::kCmdQuickEnableApplicationHost, app_cmd); | |
| 271 } | |
| 272 | |
| 273 } // namespace | 248 } // namespace |
| 274 | 249 |
| 275 // Fixture for testing the InstallationValidator. Errors logged by the | 250 // Fixture for testing the InstallationValidator. Errors logged by the |
| 276 // validator are sent to an optional mock recipient (see | 251 // validator are sent to an optional mock recipient (see |
| 277 // set_validation_error_recipient) upon which expectations can be placed. | 252 // set_validation_error_recipient) upon which expectations can be placed. |
| 278 class InstallationValidatorTest | 253 class InstallationValidatorTest |
| 279 : public testing::TestWithParam<InstallationValidator::InstallationType> { | 254 : public testing::TestWithParam<InstallationValidator::InstallationType> { |
| 280 public: | 255 public: |
| 281 | 256 |
| 282 // These shouldn't need to be public, but there seems to be some interaction | 257 // These shouldn't need to be public, but there seems to be some interaction |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 state->SetVersion(chrome::kChromeVersion); | 425 state->SetVersion(chrome::kChromeVersion); |
| 451 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, | 426 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, |
| 452 channel_modifiers, vehicle); | 427 channel_modifiers, vehicle); |
| 453 state->set_multi_install(is_multi_install); | 428 state->set_multi_install(is_multi_install); |
| 454 if (prod_type == BrowserDistribution::CHROME_BINARIES) { | 429 if (prod_type == BrowserDistribution::CHROME_BINARIES) { |
| 455 state->AddQueryEULAAcceptanceCommand(prod_type, | 430 state->AddQueryEULAAcceptanceCommand(prod_type, |
| 456 install_level, | 431 install_level, |
| 457 chrome::kChromeVersion, | 432 chrome::kChromeVersion, |
| 458 channel_modifiers); | 433 channel_modifiers); |
| 459 } | 434 } |
| 460 if (prod_type == BrowserDistribution::CHROME_BINARIES) { | |
| 461 state->AddQuickEnableApplicationHostCommand(prod_type, | |
| 462 install_level, | |
| 463 chrome::kChromeVersion, | |
| 464 channel_modifiers); | |
| 465 } | |
| 466 if (prod_type == BrowserDistribution::CHROME_BROWSER) { | 435 if (prod_type == BrowserDistribution::CHROME_BROWSER) { |
| 467 state->AddOsUpgradeCommand(prod_type, | 436 state->AddOsUpgradeCommand(prod_type, |
| 468 install_level, | 437 install_level, |
| 469 chrome::kChromeVersion, | 438 chrome::kChromeVersion, |
| 470 channel_modifiers); | 439 channel_modifiers); |
| 471 } | 440 } |
| 472 } | 441 } |
| 473 | 442 |
| 474 // static | 443 // static |
| 475 // Populates |state| with the state of a valid installation of |inst_type|. | 444 // Populates |state| with the state of a valid installation of |inst_type|. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 AllValidInstallations, | 509 AllValidInstallations, |
| 541 InstallationValidatorTest, | 510 InstallationValidatorTest, |
| 542 Values(InstallationValidator::NO_PRODUCTS, | 511 Values(InstallationValidator::NO_PRODUCTS, |
| 543 InstallationValidator::CHROME_SINGLE, | 512 InstallationValidator::CHROME_SINGLE, |
| 544 InstallationValidator::CHROME_MULTI, | 513 InstallationValidator::CHROME_MULTI, |
| 545 InstallationValidator::CHROME_FRAME_SINGLE, | 514 InstallationValidator::CHROME_FRAME_SINGLE, |
| 546 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, | 515 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, |
| 547 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, | 516 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, |
| 548 InstallationValidator::CHROME_FRAME_MULTI, | 517 InstallationValidator::CHROME_FRAME_MULTI, |
| 549 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI)); | 518 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI)); |
| OLD | NEW |