diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-24 17:02:31 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-03-02 15:47:43 -0600 |
| commit | b5c4d92528dd088d0065c634eb1a353c424a4441 (patch) | |
| tree | 428d6caf8bd414f0735b5fbc28b1add950324d15 /src/test/BurnUnitTest/RegistrationTest.cpp | |
| parent | a98115d996d65834e7c8d593c10d2cfa66096ccd (diff) | |
| download | wix-b5c4d92528dd088d0065c634eb1a353c424a4441.tar.gz wix-b5c4d92528dd088d0065c634eb1a353c424a4441.tar.bz2 wix-b5c4d92528dd088d0065c634eb1a353c424a4441.zip | |
Always remove all dependencies the bundle could have registered.
#6297
Diffstat (limited to 'src/test/BurnUnitTest/RegistrationTest.cpp')
| -rw-r--r-- | src/test/BurnUnitTest/RegistrationTest.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/test/BurnUnitTest/RegistrationTest.cpp b/src/test/BurnUnitTest/RegistrationTest.cpp index 9c7bf4ce..1687385b 100644 --- a/src/test/BurnUnitTest/RegistrationTest.cpp +++ b/src/test/BurnUnitTest/RegistrationTest.cpp | |||
| @@ -71,6 +71,7 @@ namespace Bootstrapper | |||
| 71 | BOOTSTRAPPER_COMMAND command = { }; | 71 | BOOTSTRAPPER_COMMAND command = { }; |
| 72 | BURN_REGISTRATION registration = { }; | 72 | BURN_REGISTRATION registration = { }; |
| 73 | BURN_LOGGING logging = { }; | 73 | BURN_LOGGING logging = { }; |
| 74 | BURN_PACKAGES packages = { }; | ||
| 74 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 75 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); |
| 75 | try | 76 | try |
| 76 | { | 77 | { |
| @@ -121,7 +122,7 @@ namespace Bootstrapper | |||
| 121 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)(Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr))); | 122 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)(Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr))); |
| 122 | 123 | ||
| 123 | // end session | 124 | // end session |
| 124 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); | 125 | hr = RegistrationSessionEnd(®istration, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); |
| 125 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); | 126 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); |
| 126 | 127 | ||
| 127 | // verify that registration was removed | 128 | // verify that registration was removed |
| @@ -159,6 +160,7 @@ namespace Bootstrapper | |||
| 159 | BOOTSTRAPPER_COMMAND command = { }; | 160 | BOOTSTRAPPER_COMMAND command = { }; |
| 160 | BURN_REGISTRATION registration = { }; | 161 | BURN_REGISTRATION registration = { }; |
| 161 | BURN_LOGGING logging = { }; | 162 | BURN_LOGGING logging = { }; |
| 163 | BURN_PACKAGES packages = { }; | ||
| 162 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 164 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); |
| 163 | try | 165 | try |
| 164 | { | 166 | { |
| @@ -210,7 +212,7 @@ namespace Bootstrapper | |||
| 210 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 212 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
| 211 | 213 | ||
| 212 | // complete registration | 214 | // complete registration |
| 213 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); | 215 | hr = RegistrationSessionEnd(®istration, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); |
| 214 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); | 216 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); |
| 215 | 217 | ||
| 216 | // verify that registration was updated | 218 | // verify that registration was updated |
| @@ -232,7 +234,7 @@ namespace Bootstrapper | |||
| 232 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 234 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
| 233 | 235 | ||
| 234 | // delete registration | 236 | // delete registration |
| 235 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); | 237 | hr = RegistrationSessionEnd(®istration, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); |
| 236 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); | 238 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); |
| 237 | 239 | ||
| 238 | // verify that registration was removed | 240 | // verify that registration was removed |
| @@ -269,6 +271,7 @@ namespace Bootstrapper | |||
| 269 | BOOTSTRAPPER_COMMAND command = { }; | 271 | BOOTSTRAPPER_COMMAND command = { }; |
| 270 | BURN_REGISTRATION registration = { }; | 272 | BURN_REGISTRATION registration = { }; |
| 271 | BURN_LOGGING logging = { }; | 273 | BURN_LOGGING logging = { }; |
| 274 | BURN_PACKAGES packages = { }; | ||
| 272 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); | 275 | String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}")); |
| 273 | try | 276 | try |
| 274 | { | 277 | { |
| @@ -322,7 +325,7 @@ namespace Bootstrapper | |||
| 322 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 325 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
| 323 | 326 | ||
| 324 | // finish registration | 327 | // finish registration |
| 325 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); | 328 | hr = RegistrationSessionEnd(®istration, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); |
| 326 | TestThrowOnFailure(hr, L"Failed to register bundle."); | 329 | TestThrowOnFailure(hr, L"Failed to register bundle."); |
| 327 | 330 | ||
| 328 | // verify that registration was updated | 331 | // verify that registration was updated |
| @@ -355,7 +358,7 @@ namespace Bootstrapper | |||
| 355 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 358 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
| 356 | 359 | ||
| 357 | // delete registration | 360 | // delete registration |
| 358 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); | 361 | hr = RegistrationSessionEnd(®istration, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); |
| 359 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); | 362 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); |
| 360 | 363 | ||
| 361 | // verify that registration was removed | 364 | // verify that registration was removed |
| @@ -392,6 +395,7 @@ namespace Bootstrapper | |||
| 392 | BOOTSTRAPPER_COMMAND command = { }; | 395 | BOOTSTRAPPER_COMMAND command = { }; |
| 393 | BURN_REGISTRATION registration = { }; | 396 | BURN_REGISTRATION registration = { }; |
| 394 | BURN_LOGGING logging = { }; | 397 | BURN_LOGGING logging = { }; |
| 398 | BURN_PACKAGES packages = { }; | ||
| 395 | BYTE rgbData[256] = { }; | 399 | BYTE rgbData[256] = { }; |
| 396 | BOOTSTRAPPER_RESUME_TYPE resumeType = BOOTSTRAPPER_RESUME_TYPE_NONE; | 400 | BOOTSTRAPPER_RESUME_TYPE resumeType = BOOTSTRAPPER_RESUME_TYPE_NONE; |
| 397 | BYTE* pbBuffer = NULL; | 401 | BYTE* pbBuffer = NULL; |
| @@ -459,7 +463,7 @@ namespace Bootstrapper | |||
| 459 | Assert::Equal((int)BOOTSTRAPPER_RESUME_TYPE_INTERRUPTED, (int)resumeType); | 463 | Assert::Equal((int)BOOTSTRAPPER_RESUME_TYPE_INTERRUPTED, (int)resumeType); |
| 460 | 464 | ||
| 461 | // suspend session | 465 | // suspend session |
| 462 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_SUSPEND, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); | 466 | hr = RegistrationSessionEnd(®istration, &packages, BURN_RESUME_MODE_SUSPEND, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); |
| 463 | TestThrowOnFailure(hr, L"Failed to suspend session."); | 467 | TestThrowOnFailure(hr, L"Failed to suspend session."); |
| 464 | 468 | ||
| 465 | // verify that run key was removed | 469 | // verify that run key was removed |
| @@ -486,7 +490,7 @@ namespace Bootstrapper | |||
| 486 | Assert::NotEqual((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 490 | Assert::NotEqual((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
| 487 | 491 | ||
| 488 | // end session | 492 | // end session |
| 489 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); | 493 | hr = RegistrationSessionEnd(®istration, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); |
| 490 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); | 494 | TestThrowOnFailure(hr, L"Failed to unregister bundle."); |
| 491 | 495 | ||
| 492 | // read resume type after session | 496 | // read resume type after session |
