summaryrefslogtreecommitdiff
path: root/src/burn/test/BurnUnitTest/RegistrationTest.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-04-22 16:56:21 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-04-23 15:40:21 -0500
commita981e29d7a3df566754356c3fe1eb938a5cac4c1 (patch)
tree9d2b2abac872ae3c4917003812951e68b72e7163 /src/burn/test/BurnUnitTest/RegistrationTest.cpp
parent72e20f682c0d64102e86439ba5527dd0d71932ae (diff)
downloadwix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.tar.gz
wix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.tar.bz2
wix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.zip
Make the estimated size in ARP a little more accurate.
Fixes 4039
Diffstat (limited to 'src/burn/test/BurnUnitTest/RegistrationTest.cpp')
-rw-r--r--src/burn/test/BurnUnitTest/RegistrationTest.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/burn/test/BurnUnitTest/RegistrationTest.cpp b/src/burn/test/BurnUnitTest/RegistrationTest.cpp
index f01d92a4..0075e937 100644
--- a/src/burn/test/BurnUnitTest/RegistrationTest.cpp
+++ b/src/burn/test/BurnUnitTest/RegistrationTest.cpp
@@ -60,6 +60,7 @@ namespace Bootstrapper
60 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 60 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
61 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe")); 61 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe"));
62 DWORD dwRegistrationOptions = BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE; 62 DWORD dwRegistrationOptions = BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
63 DWORD64 qwEstimatedSize = 1024;
63 64
64 try 65 try
65 { 66 {
@@ -103,7 +104,7 @@ namespace Bootstrapper
103 TestThrowOnFailure(hr, L"Failed to get current process path."); 104 TestThrowOnFailure(hr, L"Failed to get current process path.");
104 105
105 // write registration 106 // write registration
106 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 107 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
107 TestThrowOnFailure(hr, L"Failed to register bundle."); 108 TestThrowOnFailure(hr, L"Failed to register bundle.");
108 109
109 // verify that registration was created 110 // verify that registration was created
@@ -114,7 +115,7 @@ namespace Bootstrapper
114 this->ValidateRunOnceKeyEntry(cacheExePath); 115 this->ValidateRunOnceKeyEntry(cacheExePath);
115 116
116 // end session 117 // end session
117 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); 118 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
118 TestThrowOnFailure(hr, L"Failed to unregister bundle."); 119 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
119 120
120 // verify that registration was removed 121 // verify that registration was removed
@@ -158,6 +159,7 @@ namespace Bootstrapper
158 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 159 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
159 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe")); 160 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe"));
160 DWORD dwRegistrationOptions = 0; 161 DWORD dwRegistrationOptions = 0;
162 DWORD64 qwEstimatedSize = 1024;
161 try 163 try
162 { 164 {
163 this->testRegistry->SetUp(); 165 this->testRegistry->SetUp();
@@ -204,7 +206,7 @@ namespace Bootstrapper
204 // 206 //
205 207
206 // write registration 208 // write registration
207 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 209 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
208 TestThrowOnFailure(hr, L"Failed to register bundle."); 210 TestThrowOnFailure(hr, L"Failed to register bundle.");
209 211
210 // verify that registration was created 212 // verify that registration was created
@@ -213,7 +215,7 @@ namespace Bootstrapper
213 this->ValidateRunOnceKeyEntry(cacheExePath); 215 this->ValidateRunOnceKeyEntry(cacheExePath);
214 216
215 // complete registration 217 // complete registration
216 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 218 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
217 TestThrowOnFailure(hr, L"Failed to unregister bundle."); 219 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
218 220
219 // verify that registration was updated 221 // verify that registration was updated
@@ -226,7 +228,7 @@ namespace Bootstrapper
226 // 228 //
227 229
228 // write registration 230 // write registration
229 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 231 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
230 TestThrowOnFailure(hr, L"Failed to register bundle."); 232 TestThrowOnFailure(hr, L"Failed to register bundle.");
231 233
232 // verify that registration was updated 234 // verify that registration was updated
@@ -235,7 +237,7 @@ namespace Bootstrapper
235 this->ValidateRunOnceKeyEntry(cacheExePath); 237 this->ValidateRunOnceKeyEntry(cacheExePath);
236 238
237 // delete registration 239 // delete registration
238 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); 240 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
239 TestThrowOnFailure(hr, L"Failed to unregister bundle."); 241 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
240 242
241 // verify that registration was removed 243 // verify that registration was removed
@@ -278,6 +280,7 @@ namespace Bootstrapper
278 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 280 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
279 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe")); 281 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe"));
280 DWORD dwRegistrationOptions = 0; 282 DWORD dwRegistrationOptions = 0;
283 DWORD64 qwEstimatedSize = 1024;
281 try 284 try
282 { 285 {
283 this->testRegistry->SetUp(); 286 this->testRegistry->SetUp();
@@ -327,7 +330,7 @@ namespace Bootstrapper
327 // 330 //
328 331
329 // write registration 332 // write registration
330 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 333 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
331 TestThrowOnFailure(hr, L"Failed to register bundle."); 334 TestThrowOnFailure(hr, L"Failed to register bundle.");
332 335
333 // verify that registration was created 336 // verify that registration was created
@@ -335,7 +338,7 @@ namespace Bootstrapper
335 this->ValidateRunOnceKeyEntry(cacheExePath); 338 this->ValidateRunOnceKeyEntry(cacheExePath);
336 339
337 // complete registration 340 // complete registration
338 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, BOOTSTRAPPER_REGISTRATION_TYPE_FULL); 341 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_FULL);
339 TestThrowOnFailure(hr, L"Failed to unregister bundle."); 342 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
340 343
341 // verify that registration variables were updated 344 // verify that registration variables were updated
@@ -355,7 +358,7 @@ namespace Bootstrapper
355 // 358 //
356 359
357 // delete registration 360 // delete registration
358 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); 361 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
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
@@ -398,6 +401,7 @@ namespace Bootstrapper
398 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 401 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
399 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe")); 402 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe"));
400 DWORD dwRegistrationOptions = 0; 403 DWORD dwRegistrationOptions = 0;
404 DWORD64 qwEstimatedSize = 1024;
401 try 405 try
402 { 406 {
403 this->testRegistry->SetUp(); 407 this->testRegistry->SetUp();
@@ -446,7 +450,7 @@ namespace Bootstrapper
446 // 450 //
447 451
448 // write registration 452 // write registration
449 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 453 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
450 TestThrowOnFailure(hr, L"Failed to register bundle."); 454 TestThrowOnFailure(hr, L"Failed to register bundle.");
451 455
452 // verify that registration was created 456 // verify that registration was created
@@ -454,7 +458,7 @@ namespace Bootstrapper
454 this->ValidateRunOnceKeyEntry(cacheExePath); 458 this->ValidateRunOnceKeyEntry(cacheExePath);
455 459
456 // finish registration 460 // finish registration
457 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_FULL); 461 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_FULL);
458 TestThrowOnFailure(hr, L"Failed to register bundle."); 462 TestThrowOnFailure(hr, L"Failed to register bundle.");
459 463
460 // verify that registration was updated 464 // verify that registration was updated
@@ -479,7 +483,7 @@ namespace Bootstrapper
479 // 483 //
480 484
481 // write registration 485 // write registration
482 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 486 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
483 TestThrowOnFailure(hr, L"Failed to register bundle."); 487 TestThrowOnFailure(hr, L"Failed to register bundle.");
484 488
485 // verify that registration was updated 489 // verify that registration was updated
@@ -487,7 +491,7 @@ namespace Bootstrapper
487 this->ValidateRunOnceKeyEntry(cacheExePath); 491 this->ValidateRunOnceKeyEntry(cacheExePath);
488 492
489 // delete registration 493 // delete registration
490 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); 494 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
491 TestThrowOnFailure(hr, L"Failed to unregister bundle."); 495 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
492 496
493 // verify that registration was removed 497 // verify that registration was removed
@@ -533,6 +537,7 @@ namespace Bootstrapper
533 BYTE* pbBuffer = NULL; 537 BYTE* pbBuffer = NULL;
534 SIZE_T cbBuffer = 0; 538 SIZE_T cbBuffer = 0;
535 DWORD dwRegistrationOptions = 0; 539 DWORD dwRegistrationOptions = 0;
540 DWORD64 qwEstimatedSize = 1024;
536 541
537 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 542 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
538 try 543 try
@@ -586,7 +591,7 @@ namespace Bootstrapper
586 TestThrowOnFailure(hr, L"Failed to get current process path."); 591 TestThrowOnFailure(hr, L"Failed to get current process path.");
587 592
588 // begin session 593 // begin session
589 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 594 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
590 TestThrowOnFailure(hr, L"Failed to register bundle."); 595 TestThrowOnFailure(hr, L"Failed to register bundle.");
591 596
592 VariableSetNumericHelper(&variables, L"MyBurnVariable1", 42); 597 VariableSetNumericHelper(&variables, L"MyBurnVariable1", 42);
@@ -629,7 +634,7 @@ namespace Bootstrapper
629 NativeAssert::StringEqual(L"42", sczValue); 634 NativeAssert::StringEqual(L"42", sczValue);
630 635
631 // end session 636 // end session
632 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); 637 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
633 TestThrowOnFailure(hr, L"Failed to unregister bundle."); 638 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
634 } 639 }
635 finally 640 finally
@@ -673,6 +678,7 @@ namespace Bootstrapper
673 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 678 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
674 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe")); 679 String^ cacheExePath = Path::Combine(cacheDirectory, gcnew String(L"setup.exe"));
675 DWORD dwRegistrationOptions = 0; 680 DWORD dwRegistrationOptions = 0;
681 DWORD64 qwEstimatedSize = 1024;
676 try 682 try
677 { 683 {
678 this->testRegistry->SetUp(); 684 this->testRegistry->SetUp();
@@ -728,7 +734,7 @@ namespace Bootstrapper
728 Assert::Equal((int)BOOTSTRAPPER_RESUME_TYPE_NONE, (int)resumeType); 734 Assert::Equal((int)BOOTSTRAPPER_RESUME_TYPE_NONE, (int)resumeType);
729 735
730 // begin session 736 // begin session
731 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, 0, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 737 hr = RegistrationSessionBegin(sczCurrentProcess, &registration, &cache, &variables, dwRegistrationOptions, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
732 TestThrowOnFailure(hr, L"Failed to register bundle."); 738 TestThrowOnFailure(hr, L"Failed to register bundle.");
733 739
734 VariableSetNumericHelper(&variables, L"MyBurnVariable1", 42); 740 VariableSetNumericHelper(&variables, L"MyBurnVariable1", 42);
@@ -767,7 +773,7 @@ namespace Bootstrapper
767 Assert::Equal((int)BOOTSTRAPPER_RESUME_TYPE_INTERRUPTED, (int)resumeType); 773 Assert::Equal((int)BOOTSTRAPPER_RESUME_TYPE_INTERRUPTED, (int)resumeType);
768 774
769 // suspend session 775 // suspend session
770 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_SUSPEND, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS); 776 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_SUSPEND, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS);
771 TestThrowOnFailure(hr, L"Failed to suspend session."); 777 TestThrowOnFailure(hr, L"Failed to suspend session.");
772 778
773 // verify that run key was removed 779 // verify that run key was removed
@@ -794,7 +800,7 @@ namespace Bootstrapper
794 this->ValidateRunOnceKeyEntry(cacheExePath); 800 this->ValidateRunOnceKeyEntry(cacheExePath);
795 801
796 // end session 802 // end session
797 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BOOTSTRAPPER_REGISTRATION_TYPE_NONE); 803 hr = RegistrationSessionEnd(&registration, &cache, &variables, &packages, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, qwEstimatedSize, BOOTSTRAPPER_REGISTRATION_TYPE_NONE);
798 TestThrowOnFailure(hr, L"Failed to unregister bundle."); 804 TestThrowOnFailure(hr, L"Failed to unregister bundle.");
799 805
800 // read resume type after session 806 // read resume type after session