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

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

Issue 7386002: Rename CommandLine::GetCommandLineString(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge, use writable string copies, restore TODO comment and empty string compare. Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <windows.h> 5 #include <windows.h>
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "base/version.h" 8 #include "base/version.h"
9 #include "base/win/registry.h" 9 #include "base/win/registry.h"
10 #include "chrome/installer/util/browser_distribution.h" 10 #include "chrome/installer/util/browser_distribution.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // key. 276 // key.
277 TEST_F(ProductStateTest, InitializeUninstallCommand) { 277 TEST_F(ProductStateTest, InitializeUninstallCommand) {
278 MinimallyInstallProduct(L"10.0.1.1"); 278 MinimallyInstallProduct(L"10.0.1.1");
279 279
280 // No uninstall command. 280 // No uninstall command.
281 { 281 {
282 ProductState state; 282 ProductState state;
283 ApplyUninstallCommand(NULL, NULL); 283 ApplyUninstallCommand(NULL, NULL);
284 EXPECT_TRUE(state.Initialize(system_install_, dist_)); 284 EXPECT_TRUE(state.Initialize(system_install_, dist_));
285 EXPECT_TRUE(state.GetSetupPath().empty()); 285 EXPECT_TRUE(state.GetSetupPath().empty());
286 EXPECT_TRUE(state.uninstall_command().command_line_string().empty()); 286 EXPECT_TRUE(state.uninstall_command().GetCommandLineString().empty());
287 EXPECT_TRUE(state.uninstall_command().GetSwitches().empty()); 287 EXPECT_TRUE(state.uninstall_command().GetSwitches().empty());
288 } 288 }
289 289
290 // Empty values. 290 // Empty values.
291 { 291 {
292 ProductState state; 292 ProductState state;
293 ApplyUninstallCommand(L"", L""); 293 ApplyUninstallCommand(L"", L"");
294 EXPECT_TRUE(state.Initialize(system_install_, dist_)); 294 EXPECT_TRUE(state.Initialize(system_install_, dist_));
295 EXPECT_TRUE(state.GetSetupPath().empty()); 295 EXPECT_TRUE(state.GetSetupPath().empty());
296 EXPECT_TRUE(state.uninstall_command().command_line_string().empty()); 296 EXPECT_TRUE(state.uninstall_command().GetCommandLineString().empty());
297 EXPECT_TRUE(state.uninstall_command().GetSwitches().empty()); 297 EXPECT_TRUE(state.uninstall_command().GetSwitches().empty());
298 } 298 }
299 299
300 // Uninstall command without exe. 300 // Uninstall command without exe.
301 { 301 {
302 ProductState state; 302 ProductState state;
303 ApplyUninstallCommand(NULL, L"--uninstall"); 303 ApplyUninstallCommand(NULL, L"--uninstall");
304 EXPECT_TRUE(state.Initialize(system_install_, dist_)); 304 EXPECT_TRUE(state.Initialize(system_install_, dist_));
305 EXPECT_TRUE(state.GetSetupPath().empty()); 305 EXPECT_TRUE(state.GetSetupPath().empty());
306 EXPECT_EQ(L" --uninstall", state.uninstall_command().command_line_string()); 306 EXPECT_EQ(L" --uninstall",
307 state.uninstall_command().GetCommandLineString());
307 EXPECT_EQ(1U, state.uninstall_command().GetSwitches().size()); 308 EXPECT_EQ(1U, state.uninstall_command().GetSwitches().size());
308 } 309 }
309 310
310 // Uninstall command without args. 311 // Uninstall command without args.
311 { 312 {
312 ProductState state; 313 ProductState state;
313 ApplyUninstallCommand(L"setup.exe", NULL); 314 ApplyUninstallCommand(L"setup.exe", NULL);
314 EXPECT_TRUE(state.Initialize(system_install_, dist_)); 315 EXPECT_TRUE(state.Initialize(system_install_, dist_));
315 EXPECT_EQ(L"setup.exe", state.GetSetupPath().value()); 316 EXPECT_EQ(L"setup.exe", state.GetSetupPath().value());
316 EXPECT_EQ(L"setup.exe", state.uninstall_command().command_line_string()); 317 EXPECT_EQ(L"setup.exe", state.uninstall_command().GetCommandLineString());
317 EXPECT_TRUE(state.uninstall_command().GetSwitches().empty()); 318 EXPECT_TRUE(state.uninstall_command().GetSwitches().empty());
318 } 319 }
319 320
320 // Uninstall command with exe that requires quoting. 321 // Uninstall command with exe that requires quoting.
321 { 322 {
322 ProductState state; 323 ProductState state;
323 ApplyUninstallCommand(L"set up.exe", NULL); 324 ApplyUninstallCommand(L"set up.exe", NULL);
324 EXPECT_TRUE(state.Initialize(system_install_, dist_)); 325 EXPECT_TRUE(state.Initialize(system_install_, dist_));
325 EXPECT_EQ(L"set up.exe", state.GetSetupPath().value()); 326 EXPECT_EQ(L"set up.exe", state.GetSetupPath().value());
326 EXPECT_EQ(L"\"set up.exe\"", 327 EXPECT_EQ(L"\"set up.exe\"",
327 state.uninstall_command().command_line_string()); 328 state.uninstall_command().GetCommandLineString());
328 EXPECT_TRUE(state.uninstall_command().GetSwitches().empty()); 329 EXPECT_TRUE(state.uninstall_command().GetSwitches().empty());
329 } 330 }
330 331
331 // Uninstall command with both exe and args. 332 // Uninstall command with both exe and args.
332 { 333 {
333 ProductState state; 334 ProductState state;
334 ApplyUninstallCommand(L"setup.exe", L"--uninstall"); 335 ApplyUninstallCommand(L"setup.exe", L"--uninstall");
335 EXPECT_TRUE(state.Initialize(system_install_, dist_)); 336 EXPECT_TRUE(state.Initialize(system_install_, dist_));
336 EXPECT_EQ(L"setup.exe", state.GetSetupPath().value()); 337 EXPECT_EQ(L"setup.exe", state.GetSetupPath().value());
337 EXPECT_EQ(L"setup.exe --uninstall", 338 EXPECT_EQ(L"setup.exe --uninstall",
338 state.uninstall_command().command_line_string()); 339 state.uninstall_command().GetCommandLineString());
339 EXPECT_EQ(1U, state.uninstall_command().GetSwitches().size()); 340 EXPECT_EQ(1U, state.uninstall_command().GetSwitches().size());
340 } 341 }
341 } 342 }
342 343
343 // Test extraction of the msi marker from the ClientState key. 344 // Test extraction of the msi marker from the ClientState key.
344 TEST_F(ProductStateTest, InitializeMsi) { 345 TEST_F(ProductStateTest, InitializeMsi) {
345 MinimallyInstallProduct(L"10.0.1.1"); 346 MinimallyInstallProduct(L"10.0.1.1");
346 347
347 // No msi marker. 348 // No msi marker.
348 { 349 {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 417
417 // Uninstall command with --multi-install is multi install. 418 // Uninstall command with --multi-install is multi install.
418 { 419 {
419 ProductState state; 420 ProductState state;
420 ApplyUninstallCommand(L"setup.exe", 421 ApplyUninstallCommand(L"setup.exe",
421 L"--uninstall --chrome --multi-install"); 422 L"--uninstall --chrome --multi-install");
422 EXPECT_TRUE(state.Initialize(system_install_, dist_)); 423 EXPECT_TRUE(state.Initialize(system_install_, dist_));
423 EXPECT_TRUE(state.is_multi_install()); 424 EXPECT_TRUE(state.is_multi_install());
424 } 425 }
425 } 426 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698