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

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: Refactoring and nits. 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
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const char* version, 78 const char* version,
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);
huangs 2012/08/31 20:50:17 Need to declare void AddOsUpgradeCommand(...); h
89 void set_multi_install(bool is_multi_install) { 89 void set_multi_install(bool is_multi_install) {
90 multi_install_ = is_multi_install; 90 multi_install_ = is_multi_install;
91 } 91 }
92 installer::AppCommands& commands() { return commands_; } 92 installer::AppCommands& commands() { return commands_; }
93 93
94 protected: 94 protected:
95 struct ChannelMethodForModifier { 95 struct ChannelMethodForModifier {
96 ChannelModifier modifier; 96 ChannelModifier modifier;
97 bool (ChannelInfo::*method)(bool value); 97 bool (ChannelInfo::*method)(bool value);
98 }; 98 };
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 Level install_level, 203 Level install_level,
204 const char* version, 204 const char* version,
205 int channel_modifiers) { 205 int channel_modifiers) {
206 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); 206 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES);
207 DCHECK_NE(channel_modifiers & CM_MULTI, 0); 207 DCHECK_NE(channel_modifiers & CM_MULTI, 0);
208 208
209 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, 209 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version,
210 channel_modifiers)); 210 channel_modifiers));
211 cmd_line.AppendSwitch(installer::switches::kMultiInstall); 211 cmd_line.AppendSwitch(installer::switches::kMultiInstall);
212 cmd_line.AppendSwitch(installer::switches::kChromeAppHost); 212 cmd_line.AppendSwitch(installer::switches::kChromeAppHost);
213 commands_.Set(installer::kCmdQuickEnableApplicationHost, 213 AppCommand app_cmd(cmd_line.GetCommandLineString());
214 AppCommand(cmd_line.GetCommandLineString(), true, true)); 214 app_cmd.set_sends_pings(true);
215 app_cmd.set_is_web_accessible(true);
216 commands_.Set(installer::kCmdQuickEnableApplicationHost, app_cmd);
215 } 217 }
216 218
217 // Adds the "quick-enable-cf" Google Update product command. 219 // Adds the "quick-enable-cf" Google Update product command.
218 void FakeProductState::AddQuickEnableCfCommand( 220 void FakeProductState::AddQuickEnableCfCommand(
219 BrowserDistribution::Type dist_type, 221 BrowserDistribution::Type dist_type,
220 Level install_level, 222 Level install_level,
221 const char* version, 223 const char* version,
222 int channel_modifiers) { 224 int channel_modifiers) {
223 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); 225 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES);
224 DCHECK_NE(channel_modifiers & CM_MULTI, 0); 226 DCHECK_NE(channel_modifiers & CM_MULTI, 0);
225 227
226 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, 228 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version,
227 channel_modifiers)); 229 channel_modifiers));
228 cmd_line.AppendSwitch(installer::switches::kMultiInstall); 230 cmd_line.AppendSwitch(installer::switches::kMultiInstall);
229 if (install_level == SYSTEM_LEVEL) 231 if (install_level == SYSTEM_LEVEL)
230 cmd_line.AppendSwitch(installer::switches::kSystemLevel); 232 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
231 cmd_line.AppendSwitch(installer::switches::kChromeFrameQuickEnable); 233 cmd_line.AppendSwitch(installer::switches::kChromeFrameQuickEnable);
232 commands_.Set(installer::kCmdQuickEnableCf, 234 AppCommand app_cmd(cmd_line.GetCommandLineString());
233 AppCommand(cmd_line.GetCommandLineString(), true, true)); 235 app_cmd.set_sends_pings(true);
236 app_cmd.set_is_web_accessible(true);
237 commands_.Set(installer::kCmdQuickEnableCf, app_cmd);
234 } 238 }
huangs 2012/08/31 20:50:17 Need to implement void FakeProductState::AddOsUpgr
235 239
236 } // namespace 240 } // namespace
237 241
238 // Fixture for testing the InstallationValidator. Errors logged by the 242 // Fixture for testing the InstallationValidator. Errors logged by the
239 // validator are sent to an optional mock recipient (see 243 // validator are sent to an optional mock recipient (see
240 // set_validation_error_recipient) upon which expectations can be placed. 244 // set_validation_error_recipient) upon which expectations can be placed.
241 class InstallationValidatorTest 245 class InstallationValidatorTest
242 : public testing::TestWithParam<InstallationValidator::InstallationType> { 246 : public testing::TestWithParam<InstallationValidator::InstallationType> {
243 public: 247 public:
244 248
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 inst_type == 426 inst_type ==
423 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) { 427 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) {
424 state->AddQuickEnableCfCommand(prod_type, install_level, 428 state->AddQuickEnableCfCommand(prod_type, install_level,
425 chrome::kChromeVersion, channel_modifiers); 429 chrome::kChromeVersion, channel_modifiers);
426 } 430 }
427 if (prod_type == BrowserDistribution::CHROME_BINARIES) { 431 if (prod_type == BrowserDistribution::CHROME_BINARIES) {
428 state->AddQuickEnableApplicationHostCommand(prod_type, 432 state->AddQuickEnableApplicationHostCommand(prod_type,
429 install_level, 433 install_level,
430 chrome::kChromeVersion, 434 chrome::kChromeVersion,
431 channel_modifiers); 435 channel_modifiers);
432 } 436 }
huangs 2012/08/31 20:50:17 Need to call state->AddOsUpgradeCommand(...) here,
433 } 437 }
434 438
435 // static 439 // static
436 // Populates |state| with the state of a valid installation of |inst_type|. 440 // Populates |state| with the state of a valid installation of |inst_type|.
437 void InstallationValidatorTest::MakeMachineState( 441 void InstallationValidatorTest::MakeMachineState(
438 InstallationValidator::InstallationType inst_type, 442 InstallationValidator::InstallationType inst_type,
439 Level install_level, 443 Level install_level,
440 Channel channel, 444 Channel channel,
441 Vehicle vehicle, 445 Vehicle vehicle,
442 FakeInstallationState* state) { 446 FakeInstallationState* state) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 InstallationValidatorTest, 508 InstallationValidatorTest,
505 Values(InstallationValidator::NO_PRODUCTS, 509 Values(InstallationValidator::NO_PRODUCTS,
506 InstallationValidator::CHROME_SINGLE, 510 InstallationValidator::CHROME_SINGLE,
507 InstallationValidator::CHROME_MULTI, 511 InstallationValidator::CHROME_MULTI,
508 InstallationValidator::CHROME_FRAME_SINGLE, 512 InstallationValidator::CHROME_FRAME_SINGLE,
509 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, 513 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE,
510 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, 514 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI,
511 InstallationValidator::CHROME_FRAME_MULTI, 515 InstallationValidator::CHROME_FRAME_MULTI,
512 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, 516 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI,
513 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)); 517 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698