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

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

Issue 10823437: Callback flow to register Chrome and update shortcuts after OS upgrade to Windows 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renaming kRegAutoRunOnOSUpgrade to kRegAutoRunOnOSUpgradeField; deleting bad debug message. Created 8 years, 3 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
« no previous file with comments | « chrome/installer/util/installation_validator.cc ('k') | chrome/installer/util/util_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 int channel_modifiers, 79 int channel_modifiers,
80 Vehicle vehicle); 80 Vehicle vehicle);
81 void AddQuickEnableApplicationHostCommand(BrowserDistribution::Type dist_type, 81 void AddQuickEnableApplicationHostCommand(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 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,
90 Level install_level,
91 const char* version,
92 int channel_modifiers);
89 void set_multi_install(bool is_multi_install) { 93 void set_multi_install(bool is_multi_install) {
90 multi_install_ = is_multi_install; 94 multi_install_ = is_multi_install;
91 } 95 }
92 installer::AppCommands& commands() { return commands_; } 96 installer::AppCommands& commands() { return commands_; }
93 97
94 protected: 98 protected:
95 struct ChannelMethodForModifier { 99 struct ChannelMethodForModifier {
96 ChannelModifier modifier; 100 ChannelModifier modifier;
97 bool (ChannelInfo::*method)(bool value); 101 bool (ChannelInfo::*method)(bool value);
98 }; 102 };
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 Level install_level, 207 Level install_level,
204 const char* version, 208 const char* version,
205 int channel_modifiers) { 209 int channel_modifiers) {
206 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); 210 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES);
207 DCHECK_NE(channel_modifiers & CM_MULTI, 0); 211 DCHECK_NE(channel_modifiers & CM_MULTI, 0);
208 212
209 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, 213 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version,
210 channel_modifiers)); 214 channel_modifiers));
211 cmd_line.AppendSwitch(installer::switches::kMultiInstall); 215 cmd_line.AppendSwitch(installer::switches::kMultiInstall);
212 cmd_line.AppendSwitch(installer::switches::kChromeAppHost); 216 cmd_line.AppendSwitch(installer::switches::kChromeAppHost);
213 commands_.Set(installer::kCmdQuickEnableApplicationHost, 217 AppCommand app_cmd(cmd_line.GetCommandLineString());
214 AppCommand(cmd_line.GetCommandLineString(), true, true)); 218 app_cmd.set_sends_pings(true);
219 app_cmd.set_is_web_accessible(true);
220 commands_.Set(installer::kCmdQuickEnableApplicationHost, app_cmd);
215 } 221 }
216 222
217 // Adds the "quick-enable-cf" Google Update product command. 223 // Adds the "quick-enable-cf" Google Update product command.
218 void FakeProductState::AddQuickEnableCfCommand( 224 void FakeProductState::AddQuickEnableCfCommand(
219 BrowserDistribution::Type dist_type, 225 BrowserDistribution::Type dist_type,
220 Level install_level, 226 Level install_level,
221 const char* version, 227 const char* version,
222 int channel_modifiers) { 228 int channel_modifiers) {
223 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); 229 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES);
224 DCHECK_NE(channel_modifiers & CM_MULTI, 0); 230 DCHECK_NE(channel_modifiers & CM_MULTI, 0);
225 231
226 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, 232 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version,
227 channel_modifiers)); 233 channel_modifiers));
228 cmd_line.AppendSwitch(installer::switches::kMultiInstall); 234 cmd_line.AppendSwitch(installer::switches::kMultiInstall);
229 if (install_level == SYSTEM_LEVEL) 235 if (install_level == SYSTEM_LEVEL)
230 cmd_line.AppendSwitch(installer::switches::kSystemLevel); 236 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
231 cmd_line.AppendSwitch(installer::switches::kChromeFrameQuickEnable); 237 cmd_line.AppendSwitch(installer::switches::kChromeFrameQuickEnable);
232 commands_.Set(installer::kCmdQuickEnableCf, 238 AppCommand app_cmd(cmd_line.GetCommandLineString());
233 AppCommand(cmd_line.GetCommandLineString(), true, true)); 239 app_cmd.set_sends_pings(true);
240 app_cmd.set_is_web_accessible(true);
241 commands_.Set(installer::kCmdQuickEnableCf, app_cmd);
242 }
243
244 // Adds the "on-os-upgrade" Google Update product command.
245 void FakeProductState::AddOsUpgradeCommand(BrowserDistribution::Type dist_type,
246 Level install_level,
247 const char* version,
248 int channel_modifiers) {
249 // Right now only Chrome browser uses this.
250 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BROWSER);
251
252 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version,
253 channel_modifiers));
254 cmd_line.AppendSwitch(installer::switches::kOnOsUpgrade);
255 // Imitating ChromeBrowserOperations::AppendProductFlags().
256 if ((channel_modifiers & CM_MULTI) != 0) {
257 cmd_line.AppendSwitch(installer::switches::kMultiInstall);
258 cmd_line.AppendSwitch(installer::switches::kChrome);
259 }
260 if (install_level == SYSTEM_LEVEL)
261 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
262 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
263 AppCommand app_cmd(cmd_line.GetCommandLineString());
264 app_cmd.set_is_auto_run_on_os_upgrade(true);
265 commands_.Set(installer::kCmdOnOsUpgrade, app_cmd);
234 } 266 }
235 267
236 } // namespace 268 } // namespace
237 269
238 // Fixture for testing the InstallationValidator. Errors logged by the 270 // Fixture for testing the InstallationValidator. Errors logged by the
239 // validator are sent to an optional mock recipient (see 271 // validator are sent to an optional mock recipient (see
240 // set_validation_error_recipient) upon which expectations can be placed. 272 // set_validation_error_recipient) upon which expectations can be placed.
241 class InstallationValidatorTest 273 class InstallationValidatorTest
242 : public testing::TestWithParam<InstallationValidator::InstallationType> { 274 : public testing::TestWithParam<InstallationValidator::InstallationType> {
243 public: 275 public:
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) { 455 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) {
424 state->AddQuickEnableCfCommand(prod_type, install_level, 456 state->AddQuickEnableCfCommand(prod_type, install_level,
425 chrome::kChromeVersion, channel_modifiers); 457 chrome::kChromeVersion, channel_modifiers);
426 } 458 }
427 if (prod_type == BrowserDistribution::CHROME_BINARIES) { 459 if (prod_type == BrowserDistribution::CHROME_BINARIES) {
428 state->AddQuickEnableApplicationHostCommand(prod_type, 460 state->AddQuickEnableApplicationHostCommand(prod_type,
429 install_level, 461 install_level,
430 chrome::kChromeVersion, 462 chrome::kChromeVersion,
431 channel_modifiers); 463 channel_modifiers);
432 } 464 }
465 if (prod_type == BrowserDistribution::CHROME_BROWSER) {
466 state->AddOsUpgradeCommand(prod_type,
467 install_level,
468 chrome::kChromeVersion,
469 channel_modifiers);
470 }
433 } 471 }
434 472
435 // static 473 // static
436 // Populates |state| with the state of a valid installation of |inst_type|. 474 // Populates |state| with the state of a valid installation of |inst_type|.
437 void InstallationValidatorTest::MakeMachineState( 475 void InstallationValidatorTest::MakeMachineState(
438 InstallationValidator::InstallationType inst_type, 476 InstallationValidator::InstallationType inst_type,
439 Level install_level, 477 Level install_level,
440 Channel channel, 478 Channel channel,
441 Vehicle vehicle, 479 Vehicle vehicle,
442 FakeInstallationState* state) { 480 FakeInstallationState* state) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 InstallationValidatorTest, 542 InstallationValidatorTest,
505 Values(InstallationValidator::NO_PRODUCTS, 543 Values(InstallationValidator::NO_PRODUCTS,
506 InstallationValidator::CHROME_SINGLE, 544 InstallationValidator::CHROME_SINGLE,
507 InstallationValidator::CHROME_MULTI, 545 InstallationValidator::CHROME_MULTI,
508 InstallationValidator::CHROME_FRAME_SINGLE, 546 InstallationValidator::CHROME_FRAME_SINGLE,
509 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, 547 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE,
510 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, 548 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI,
511 InstallationValidator::CHROME_FRAME_MULTI, 549 InstallationValidator::CHROME_FRAME_MULTI,
512 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, 550 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI,
513 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)); 551 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI));
OLDNEW
« no previous file with comments | « chrome/installer/util/installation_validator.cc ('k') | chrome/installer/util/util_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698