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

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

Issue 10818021: Revert 147650 - Implement installation of the Chrome App Host. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1215/src/
Patch Set: Created 8 years, 4 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 AddQuickEnableApplicationHostCommand(BrowserDistribution::Type dist_type,
82 Level install_level,
83 const char* version,
84 int channel_modifiers);
85 void AddQuickEnableCfCommand(BrowserDistribution::Type dist_type, 81 void AddQuickEnableCfCommand(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);
85 void RemoveQuickEnableCfCommand(BrowserDistribution::Type dist_type);
89 void set_multi_install(bool is_multi_install) { 86 void set_multi_install(bool is_multi_install) {
90 multi_install_ = is_multi_install; 87 multi_install_ = is_multi_install;
91 } 88 }
92 installer::AppCommands& commands() { return commands_; } 89 installer::AppCommands& commands() { return commands_; }
93 90
94 protected: 91 protected:
95 struct ChannelMethodForModifier { 92 struct ChannelMethodForModifier {
96 ChannelModifier modifier; 93 ChannelModifier modifier;
97 bool (ChannelInfo::*method)(bool value); 94 bool (ChannelInfo::*method)(bool value);
98 }; 95 };
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 installer::switches::kChromeFrameReadyMode); 187 installer::switches::kChromeFrameReadyMode);
191 } 188 }
192 } 189 }
193 } else if (dist_type == BrowserDistribution::CHROME_FRAME) { 190 } else if (dist_type == BrowserDistribution::CHROME_FRAME) {
194 uninstall_command_.AppendSwitch(installer::switches::kChromeFrame); 191 uninstall_command_.AppendSwitch(installer::switches::kChromeFrame);
195 } 192 }
196 if (vehicle == MSI) 193 if (vehicle == MSI)
197 uninstall_command_.AppendSwitch(installer::switches::kMsi); 194 uninstall_command_.AppendSwitch(installer::switches::kMsi);
198 } 195 }
199 196
200 // Adds the "quick-enable-application-host" Google Update product command.
201 void FakeProductState::AddQuickEnableApplicationHostCommand(
202 BrowserDistribution::Type dist_type,
203 Level install_level,
204 const char* version,
205 int channel_modifiers) {
206 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES);
207 DCHECK_NE(channel_modifiers & CM_MULTI, 0);
208
209 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version,
210 channel_modifiers));
211 cmd_line.AppendSwitch(installer::switches::kMultiInstall);
212 cmd_line.AppendSwitch(installer::switches::kChromeAppHost);
213 commands_.Set(installer::kCmdQuickEnableApplicationHost,
214 AppCommand(cmd_line.GetCommandLineString(), true, true));
215 }
216
217 // Adds the "quick-enable-cf" Google Update product command. 197 // Adds the "quick-enable-cf" Google Update product command.
218 void FakeProductState::AddQuickEnableCfCommand( 198 void FakeProductState::AddQuickEnableCfCommand(
219 BrowserDistribution::Type dist_type, 199 BrowserDistribution::Type dist_type,
220 Level install_level, 200 Level install_level,
221 const char* version, 201 const char* version,
222 int channel_modifiers) { 202 int channel_modifiers) {
223 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); 203 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES);
224 DCHECK_NE(channel_modifiers & CM_MULTI, 0); 204 DCHECK_NE(channel_modifiers & CM_MULTI, 0);
225 205
226 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, 206 CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version,
227 channel_modifiers)); 207 channel_modifiers));
228 cmd_line.AppendSwitch(installer::switches::kMultiInstall); 208 cmd_line.AppendSwitch(installer::switches::kMultiInstall);
229 if (install_level == SYSTEM_LEVEL) 209 if (install_level == SYSTEM_LEVEL)
230 cmd_line.AppendSwitch(installer::switches::kSystemLevel); 210 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
231 cmd_line.AppendSwitch(installer::switches::kChromeFrameQuickEnable); 211 cmd_line.AppendSwitch(installer::switches::kChromeFrameQuickEnable);
232 commands_.Set(installer::kCmdQuickEnableCf, 212 commands_.Set(installer::kCmdQuickEnableCf,
233 AppCommand(cmd_line.GetCommandLineString(), true, true)); 213 AppCommand(cmd_line.GetCommandLineString(), true, true));
234 } 214 }
235 215
216 // Removes the "quick-enable-cf" Google Update product command.
217 void FakeProductState::RemoveQuickEnableCfCommand(
218 BrowserDistribution::Type dist_type) {
219 DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES);
220
221 commands_.Remove(installer::kCmdQuickEnableCf);
222 }
223
236 } // namespace 224 } // namespace
237 225
238 // Fixture for testing the InstallationValidator. Errors logged by the 226 // Fixture for testing the InstallationValidator. Errors logged by the
239 // validator are sent to an optional mock recipient (see 227 // validator are sent to an optional mock recipient (see
240 // set_validation_error_recipient) upon which expectations can be placed. 228 // set_validation_error_recipient) upon which expectations can be placed.
241 class InstallationValidatorTest 229 class InstallationValidatorTest
242 : public testing::TestWithParam<InstallationValidator::InstallationType> { 230 : public testing::TestWithParam<InstallationValidator::InstallationType> {
243 public: 231 public:
244 232
245 // 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion, 405 state->SetUninstallCommand(prod_type, install_level, chrome::kChromeVersion,
418 channel_modifiers, vehicle); 406 channel_modifiers, vehicle);
419 state->set_multi_install(is_multi_install); 407 state->set_multi_install(is_multi_install);
420 if (prod_type == BrowserDistribution::CHROME_BINARIES && 408 if (prod_type == BrowserDistribution::CHROME_BINARIES &&
421 (inst_type == InstallationValidator::CHROME_MULTI || 409 (inst_type == InstallationValidator::CHROME_MULTI ||
422 inst_type == 410 inst_type ==
423 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) { 411 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)) {
424 state->AddQuickEnableCfCommand(prod_type, install_level, 412 state->AddQuickEnableCfCommand(prod_type, install_level,
425 chrome::kChromeVersion, channel_modifiers); 413 chrome::kChromeVersion, channel_modifiers);
426 } 414 }
427 if (prod_type == BrowserDistribution::CHROME_BINARIES) {
428 state->AddQuickEnableApplicationHostCommand(prod_type,
429 install_level,
430 chrome::kChromeVersion,
431 channel_modifiers);
432 }
433 } 415 }
434 416
435 // static 417 // static
436 // Populates |state| with the state of a valid installation of |inst_type|. 418 // Populates |state| with the state of a valid installation of |inst_type|.
437 void InstallationValidatorTest::MakeMachineState( 419 void InstallationValidatorTest::MakeMachineState(
438 InstallationValidator::InstallationType inst_type, 420 InstallationValidator::InstallationType inst_type,
439 Level install_level, 421 Level install_level,
440 Channel channel, 422 Channel channel,
441 Vehicle vehicle, 423 Vehicle vehicle,
442 FakeInstallationState* state) { 424 FakeInstallationState* state) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 InstallationValidatorTest, 486 InstallationValidatorTest,
505 Values(InstallationValidator::NO_PRODUCTS, 487 Values(InstallationValidator::NO_PRODUCTS,
506 InstallationValidator::CHROME_SINGLE, 488 InstallationValidator::CHROME_SINGLE,
507 InstallationValidator::CHROME_MULTI, 489 InstallationValidator::CHROME_MULTI,
508 InstallationValidator::CHROME_FRAME_SINGLE, 490 InstallationValidator::CHROME_FRAME_SINGLE,
509 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE, 491 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE,
510 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI, 492 InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI,
511 InstallationValidator::CHROME_FRAME_MULTI, 493 InstallationValidator::CHROME_FRAME_MULTI,
512 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, 494 InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI,
513 InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI)); 495 InstallationValidator::CHROME_FRAME_READY_MODE_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