| 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/file_path.h" | 8 #include "base/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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const char* version, | 83 const char* version, |
| 84 int channel_modifiers); | 84 int channel_modifiers); |
| 85 void AddQuickEnableCfCommand(BrowserDistribution::Type dist_type, | 85 void AddQuickEnableCfCommand(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 AddOsUpgradeCommand(BrowserDistribution::Type dist_type, | 89 void AddOsUpgradeCommand(BrowserDistribution::Type dist_type, |
| 90 Level install_level, | 90 Level install_level, |
| 91 const char* version, | 91 const char* version, |
| 92 int channel_modifiers); | 92 int channel_modifiers); |
| 93 void AddQueryEULAAcceptanceCommand(BrowserDistribution::Type dist_type, |
| 94 Level install_level, |
| 95 const char* version, |
| 96 int channel_modifiers); |
| 93 void set_multi_install(bool is_multi_install) { | 97 void set_multi_install(bool is_multi_install) { |
| 94 multi_install_ = is_multi_install; | 98 multi_install_ = is_multi_install; |
| 95 } | 99 } |
| 96 installer::AppCommands& commands() { return commands_; } | 100 installer::AppCommands& commands() { return commands_; } |
| 97 | 101 |
| 98 protected: | 102 protected: |
| 99 struct ChannelMethodForModifier { | 103 struct ChannelMethodForModifier { |
| 100 ChannelModifier modifier; | 104 ChannelModifier modifier; |
| 101 bool (ChannelInfo::*method)(bool value); | 105 bool (ChannelInfo::*method)(bool value); |
| 102 }; | 106 }; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 cmd_line.AppendSwitch(installer::switches::kChrome); | 263 cmd_line.AppendSwitch(installer::switches::kChrome); |
| 260 } | 264 } |
| 261 if (install_level == SYSTEM_LEVEL) | 265 if (install_level == SYSTEM_LEVEL) |
| 262 cmd_line.AppendSwitch(installer::switches::kSystemLevel); | 266 cmd_line.AppendSwitch(installer::switches::kSystemLevel); |
| 263 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); | 267 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); |
| 264 AppCommand app_cmd(cmd_line.GetCommandLineString()); | 268 AppCommand app_cmd(cmd_line.GetCommandLineString()); |
| 265 app_cmd.set_is_auto_run_on_os_upgrade(true); | 269 app_cmd.set_is_auto_run_on_os_upgrade(true); |
| 266 commands_.Set(installer::kCmdOnOsUpgrade, app_cmd); | 270 commands_.Set(installer::kCmdOnOsUpgrade, app_cmd); |
| 267 } | 271 } |
| 268 | 272 |
| 273 // Adds the "query-eula-acceptance" Google Update product command. |
| 274 void FakeProductState::AddQueryEULAAcceptanceCommand( |
| 275 BrowserDistribution::Type dist_type, |
| 276 Level install_level, |
| 277 const char* version, |
| 278 int channel_modifiers) { |
| 279 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); |
| 280 |
| 281 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, |
| 282 channel_modifiers)); |
| 283 cmd_line.AppendSwitch(installer::switches::kQueryEULAAcceptance); |
| 284 if (install_level == SYSTEM_LEVEL) |
| 285 cmd_line.AppendSwitch(installer::switches::kSystemLevel); |
| 286 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); |
| 287 AppCommand app_cmd(cmd_line.GetCommandLineString()); |
| 288 app_cmd.set_is_web_accessible(true); |
| 289 commands_.Set(installer::kCmdQueryEULAAcceptance, app_cmd); |
| 290 } |
| 291 |
| 269 } // namespace | 292 } // namespace |
| 270 | 293 |
| 271 // Fixture for testing the InstallationValidator. Errors logged by the | 294 // Fixture for testing the InstallationValidator. Errors logged by the |
| 272 // validator are sent to an optional mock recipient (see | 295 // validator are sent to an optional mock recipient (see |
| 273 // set_validation_error_recipient) upon which expectations can be placed. | 296 // set_validation_error_recipient) upon which expectations can be placed. |
| 274 class InstallationValidatorTest | 297 class InstallationValidatorTest |
| 275 : public testing::TestWithParam<InstallationValidator::InstallationType> { | 298 : public testing::TestWithParam<InstallationValidator::InstallationType> { |
| 276 public: | 299 public: |
| 277 | 300 |
| 278 // These shouldn't need to be public, but there seems to be some interaction | 301 // These shouldn't need to be public, but there seems to be some interaction |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 channels = &kChromeFrameChannels[0]; // SxS GCF has its own channel names. | 466 channels = &kChromeFrameChannels[0]; // SxS GCF has its own channel names. |
| 444 const int channel_modifiers = | 467 const int channel_modifiers = |
| 445 is_multi_install ? GetChannelModifiers(inst_type) : 0; | 468 is_multi_install ? GetChannelModifiers(inst_type) : 0; |
| 446 | 469 |
| 447 state->Clear(); | 470 state->Clear(); |
| 448 state->SetChannel(channels[channel], channel_modifiers); | 471 state->SetChannel(channels[channel], channel_modifiers); |
| 449 state->SetVersion(chrome::kChromeVersion); | 472 state->SetVersion(chrome::kChromeVersion); |
| 450 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, | 473 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, |
| 451 channel_modifiers, vehicle); | 474 channel_modifiers, vehicle); |
| 452 state->set_multi_install(is_multi_install); | 475 state->set_multi_install(is_multi_install); |
| 453 if (prod_type == BrowserDistribution::CHROME_BINARIES && | 476 if (prod_type == BrowserDistribution::CHROME_BINARIES) { |
| 454 (inst_type == InstallationValidator::CHROME_MULTI || | 477 if (inst_type == InstallationValidator::CHROME_MULTI || |
| 455 inst_type == | 478 inst_type == |
| 456 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) { | 479 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI) { |
| 457 state->AddQuickEnableCfCommand(prod_type, install_level, | 480 state->AddQuickEnableCfCommand(prod_type, install_level, |
| 458 chrome::kChromeVersion, channel_modifiers); | 481 chrome::kChromeVersion, channel_modifiers); |
| 482 } |
| 483 state->AddQueryEULAAcceptanceCommand(prod_type, |
| 484 install_level, |
| 485 chrome::kChromeVersion, |
| 486 channel_modifiers); |
| 459 } | 487 } |
| 460 if (prod_type == BrowserDistribution::CHROME_BINARIES) { | 488 if (prod_type == BrowserDistribution::CHROME_BINARIES) { |
| 461 state->AddQuickEnableApplicationHostCommand(prod_type, | 489 state->AddQuickEnableApplicationHostCommand(prod_type, |
| 462 install_level, | 490 install_level, |
| 463 chrome::kChromeVersion, | 491 chrome::kChromeVersion, |
| 464 channel_modifiers); | 492 channel_modifiers); |
| 465 } | 493 } |
| 466 if (prod_type == BrowserDistribution::CHROME_BROWSER) { | 494 if (prod_type == BrowserDistribution::CHROME_BROWSER) { |
| 467 state->AddOsUpgradeCommand(prod_type, | 495 state->AddOsUpgradeCommand(prod_type, |
| 468 install_level, | 496 install_level, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 InstallationValidatorTest, | 571 InstallationValidatorTest, |
| 544 Values(InstallationValidator::NO_PRODUCTS, | 572 Values(InstallationValidator::NO_PRODUCTS, |
| 545 InstallationValidator::CHROME_SINGLE, | 573 InstallationValidator::CHROME_SINGLE, |
| 546 InstallationValidator::CHROME_MULTI, | 574 InstallationValidator::CHROME_MULTI, |
| 547 InstallationValidator::CHROME_FRAME_SINGLE, | 575 InstallationValidator::CHROME_FRAME_SINGLE, |
| 548 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, | 576 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, |
| 549 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, | 577 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, |
| 550 InstallationValidator::CHROME_FRAME_MULTI, | 578 InstallationValidator::CHROME_FRAME_MULTI, |
| 551 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, | 579 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, |
| 552 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)); | 580 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)); |
| OLD | NEW |