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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 class FakeProductState : public ProductState { | 72 class FakeProductState : public ProductState { |
73 public: | 73 public: |
74 void SetChannel(const wchar_t* base, int channel_modifiers); | 74 void SetChannel(const wchar_t* base, int channel_modifiers); |
75 void SetVersion(const char* version); | 75 void SetVersion(const char* version); |
76 void SetUninstallCommand(BrowserDistribution::Type dist_type, | 76 void SetUninstallCommand(BrowserDistribution::Type dist_type, |
77 Level install_level, | 77 Level install_level, |
78 const char* version, | 78 const char* version, |
79 int channel_modifiers, | 79 int channel_modifiers, |
80 Vehicle vehicle); | 80 Vehicle vehicle); |
81 void AddInstallExtensionCommand(BrowserDistribution::Type dist_type, | |
82 Level install_level, | |
83 const char* version, | |
84 int channel_modifiers); | |
85 void AddOsUpgradeCommand(BrowserDistribution::Type dist_type, | 81 void AddOsUpgradeCommand(BrowserDistribution::Type dist_type, |
86 Level install_level, | 82 Level install_level, |
87 const char* version, | 83 const char* version, |
88 int channel_modifiers); | 84 int channel_modifiers); |
89 void AddQueryEULAAcceptanceCommand(BrowserDistribution::Type dist_type, | 85 void AddQueryEULAAcceptanceCommand(BrowserDistribution::Type dist_type, |
90 Level install_level, | 86 Level install_level, |
91 const char* version, | 87 const char* version, |
92 int channel_modifiers); | 88 int channel_modifiers); |
93 void AddQuickEnableApplicationHostCommand(BrowserDistribution::Type dist_type, | 89 void AddQuickEnableApplicationHostCommand(BrowserDistribution::Type dist_type, |
94 Level install_level, | 90 Level install_level, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 uninstall_command_.AppendSwitch(installer::switches::kChrome); | 198 uninstall_command_.AppendSwitch(installer::switches::kChrome); |
203 else if (dist_type == BrowserDistribution::CHROME_FRAME) | 199 else if (dist_type == BrowserDistribution::CHROME_FRAME) |
204 uninstall_command_.AppendSwitch(installer::switches::kChromeFrame); | 200 uninstall_command_.AppendSwitch(installer::switches::kChromeFrame); |
205 } else if (dist_type == BrowserDistribution::CHROME_FRAME) { | 201 } else if (dist_type == BrowserDistribution::CHROME_FRAME) { |
206 uninstall_command_.AppendSwitch(installer::switches::kChromeFrame); | 202 uninstall_command_.AppendSwitch(installer::switches::kChromeFrame); |
207 } | 203 } |
208 if (vehicle == MSI) | 204 if (vehicle == MSI) |
209 uninstall_command_.AppendSwitch(installer::switches::kMsi); | 205 uninstall_command_.AppendSwitch(installer::switches::kMsi); |
210 } | 206 } |
211 | 207 |
212 // Adds the "install-extension" Google Update product command. | |
213 void FakeProductState::AddInstallExtensionCommand( | |
214 BrowserDistribution::Type dist_type, | |
215 Level install_level, | |
216 const char* version, | |
217 int channel_modifiers) { | |
218 // Right now only Chrome browser uses this. | |
219 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BROWSER); | |
220 | |
221 CommandLine cmd_line(GetSetupPath(dist_type, install_level, | |
222 channel_modifiers). | |
223 Append(installer::kChromeExe)); | |
224 cmd_line.AppendSwitchASCII(::switches::kLimitedInstallFromWebstore, "%1"); | |
225 AppCommand app_cmd(cmd_line.GetCommandLineString()); | |
226 app_cmd.set_sends_pings(true); | |
227 app_cmd.set_is_web_accessible(true); | |
228 app_cmd.set_is_run_as_user(true); | |
229 commands_.Set(installer::kCmdInstallExtension, app_cmd); | |
230 } | |
231 | |
232 // Adds the "on-os-upgrade" Google Update product command. | 208 // Adds the "on-os-upgrade" Google Update product command. |
233 void FakeProductState::AddOsUpgradeCommand(BrowserDistribution::Type dist_type, | 209 void FakeProductState::AddOsUpgradeCommand(BrowserDistribution::Type dist_type, |
234 Level install_level, | 210 Level install_level, |
235 const char* version, | 211 const char* version, |
236 int channel_modifiers) { | 212 int channel_modifiers) { |
237 // Right now only Chrome browser uses this. | 213 // Right now only Chrome browser uses this. |
238 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BROWSER); | 214 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BROWSER); |
239 | 215 |
240 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, | 216 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, |
241 channel_modifiers)); | 217 channel_modifiers)); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 state->AddQuickEnableApplicationHostCommand(prod_type, | 461 state->AddQuickEnableApplicationHostCommand(prod_type, |
486 install_level, | 462 install_level, |
487 chrome::kChromeVersion, | 463 chrome::kChromeVersion, |
488 channel_modifiers); | 464 channel_modifiers); |
489 } | 465 } |
490 if (prod_type == BrowserDistribution::CHROME_BROWSER) { | 466 if (prod_type == BrowserDistribution::CHROME_BROWSER) { |
491 state->AddOsUpgradeCommand(prod_type, | 467 state->AddOsUpgradeCommand(prod_type, |
492 install_level, | 468 install_level, |
493 chrome::kChromeVersion, | 469 chrome::kChromeVersion, |
494 channel_modifiers); | 470 channel_modifiers); |
495 state->AddInstallExtensionCommand(prod_type, | |
496 install_level, | |
497 chrome::kChromeVersion, | |
498 channel_modifiers); | |
499 } | 471 } |
500 } | 472 } |
501 | 473 |
502 // static | 474 // static |
503 // Populates |state| with the state of a valid installation of |inst_type|. | 475 // Populates |state| with the state of a valid installation of |inst_type|. |
504 void InstallationValidatorTest::MakeMachineState( | 476 void InstallationValidatorTest::MakeMachineState( |
505 InstallationValidator::InstallationType inst_type, | 477 InstallationValidator::InstallationType inst_type, |
506 Level install_level, | 478 Level install_level, |
507 Channel channel, | 479 Channel channel, |
508 Vehicle vehicle, | 480 Vehicle vehicle, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 AllValidInstallations, | 540 AllValidInstallations, |
569 InstallationValidatorTest, | 541 InstallationValidatorTest, |
570 Values(InstallationValidator::NO_PRODUCTS, | 542 Values(InstallationValidator::NO_PRODUCTS, |
571 InstallationValidator::CHROME_SINGLE, | 543 InstallationValidator::CHROME_SINGLE, |
572 InstallationValidator::CHROME_MULTI, | 544 InstallationValidator::CHROME_MULTI, |
573 InstallationValidator::CHROME_FRAME_SINGLE, | 545 InstallationValidator::CHROME_FRAME_SINGLE, |
574 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, | 546 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, |
575 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, | 547 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, |
576 InstallationValidator::CHROME_FRAME_MULTI, | 548 InstallationValidator::CHROME_FRAME_MULTI, |
577 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI)); | 549 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI)); |
OLD | NEW |