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

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

Issue 12035043: Implementing app command to query EULA acceptance state for Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Installation validator; adding user-level vs. system-level param; limit user-level checks for Chrom… Created 7 years, 11 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 | Annotate | Revision Log
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/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
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
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::kQueryEULAAccepetance);
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 commands_.Set(installer::kQueryEULAAccepetance, app_cmd);
289 }
290
269 } // namespace 291 } // namespace
270 292
271 // Fixture for testing the InstallationValidator. Errors logged by the 293 // Fixture for testing the InstallationValidator. Errors logged by the
272 // validator are sent to an optional mock recipient (see 294 // validator are sent to an optional mock recipient (see
273 // set_validation_error_recipient) upon which expectations can be placed. 295 // set_validation_error_recipient) upon which expectations can be placed.
274 class InstallationValidatorTest 296 class InstallationValidatorTest
275 : public testing::TestWithParam<InstallationValidator::InstallationType> { 297 : public testing::TestWithParam<InstallationValidator::InstallationType> {
276 public: 298 public:
277 299
278 // These shouldn't need to be public, but there seems to be some interaction 300 // 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
443 channels = &kChromeFrameChannels[0]; // SxS GCF has its own channel names. 465 channels = &kChromeFrameChannels[0]; // SxS GCF has its own channel names.
444 const int channel_modifiers = 466 const int channel_modifiers =
445 is_multi_install ? GetChannelModifiers(inst_type) : 0; 467 is_multi_install ? GetChannelModifiers(inst_type) : 0;
446 468
447 state->Clear(); 469 state->Clear();
448 state->SetChannel(channels[channel], channel_modifiers); 470 state->SetChannel(channels[channel], channel_modifiers);
449 state->SetVersion(chrome::kChromeVersion); 471 state->SetVersion(chrome::kChromeVersion);
450 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, 472 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion,
451 channel_modifiers, vehicle); 473 channel_modifiers, vehicle);
452 state->set_multi_install(is_multi_install); 474 state->set_multi_install(is_multi_install);
453 if (prod_type == BrowserDistribution::CHROME_BINARIES && 475 if (prod_type == BrowserDistribution::CHROME_BINARIES) {
454 (inst_type == InstallationValidator::CHROME_MULTI || 476 if (inst_type == InstallationValidator::CHROME_MULTI ||
455 inst_type == 477 inst_type ==
456 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) { 478 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) {
457 state->AddQuickEnableCfCommand(prod_type, install_level, 479 state->AddQuickEnableCfCommand(prod_type, install_level,
458 chrome::kChromeVersion, channel_modifiers); 480 chrome::kChromeVersion, channel_modifiers);
481 }
482 state->AddQueryEULAAcceptanceCommand(prod_type,
483 install_level,
484 chrome::kChromeVersion,
485 channel_modifiers);
459 } 486 }
460 if (prod_type == BrowserDistribution::CHROME_BINARIES) { 487 if (prod_type == BrowserDistribution::CHROME_BINARIES) {
461 state->AddQuickEnableApplicationHostCommand(prod_type, 488 state->AddQuickEnableApplicationHostCommand(prod_type,
462 install_level, 489 install_level,
463 chrome::kChromeVersion, 490 chrome::kChromeVersion,
464 channel_modifiers); 491 channel_modifiers);
465 } 492 }
466 if (prod_type == BrowserDistribution::CHROME_BROWSER) { 493 if (prod_type == BrowserDistribution::CHROME_BROWSER) {
467 state->AddOsUpgradeCommand(prod_type, 494 state->AddOsUpgradeCommand(prod_type,
468 install_level, 495 install_level,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 InstallationValidatorTest, 570 InstallationValidatorTest,
544 Values(InstallationValidator::NO_PRODUCTS, 571 Values(InstallationValidator::NO_PRODUCTS,
545 InstallationValidator::CHROME_SINGLE, 572 InstallationValidator::CHROME_SINGLE,
546 InstallationValidator::CHROME_MULTI, 573 InstallationValidator::CHROME_MULTI,
547 InstallationValidator::CHROME_FRAME_SINGLE, 574 InstallationValidator::CHROME_FRAME_SINGLE,
548 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, 575 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE,
549 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, 576 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI,
550 InstallationValidator::CHROME_FRAME_MULTI, 577 InstallationValidator::CHROME_FRAME_MULTI,
551 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, 578 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI,
552 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)); 579 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698