| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 const char* version, | 87 const char* version, |
| 88 int channel_modifiers); | 88 int channel_modifiers); |
| 89 void AddQueryEULAAcceptanceCommand(BrowserDistribution::Type dist_type, | 89 void AddQueryEULAAcceptanceCommand(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 AddQuickEnableApplicationHostCommand(BrowserDistribution::Type dist_type, | 93 void AddQuickEnableApplicationHostCommand(BrowserDistribution::Type dist_type, |
| 94 Level install_level, | 94 Level install_level, |
| 95 const char* version, | 95 const char* version, |
| 96 int channel_modifiers); | 96 int channel_modifiers); |
| 97 void AddQuickEnableCfCommand(BrowserDistribution::Type dist_type, | |
| 98 Level install_level, | |
| 99 const char* version, | |
| 100 int channel_modifiers); | |
| 101 void set_multi_install(bool is_multi_install) { | 97 void set_multi_install(bool is_multi_install) { |
| 102 multi_install_ = is_multi_install; | 98 multi_install_ = is_multi_install; |
| 103 } | 99 } |
| 104 installer::AppCommands& commands() { return commands_; } | 100 installer::AppCommands& commands() { return commands_; } |
| 105 | 101 |
| 106 protected: | 102 protected: |
| 107 struct ChannelMethodForModifier { | 103 struct ChannelMethodForModifier { |
| 108 ChannelModifier modifier; | 104 ChannelModifier modifier; |
| 109 bool (ChannelInfo::*method)(bool value); | 105 bool (ChannelInfo::*method)(bool value); |
| 110 }; | 106 }; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 cmd_line.AppendSwitch(installer::switches::kMultiInstall); | 287 cmd_line.AppendSwitch(installer::switches::kMultiInstall); |
| 292 cmd_line.AppendSwitch(installer::switches::kChromeAppLauncher); | 288 cmd_line.AppendSwitch(installer::switches::kChromeAppLauncher); |
| 293 cmd_line.AppendSwitch(installer::switches::kEnsureGoogleUpdatePresent); | 289 cmd_line.AppendSwitch(installer::switches::kEnsureGoogleUpdatePresent); |
| 294 AppCommand app_cmd(cmd_line.GetCommandLineString()); | 290 AppCommand app_cmd(cmd_line.GetCommandLineString()); |
| 295 app_cmd.set_sends_pings(true); | 291 app_cmd.set_sends_pings(true); |
| 296 app_cmd.set_is_web_accessible(true); | 292 app_cmd.set_is_web_accessible(true); |
| 297 app_cmd.set_is_run_as_user(true); | 293 app_cmd.set_is_run_as_user(true); |
| 298 commands_.Set(installer::kCmdQuickEnableApplicationHost, app_cmd); | 294 commands_.Set(installer::kCmdQuickEnableApplicationHost, app_cmd); |
| 299 } | 295 } |
| 300 | 296 |
| 301 // Adds the "quick-enable-cf" Google Update product command. | |
| 302 void FakeProductState::AddQuickEnableCfCommand( | |
| 303 BrowserDistribution::Type dist_type, | |
| 304 Level install_level, | |
| 305 const char* version, | |
| 306 int channel_modifiers) { | |
| 307 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); | |
| 308 DCHECK_NE(channel_modifiers & CM_MULTI, 0); | |
| 309 | |
| 310 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, | |
| 311 channel_modifiers)); | |
| 312 cmd_line.AppendSwitch(installer::switches::kMultiInstall); | |
| 313 if (install_level == SYSTEM_LEVEL) | |
| 314 cmd_line.AppendSwitch(installer::switches::kSystemLevel); | |
| 315 cmd_line.AppendSwitch(installer::switches::kChromeFrameQuickEnable); | |
| 316 AppCommand app_cmd(cmd_line.GetCommandLineString()); | |
| 317 app_cmd.set_sends_pings(true); | |
| 318 app_cmd.set_is_web_accessible(true); | |
| 319 commands_.Set(installer::kCmdQuickEnableCf, app_cmd); | |
| 320 } | |
| 321 | |
| 322 } // namespace | 297 } // namespace |
| 323 | 298 |
| 324 // Fixture for testing the InstallationValidator. Errors logged by the | 299 // Fixture for testing the InstallationValidator. Errors logged by the |
| 325 // validator are sent to an optional mock recipient (see | 300 // validator are sent to an optional mock recipient (see |
| 326 // set_validation_error_recipient) upon which expectations can be placed. | 301 // set_validation_error_recipient) upon which expectations can be placed. |
| 327 class InstallationValidatorTest | 302 class InstallationValidatorTest |
| 328 : public testing::TestWithParam<InstallationValidator::InstallationType> { | 303 : public testing::TestWithParam<InstallationValidator::InstallationType> { |
| 329 public: | 304 public: |
| 330 | 305 |
| 331 // These shouldn't need to be public, but there seems to be some interaction | 306 // These shouldn't need to be public, but there seems to be some interaction |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 const int channel_modifiers = | 469 const int channel_modifiers = |
| 495 is_multi_install ? GetChannelModifiers(inst_type) : 0; | 470 is_multi_install ? GetChannelModifiers(inst_type) : 0; |
| 496 | 471 |
| 497 state->Clear(); | 472 state->Clear(); |
| 498 state->SetChannel(channels[channel], channel_modifiers); | 473 state->SetChannel(channels[channel], channel_modifiers); |
| 499 state->SetVersion(chrome::kChromeVersion); | 474 state->SetVersion(chrome::kChromeVersion); |
| 500 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, | 475 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, |
| 501 channel_modifiers, vehicle); | 476 channel_modifiers, vehicle); |
| 502 state->set_multi_install(is_multi_install); | 477 state->set_multi_install(is_multi_install); |
| 503 if (prod_type == BrowserDistribution::CHROME_BINARIES) { | 478 if (prod_type == BrowserDistribution::CHROME_BINARIES) { |
| 504 if (inst_type == InstallationValidator::CHROME_MULTI) { | |
| 505 state->AddQuickEnableCfCommand(prod_type, install_level, | |
| 506 chrome::kChromeVersion, channel_modifiers); | |
| 507 } | |
| 508 state->AddQueryEULAAcceptanceCommand(prod_type, | 479 state->AddQueryEULAAcceptanceCommand(prod_type, |
| 509 install_level, | 480 install_level, |
| 510 chrome::kChromeVersion, | 481 chrome::kChromeVersion, |
| 511 channel_modifiers); | 482 channel_modifiers); |
| 512 } | 483 } |
| 513 if (prod_type == BrowserDistribution::CHROME_BINARIES) { | 484 if (prod_type == BrowserDistribution::CHROME_BINARIES) { |
| 514 state->AddQuickEnableApplicationHostCommand(prod_type, | 485 state->AddQuickEnableApplicationHostCommand(prod_type, |
| 515 install_level, | 486 install_level, |
| 516 chrome::kChromeVersion, | 487 chrome::kChromeVersion, |
| 517 channel_modifiers); | 488 channel_modifiers); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 AllValidInstallations, | 568 AllValidInstallations, |
| 598 InstallationValidatorTest, | 569 InstallationValidatorTest, |
| 599 Values(InstallationValidator::NO_PRODUCTS, | 570 Values(InstallationValidator::NO_PRODUCTS, |
| 600 InstallationValidator::CHROME_SINGLE, | 571 InstallationValidator::CHROME_SINGLE, |
| 601 InstallationValidator::CHROME_MULTI, | 572 InstallationValidator::CHROME_MULTI, |
| 602 InstallationValidator::CHROME_FRAME_SINGLE, | 573 InstallationValidator::CHROME_FRAME_SINGLE, |
| 603 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, | 574 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, |
| 604 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, | 575 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, |
| 605 InstallationValidator::CHROME_FRAME_MULTI, | 576 InstallationValidator::CHROME_FRAME_MULTI, |
| 606 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI)); | 577 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI)); |
| OLD | NEW |