Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/installer/util/installation_validator_unittest.cc

Issue 811283002: [Installer] Cleaning up dead code for App Launcher / App Host installs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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,
86 Level install_level,
87 const char* version,
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) { 85 void set_multi_install(bool is_multi_install) {
94 multi_install_ = is_multi_install; 86 multi_install_ = is_multi_install;
95 } 87 }
96 installer::AppCommands& commands() { return commands_; } 88 installer::AppCommands& commands() { return commands_; }
97 89
98 protected: 90 protected:
99 struct ChannelMethodForModifier { 91 struct ChannelMethodForModifier {
100 ChannelModifier modifier; 92 ChannelModifier modifier;
101 bool (ChannelInfo::*method)(bool value); 93 bool (ChannelInfo::*method)(bool value);
102 }; 94 };
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 cmd_line.AppendSwitch(installer::switches::kChrome); 214 cmd_line.AppendSwitch(installer::switches::kChrome);
223 } 215 }
224 if (install_level == SYSTEM_LEVEL) 216 if (install_level == SYSTEM_LEVEL)
225 cmd_line.AppendSwitch(installer::switches::kSystemLevel); 217 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
226 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); 218 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
227 AppCommand app_cmd(cmd_line.GetCommandLineString()); 219 AppCommand app_cmd(cmd_line.GetCommandLineString());
228 app_cmd.set_is_auto_run_on_os_upgrade(true); 220 app_cmd.set_is_auto_run_on_os_upgrade(true);
229 commands_.Set(installer::kCmdOnOsUpgrade, app_cmd); 221 commands_.Set(installer::kCmdOnOsUpgrade, app_cmd);
230 } 222 }
231 223
232 // Adds the "query-eula-acceptance" Google Update product command.
233 void FakeProductState::AddQueryEULAAcceptanceCommand(
234 BrowserDistribution::Type dist_type,
235 Level install_level,
236 const char* version,
237 int channel_modifiers) {
238 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES);
239
240 base::CommandLine cmd_line(
241 GetSetupExePath(dist_type, install_level, version, channel_modifiers));
242 cmd_line.AppendSwitch(installer::switches::kQueryEULAAcceptance);
243 if (install_level == SYSTEM_LEVEL)
244 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
245 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
246 AppCommand app_cmd(cmd_line.GetCommandLineString());
247 app_cmd.set_is_web_accessible(true);
248 app_cmd.set_is_run_as_user(true);
249 commands_.Set(installer::kCmdQueryEULAAcceptance, app_cmd);
250 }
251
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 base::CommandLine cmd_line(
262 GetSetupExePath(dist_type, install_level, version, 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 224 } // namespace
274 225
275 // Fixture for testing the InstallationValidator. Errors logged by the 226 // Fixture for testing the InstallationValidator. Errors logged by the
276 // validator are sent to an optional mock recipient (see 227 // validator are sent to an optional mock recipient (see
277 // set_validation_error_recipient) upon which expectations can be placed. 228 // set_validation_error_recipient) upon which expectations can be placed.
278 class InstallationValidatorTest 229 class InstallationValidatorTest
279 : public testing::TestWithParam<InstallationValidator::InstallationType> { 230 : public testing::TestWithParam<InstallationValidator::InstallationType> {
280 public: 231 public:
281 232
282 // These shouldn't need to be public, but there seems to be some interaction 233 // These shouldn't need to be public, but there seems to be some interaction
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 channels = &kChromeFrameChannels[0]; // SxS GCF has its own channel names. 395 channels = &kChromeFrameChannels[0]; // SxS GCF has its own channel names.
445 const int channel_modifiers = 396 const int channel_modifiers =
446 is_multi_install ? GetChannelModifiers(inst_type) : 0; 397 is_multi_install ? GetChannelModifiers(inst_type) : 0;
447 398
448 state->Clear(); 399 state->Clear();
449 state->SetChannel(channels[channel], channel_modifiers); 400 state->SetChannel(channels[channel], channel_modifiers);
450 state->SetVersion(chrome::kChromeVersion); 401 state->SetVersion(chrome::kChromeVersion);
451 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, 402 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion,
452 channel_modifiers, vehicle); 403 channel_modifiers, vehicle);
453 state->set_multi_install(is_multi_install); 404 state->set_multi_install(is_multi_install);
454 if (prod_type == BrowserDistribution::CHROME_BINARIES) {
455 state->AddQueryEULAAcceptanceCommand(prod_type,
456 install_level,
457 chrome::kChromeVersion,
458 channel_modifiers);
459 }
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) { 405 if (prod_type == BrowserDistribution::CHROME_BROWSER) {
467 state->AddOsUpgradeCommand(prod_type, 406 state->AddOsUpgradeCommand(prod_type,
468 install_level, 407 install_level,
469 chrome::kChromeVersion, 408 chrome::kChromeVersion,
470 channel_modifiers); 409 channel_modifiers);
471 } 410 }
472 } 411 }
473 412
474 // static 413 // static
475 // Populates |state| with the state of a valid installation of |inst_type|. 414 // Populates |state| with the state of a valid installation of |inst_type|.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 AllValidInstallations, 479 AllValidInstallations,
541 InstallationValidatorTest, 480 InstallationValidatorTest,
542 Values(InstallationValidator::NO_PRODUCTS, 481 Values(InstallationValidator::NO_PRODUCTS,
543 InstallationValidator::CHROME_SINGLE, 482 InstallationValidator::CHROME_SINGLE,
544 InstallationValidator::CHROME_MULTI, 483 InstallationValidator::CHROME_MULTI,
545 InstallationValidator::CHROME_FRAME_SINGLE, 484 InstallationValidator::CHROME_FRAME_SINGLE,
546 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, 485 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE,
547 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, 486 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI,
548 InstallationValidator::CHROME_FRAME_MULTI, 487 InstallationValidator::CHROME_FRAME_MULTI,
549 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI)); 488 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI));
OLDNEW
« no previous file with comments | « chrome/installer/util/installation_validator.cc ('k') | chrome/installer/util/installer_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698