diff options
author | Rob Mensching <rob@firegiant.com> | 2024-03-07 01:44:51 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-03-07 10:55:57 -0800 |
commit | dea25ba9bcfd65200b60339c2e4bc060cdf20723 (patch) | |
tree | 91dae5127a7eeb4f0e59252194fc7ec7153a2781 /src/ext/Bal/test | |
parent | 3d2d46f62fc01e2653d0251ad9703090574e7c41 (diff) | |
download | wix-dea25ba9bcfd65200b60339c2e4bc060cdf20723.tar.gz wix-dea25ba9bcfd65200b60339c2e4bc060cdf20723.tar.bz2 wix-dea25ba9bcfd65200b60339c2e4bc060cdf20723.zip |
Move wixstdba functions to Bal.wixext build
Diffstat (limited to 'src/ext/Bal/test')
9 files changed, 267 insertions, 0 deletions
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/BAFunctionsTests.cpp b/src/ext/Bal/test/WixStdFnUnitTest/BAFunctionsTests.cpp new file mode 100644 index 00000000..ba04c1bb --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/BAFunctionsTests.cpp | |||
@@ -0,0 +1,47 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | using namespace System; | ||
6 | using namespace Xunit; | ||
7 | using namespace WixInternal::TestSupport; | ||
8 | using namespace WixInternal::TestSupport::XunitExtensions; | ||
9 | |||
10 | namespace BalUtilTests | ||
11 | { | ||
12 | public ref class BAFunctions | ||
13 | { | ||
14 | public: | ||
15 | [Fact(Skip = "Need a mock implementation of IBootstrapperEngine to test BAFunctions.")] | ||
16 | void CanCreateTestBAFunctions() | ||
17 | { | ||
18 | HRESULT hr = S_OK; | ||
19 | BA_FUNCTIONS_CREATE_ARGS args = { }; | ||
20 | BA_FUNCTIONS_CREATE_RESULTS results = { }; | ||
21 | IBootstrapperEngine* pEngine = NULL; | ||
22 | BOOTSTRAPPER_COMMAND command = { }; | ||
23 | IBAFunctions* pBAFunctions = NULL; | ||
24 | |||
25 | args.cbSize = sizeof(args); | ||
26 | args.pEngine = pEngine; | ||
27 | args.pCommand = &command; | ||
28 | |||
29 | results.cbSize = sizeof(results); | ||
30 | |||
31 | try | ||
32 | { | ||
33 | BalInitialize(pEngine); | ||
34 | |||
35 | hr = CreateBAFunctions(NULL, &args, &results); | ||
36 | NativeAssert::Succeeded(hr, "Failed to create BAFunctions."); | ||
37 | |||
38 | pBAFunctions = reinterpret_cast<IBAFunctions*>(results.pvBAFunctionsProcContext); | ||
39 | } | ||
40 | finally | ||
41 | { | ||
42 | ReleaseObject(pEngine); | ||
43 | ReleaseObject(pBAFunctions); | ||
44 | } | ||
45 | } | ||
46 | }; | ||
47 | } | ||
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.cpp b/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.cpp new file mode 100644 index 00000000..3e850442 --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.cpp | |||
@@ -0,0 +1,39 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | #include "BalBaseBAFunctions.h" | ||
5 | #include "BalBaseBAFunctionsProc.h" | ||
6 | |||
7 | class CTestBAFunctions : public CBalBaseBAFunctions | ||
8 | { | ||
9 | public: | ||
10 | CTestBAFunctions( | ||
11 | __in HMODULE hModule | ||
12 | ) : CBalBaseBAFunctions(hModule) | ||
13 | { | ||
14 | } | ||
15 | }; | ||
16 | |||
17 | HRESULT CreateBAFunctions( | ||
18 | __in HMODULE hModule, | ||
19 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
20 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
21 | ) | ||
22 | { | ||
23 | HRESULT hr = S_OK; | ||
24 | CTestBAFunctions* pFunction = NULL; | ||
25 | |||
26 | pFunction = new CTestBAFunctions(hModule); | ||
27 | ExitOnNull(pFunction, hr, E_OUTOFMEMORY, "Failed to create new test bafunctions object."); | ||
28 | |||
29 | hr = pFunction->OnCreate(pArgs->pEngine, pArgs->pCommand); | ||
30 | ExitOnFailure(hr, "Failed to initialize new test bafunctions."); | ||
31 | |||
32 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; | ||
33 | pResults->pvBAFunctionsProcContext = pFunction; | ||
34 | pFunction = NULL; | ||
35 | |||
36 | LExit: | ||
37 | ReleaseObject(pFunction); | ||
38 | return hr; | ||
39 | } | ||
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.h b/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.h new file mode 100644 index 00000000..e25e40c3 --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/TestBAFunctions.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #pragma once | ||
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
3 | |||
4 | HRESULT CreateBAFunctions( | ||
5 | __in HMODULE hModule, | ||
6 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
7 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
8 | ); | ||
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.cpp b/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.cpp new file mode 100644 index 00000000..b345ab9f --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.cpp | |||
@@ -0,0 +1,30 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | #include "BalBaseBootstrapperApplication.h" | ||
5 | |||
6 | class CTestBootstrapperApplication : public CBalBaseBootstrapperApplication | ||
7 | { | ||
8 | public: | ||
9 | CTestBootstrapperApplication() : CBalBaseBootstrapperApplication() | ||
10 | { | ||
11 | } | ||
12 | }; | ||
13 | |||
14 | HRESULT CreateBootstrapperApplication( | ||
15 | __out IBootstrapperApplication** ppApplication | ||
16 | ) | ||
17 | { | ||
18 | HRESULT hr = S_OK; | ||
19 | CTestBootstrapperApplication* pApplication = NULL; | ||
20 | |||
21 | pApplication = new CTestBootstrapperApplication(); | ||
22 | ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bootstrapper application object."); | ||
23 | |||
24 | *ppApplication = pApplication; | ||
25 | pApplication = NULL; | ||
26 | |||
27 | LExit: | ||
28 | ReleaseObject(pApplication); | ||
29 | return hr; | ||
30 | } | ||
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.h b/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.h new file mode 100644 index 00000000..313bfede --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/TestBootstrapperApplication.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #pragma once | ||
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
3 | |||
4 | HRESULT CreateBootstrapperApplication( | ||
5 | __out IBootstrapperApplication** ppApplication | ||
6 | ); | ||
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.filters b/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.filters new file mode 100644 index 00000000..0b3b60be --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.filters | |||
@@ -0,0 +1,45 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ItemGroup> | ||
4 | <Filter Include="Source Files"> | ||
5 | <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
6 | <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
7 | </Filter> | ||
8 | <Filter Include="Header Files"> | ||
9 | <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
10 | <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
11 | </Filter> | ||
12 | <Filter Include="Resource Files"> | ||
13 | <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
14 | <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> | ||
15 | </Filter> | ||
16 | </ItemGroup> | ||
17 | <ItemGroup> | ||
18 | <ClCompile Include="BAFunctionsTests.cpp"> | ||
19 | <Filter>Source Files</Filter> | ||
20 | </ClCompile> | ||
21 | <ClCompile Include="BootstrapperApplicationTests.cpp"> | ||
22 | <Filter>Source Files</Filter> | ||
23 | </ClCompile> | ||
24 | <ClCompile Include="precomp.cpp"> | ||
25 | <Filter>Source Files</Filter> | ||
26 | </ClCompile> | ||
27 | <ClCompile Include="TestBAFunctions.cpp"> | ||
28 | <Filter>Source Files</Filter> | ||
29 | </ClCompile> | ||
30 | <ClCompile Include="TestBootstrapperApplication.cpp"> | ||
31 | <Filter>Source Files</Filter> | ||
32 | </ClCompile> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <ClInclude Include="precomp.h"> | ||
36 | <Filter>Header Files</Filter> | ||
37 | </ClInclude> | ||
38 | <ClInclude Include="TestBAFunctions.h"> | ||
39 | <Filter>Header Files</Filter> | ||
40 | </ClInclude> | ||
41 | <ClInclude Include="TestBootstrapperApplication.h"> | ||
42 | <Filter>Header Files</Filter> | ||
43 | </ClInclude> | ||
44 | </ItemGroup> | ||
45 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.vcxproj b/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.vcxproj new file mode 100644 index 00000000..c0be8e11 --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/WixStdFnUnitTest.vcxproj | |||
@@ -0,0 +1,62 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | |||
5 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
6 | <Import Project="..\..\..\..\internal\WixInternal.TestSupport.Native\build\WixInternal.TestSupport.Native.props" /> | ||
7 | |||
8 | <ItemGroup Label="ProjectConfigurations"> | ||
9 | <ProjectConfiguration Include="Debug|Win32"> | ||
10 | <Configuration>Debug</Configuration> | ||
11 | <Platform>Win32</Platform> | ||
12 | </ProjectConfiguration> | ||
13 | <ProjectConfiguration Include="Release|Win32"> | ||
14 | <Configuration>Release</Configuration> | ||
15 | <Platform>Win32</Platform> | ||
16 | </ProjectConfiguration> | ||
17 | </ItemGroup> | ||
18 | |||
19 | <PropertyGroup Label="Globals"> | ||
20 | <ProjectTypes>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}</ProjectTypes> | ||
21 | <ProjectGuid>{9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}</ProjectGuid> | ||
22 | <RootNamespace>UnitTest</RootNamespace> | ||
23 | <Keyword>ManagedCProj</Keyword> | ||
24 | <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
25 | <CharacterSet>Unicode</CharacterSet> | ||
26 | <CLRSupport>true</CLRSupport> | ||
27 | <SignOutput>false</SignOutput> | ||
28 | <IsWixTestProject>true</IsWixTestProject> | ||
29 | </PropertyGroup> | ||
30 | |||
31 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
32 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
33 | |||
34 | <PropertyGroup> | ||
35 | <ProjectAdditionalIncludeDirectories>..\..\..\..\api\burn\inc;..\..\..\..\api\burn\balutil\inc;..\..\wixstdfn\inc;..\..\..\..\libs\dutil\WixToolset.Dutil\inc</ProjectAdditionalIncludeDirectories> | ||
36 | <ProjectAdditionalLinkLibraries>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;$(RootBuildFolder)libs\$(Configuration)\$(WixNativeSdkLibraryToolset)\$(PlatformTarget)\dutil.lib;$(RootBuildFolder)api\$(Configuration)\$(WixNativeSdkLibraryToolset)\$(PlatformTarget)\balutil.lib</ProjectAdditionalLinkLibraries> | ||
37 | </PropertyGroup> | ||
38 | |||
39 | <ItemGroup> | ||
40 | <ClCompile Include="BAFunctionsTests.cpp" /> | ||
41 | <ClCompile Include="precomp.cpp"> | ||
42 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
43 | <!-- Warnings from referencing netstandard dlls --> | ||
44 | <DisableSpecificWarnings>4564;4691</DisableSpecificWarnings> | ||
45 | </ClCompile> | ||
46 | <ClCompile Include="TestBAFunctions.cpp" /> | ||
47 | </ItemGroup> | ||
48 | |||
49 | <ItemGroup> | ||
50 | <ClInclude Include="precomp.h" /> | ||
51 | <ClInclude Include="TestBAFunctions.h" /> | ||
52 | </ItemGroup> | ||
53 | |||
54 | <ItemGroup> | ||
55 | <ProjectReference Include="..\..\wixstdfn\wixstdfn.vcxproj"> | ||
56 | <Project>{D786C02F-9488-421F-A5A5-D1D31E8E648B}</Project> | ||
57 | </ProjectReference> | ||
58 | </ItemGroup> | ||
59 | |||
60 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
61 | <Import Project="..\..\..\..\internal\WixInternal.TestSupport.Native\build\WixInternal.TestSupport.Native.targets" /> | ||
62 | </Project> | ||
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/precomp.cpp b/src/ext/Bal/test/WixStdFnUnitTest/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/precomp.cpp | |||
@@ -0,0 +1,3 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
diff --git a/src/ext/Bal/test/WixStdFnUnitTest/precomp.h b/src/ext/Bal/test/WixStdFnUnitTest/precomp.h new file mode 100644 index 00000000..4cdd262c --- /dev/null +++ b/src/ext/Bal/test/WixStdFnUnitTest/precomp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #pragma once | ||
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | |||
7 | #pragma warning(push) | ||
8 | #pragma warning(disable:4458) // declaration of 'xxx' hides class member | ||
9 | #include <gdiplus.h> | ||
10 | #pragma warning(pop) | ||
11 | |||
12 | #include <msiquery.h> | ||
13 | #include <CommCtrl.h> | ||
14 | |||
15 | #include <dutil.h> | ||
16 | #include <dictutil.h> | ||
17 | |||
18 | #include <IBootstrapperApplication.h> | ||
19 | #include <IBAFunctions.h> | ||
20 | #include <balutil.h> | ||
21 | #include <balretry.h> | ||
22 | |||
23 | #include "TestBAFunctions.h" | ||
24 | #include "TestBootstrapperApplication.h" | ||
25 | |||
26 | #pragma managed | ||
27 | #include <vcclr.h> | ||