| OLD | NEW |
| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 EXPECT_TRUE(state.uninstall_command().command_line_string().empty()); | 296 EXPECT_TRUE(state.uninstall_command().command_line_string().empty()); |
| 297 EXPECT_EQ(0U, state.uninstall_command().GetSwitchCount()); | 297 EXPECT_EQ(0U, state.uninstall_command().GetSwitchCount()); |
| 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", | 306 EXPECT_EQ(L" --uninstall", state.uninstall_command().command_line_string()); |
| 307 state.uninstall_command().command_line_string()); | |
| 308 EXPECT_EQ(1U, state.uninstall_command().GetSwitchCount()); | 307 EXPECT_EQ(1U, state.uninstall_command().GetSwitchCount()); |
| 309 } | 308 } |
| 310 | 309 |
| 311 // Uninstall command without args. | 310 // Uninstall command without args. |
| 312 { | 311 { |
| 313 ProductState state; | 312 ProductState state; |
| 314 ApplyUninstallCommand(L"setup.exe", NULL); | 313 ApplyUninstallCommand(L"setup.exe", NULL); |
| 315 EXPECT_TRUE(state.Initialize(system_install_, dist_)); | 314 EXPECT_TRUE(state.Initialize(system_install_, dist_)); |
| 316 EXPECT_EQ(L"setup.exe", state.GetSetupPath().value()); | 315 EXPECT_EQ(L"setup.exe", state.GetSetupPath().value()); |
| 317 EXPECT_EQ(L"\"setup.exe\"", | 316 EXPECT_EQ(L"setup.exe", state.uninstall_command().command_line_string()); |
| 318 state.uninstall_command().command_line_string()); | |
| 319 EXPECT_EQ(0U, state.uninstall_command().GetSwitchCount()); | 317 EXPECT_EQ(0U, state.uninstall_command().GetSwitchCount()); |
| 320 } | 318 } |
| 321 | 319 |
| 320 // Uninstall command with exe that requires quoting. |
| 321 { |
| 322 ProductState state; |
| 323 ApplyUninstallCommand(L"set up.exe", NULL); |
| 324 EXPECT_TRUE(state.Initialize(system_install_, dist_)); |
| 325 EXPECT_EQ(L"set up.exe", state.GetSetupPath().value()); |
| 326 EXPECT_EQ(L"\"set up.exe\"", |
| 327 state.uninstall_command().command_line_string()); |
| 328 EXPECT_EQ(0U, state.uninstall_command().GetSwitchCount()); |
| 329 } |
| 330 |
| 322 // Uninstall command with both exe and args. | 331 // Uninstall command with both exe and args. |
| 323 { | 332 { |
| 324 ProductState state; | 333 ProductState state; |
| 325 ApplyUninstallCommand(L"setup.exe", L"--uninstall"); | 334 ApplyUninstallCommand(L"setup.exe", L"--uninstall"); |
| 326 EXPECT_TRUE(state.Initialize(system_install_, dist_)); | 335 EXPECT_TRUE(state.Initialize(system_install_, dist_)); |
| 327 EXPECT_EQ(L"setup.exe", state.GetSetupPath().value()); | 336 EXPECT_EQ(L"setup.exe", state.GetSetupPath().value()); |
| 328 EXPECT_EQ(L"\"setup.exe\" --uninstall", | 337 EXPECT_EQ(L"setup.exe --uninstall", |
| 329 state.uninstall_command().command_line_string()); | 338 state.uninstall_command().command_line_string()); |
| 330 EXPECT_EQ(1U, state.uninstall_command().GetSwitchCount()); | 339 EXPECT_EQ(1U, state.uninstall_command().GetSwitchCount()); |
| 331 } | 340 } |
| 332 } | 341 } |
| 333 | 342 |
| 334 // Test extraction of the msi marker from the ClientState key. | 343 // Test extraction of the msi marker from the ClientState key. |
| 335 TEST_F(ProductStateTest, InitializeMsi) { | 344 TEST_F(ProductStateTest, InitializeMsi) { |
| 336 MinimallyInstallProduct(L"10.0.1.1"); | 345 MinimallyInstallProduct(L"10.0.1.1"); |
| 337 | 346 |
| 338 // No msi marker. | 347 // No msi marker. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 416 |
| 408 // Uninstall command with --multi-install is multi install. | 417 // Uninstall command with --multi-install is multi install. |
| 409 { | 418 { |
| 410 ProductState state; | 419 ProductState state; |
| 411 ApplyUninstallCommand(L"setup.exe", | 420 ApplyUninstallCommand(L"setup.exe", |
| 412 L"--uninstall --chrome --multi-install"); | 421 L"--uninstall --chrome --multi-install"); |
| 413 EXPECT_TRUE(state.Initialize(system_install_, dist_)); | 422 EXPECT_TRUE(state.Initialize(system_install_, dist_)); |
| 414 EXPECT_TRUE(state.is_multi_install()); | 423 EXPECT_TRUE(state.is_multi_install()); |
| 415 } | 424 } |
| 416 } | 425 } |
| OLD | NEW |