diff options
Diffstat (limited to 'src/api/burn/test/BalUtilUnitTest')
7 files changed, 32 insertions, 59 deletions
diff --git a/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp b/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp index 2ae539ee..ba04c1bb 100644 --- a/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp +++ b/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp | |||
@@ -12,32 +12,30 @@ namespace BalUtilTests | |||
12 | public ref class BAFunctions | 12 | public ref class BAFunctions |
13 | { | 13 | { |
14 | public: | 14 | public: |
15 | [Fact] | 15 | [Fact(Skip = "Need a mock implementation of IBootstrapperEngine to test BAFunctions.")] |
16 | void CanCreateTestBAFunctions() | 16 | void CanCreateTestBAFunctions() |
17 | { | 17 | { |
18 | HRESULT hr = S_OK; | 18 | HRESULT hr = S_OK; |
19 | BOOTSTRAPPER_CREATE_ARGS bootstrapperArgs = { }; | ||
20 | BOOTSTRAPPER_COMMAND bootstrapperCommand = { }; | ||
21 | BA_FUNCTIONS_CREATE_ARGS args = { }; | 19 | BA_FUNCTIONS_CREATE_ARGS args = { }; |
22 | BA_FUNCTIONS_CREATE_RESULTS results = { }; | 20 | BA_FUNCTIONS_CREATE_RESULTS results = { }; |
23 | IBootstrapperEngine* pEngine = NULL; | 21 | IBootstrapperEngine* pEngine = NULL; |
22 | BOOTSTRAPPER_COMMAND command = { }; | ||
24 | IBAFunctions* pBAFunctions = NULL; | 23 | IBAFunctions* pBAFunctions = NULL; |
25 | 24 | ||
26 | bootstrapperArgs.cbSize = sizeof(bootstrapperArgs); | ||
27 | bootstrapperArgs.pCommand = &bootstrapperCommand; | ||
28 | |||
29 | args.cbSize = sizeof(args); | 25 | args.cbSize = sizeof(args); |
30 | args.pBootstrapperCreateArgs = &bootstrapperArgs; | 26 | args.pEngine = pEngine; |
27 | args.pCommand = &command; | ||
31 | 28 | ||
32 | results.cbSize = sizeof(results); | 29 | results.cbSize = sizeof(results); |
33 | 30 | ||
34 | try | 31 | try |
35 | { | 32 | { |
36 | hr = BalInitializeFromCreateArgs(&bootstrapperArgs, &pEngine); | 33 | BalInitialize(pEngine); |
37 | NativeAssert::Succeeded(hr, "Failed to create engine."); | ||
38 | 34 | ||
39 | hr = CreateBAFunctions(NULL, pEngine, &args, &results, &pBAFunctions); | 35 | hr = CreateBAFunctions(NULL, &args, &results); |
40 | NativeAssert::Succeeded(hr, "Failed to create BAFunctions."); | 36 | NativeAssert::Succeeded(hr, "Failed to create BAFunctions."); |
37 | |||
38 | pBAFunctions = reinterpret_cast<IBAFunctions*>(results.pvBAFunctionsProcContext); | ||
41 | } | 39 | } |
42 | finally | 40 | finally |
43 | { | 41 | { |
diff --git a/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp b/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp index 70b01a42..9a68c738 100644 --- a/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp +++ b/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp | |||
@@ -12,28 +12,21 @@ namespace BalUtilTests | |||
12 | public ref class BootstrapperApplication | 12 | public ref class BootstrapperApplication |
13 | { | 13 | { |
14 | public: | 14 | public: |
15 | [Fact] | 15 | [Fact(Skip = "Need a mock implementation of IBootstrapperEngine to test BootstrapperApplication.")] |
16 | void CanCreateTestBootstrapperApplication() | 16 | void CanCreateTestBootstrapperApplication() |
17 | { | 17 | { |
18 | HRESULT hr = S_OK; | 18 | HRESULT hr = S_OK; |
19 | BOOTSTRAPPER_CREATE_ARGS args = { }; | ||
20 | BOOTSTRAPPER_COMMAND command = { }; | ||
21 | BOOTSTRAPPER_CREATE_RESULTS results = { }; | ||
22 | IBootstrapperEngine* pEngine = NULL; | ||
23 | IBootstrapperApplication* pApplication = NULL; | 19 | IBootstrapperApplication* pApplication = NULL; |
24 | 20 | IBootstrapperEngine* pEngine = NULL; | |
25 | args.cbSize = sizeof(args); | 21 | BOOTSTRAPPER_COMMAND command = { }; |
26 | args.pCommand = &command; | ||
27 | |||
28 | results.cbSize = sizeof(results); | ||
29 | 22 | ||
30 | try | 23 | try |
31 | { | 24 | { |
32 | hr = BalInitializeFromCreateArgs(&args, &pEngine); | 25 | hr = CreateBootstrapperApplication(&pApplication); |
33 | NativeAssert::Succeeded(hr, "Failed to create engine."); | ||
34 | |||
35 | hr = CreateBootstrapperApplication(pEngine, &args, &results, &pApplication); | ||
36 | NativeAssert::Succeeded(hr, "Failed to create BootstrapperApplication."); | 26 | NativeAssert::Succeeded(hr, "Failed to create BootstrapperApplication."); |
27 | |||
28 | hr = pApplication->OnCreate(pEngine, &command); | ||
29 | NativeAssert::Succeeded(hr, "Failed to initialize BootstrapperApplication."); | ||
37 | } | 30 | } |
38 | finally | 31 | finally |
39 | { | 32 | { |
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp index 927a8d10..3e850442 100644 --- a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp +++ b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp | |||
@@ -8,34 +8,32 @@ class CTestBAFunctions : public CBalBaseBAFunctions | |||
8 | { | 8 | { |
9 | public: | 9 | public: |
10 | CTestBAFunctions( | 10 | CTestBAFunctions( |
11 | __in HMODULE hModule, | 11 | __in HMODULE hModule |
12 | __in IBootstrapperEngine* pEngine, | 12 | ) : CBalBaseBAFunctions(hModule) |
13 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs | ||
14 | ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) | ||
15 | { | 13 | { |
16 | } | 14 | } |
17 | }; | 15 | }; |
18 | 16 | ||
19 | HRESULT CreateBAFunctions( | 17 | HRESULT CreateBAFunctions( |
20 | __in HMODULE hModule, | 18 | __in HMODULE hModule, |
21 | __in IBootstrapperEngine* pEngine, | ||
22 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | 19 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, |
23 | __in BA_FUNCTIONS_CREATE_RESULTS* pResults, | 20 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults |
24 | __out IBAFunctions** ppApplication | ||
25 | ) | 21 | ) |
26 | { | 22 | { |
27 | HRESULT hr = S_OK; | 23 | HRESULT hr = S_OK; |
28 | CTestBAFunctions* pApplication = NULL; | 24 | CTestBAFunctions* pFunction = NULL; |
29 | 25 | ||
30 | pApplication = new CTestBAFunctions(hModule, pEngine, pArgs); | 26 | pFunction = new CTestBAFunctions(hModule); |
31 | ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bafunctions object."); | 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."); | ||
32 | 31 | ||
33 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; | 32 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; |
34 | pResults->pvBAFunctionsProcContext = pApplication; | 33 | pResults->pvBAFunctionsProcContext = pFunction; |
35 | *ppApplication = pApplication; | 34 | pFunction = NULL; |
36 | pApplication = NULL; | ||
37 | 35 | ||
38 | LExit: | 36 | LExit: |
39 | ReleaseObject(pApplication); | 37 | ReleaseObject(pFunction); |
40 | return hr; | 38 | return hr; |
41 | } | 39 | } |
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h index 41f36df8..e25e40c3 100644 --- a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h +++ b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | HRESULT CreateBAFunctions( | 4 | HRESULT CreateBAFunctions( |
5 | __in HMODULE hModule, | 5 | __in HMODULE hModule, |
6 | __in IBootstrapperEngine* pEngine, | ||
7 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | 6 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, |
8 | __in BA_FUNCTIONS_CREATE_RESULTS* pResults, | 7 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults |
9 | __out IBAFunctions** ppApplication | ||
10 | ); | 8 | ); |
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp index daa1d690..b345ab9f 100644 --- a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp +++ b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp | |||
@@ -2,36 +2,25 @@ | |||
2 | 2 | ||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | #include "BalBaseBootstrapperApplication.h" | 4 | #include "BalBaseBootstrapperApplication.h" |
5 | #include "BalBaseBootstrapperApplicationProc.h" | ||
6 | 5 | ||
7 | class CTestBootstrapperApplication : public CBalBaseBootstrapperApplication | 6 | class CTestBootstrapperApplication : public CBalBaseBootstrapperApplication |
8 | { | 7 | { |
9 | public: | 8 | public: |
10 | CTestBootstrapperApplication( | 9 | CTestBootstrapperApplication() : CBalBaseBootstrapperApplication() |
11 | __in IBootstrapperEngine* pEngine | ||
12 | ) : CBalBaseBootstrapperApplication(pEngine) | ||
13 | { | 10 | { |
14 | } | 11 | } |
15 | }; | 12 | }; |
16 | 13 | ||
17 | HRESULT CreateBootstrapperApplication( | 14 | HRESULT CreateBootstrapperApplication( |
18 | __in IBootstrapperEngine* pEngine, | ||
19 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
20 | __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, | ||
21 | __out IBootstrapperApplication** ppApplication | 15 | __out IBootstrapperApplication** ppApplication |
22 | ) | 16 | ) |
23 | { | 17 | { |
24 | HRESULT hr = S_OK; | 18 | HRESULT hr = S_OK; |
25 | CTestBootstrapperApplication* pApplication = NULL; | 19 | CTestBootstrapperApplication* pApplication = NULL; |
26 | 20 | ||
27 | pApplication = new CTestBootstrapperApplication(pEngine); | 21 | pApplication = new CTestBootstrapperApplication(); |
28 | ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bootstrapper application object."); | 22 | ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bootstrapper application object."); |
29 | 23 | ||
30 | hr = pApplication->Initialize(pArgs); | ||
31 | ExitOnFailure(hr, "CTestBootstrapperApplication initialization failed."); | ||
32 | |||
33 | pResults->pfnBootstrapperApplicationProc = BalBaseBootstrapperApplicationProc; | ||
34 | pResults->pvBootstrapperApplicationProcContext = pApplication; | ||
35 | *ppApplication = pApplication; | 24 | *ppApplication = pApplication; |
36 | pApplication = NULL; | 25 | pApplication = NULL; |
37 | 26 | ||
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h index c173e9ee..313bfede 100644 --- a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h +++ b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h | |||
@@ -2,8 +2,5 @@ | |||
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. | 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 | 3 | ||
4 | HRESULT CreateBootstrapperApplication( | 4 | HRESULT CreateBootstrapperApplication( |
5 | __in IBootstrapperEngine* pEngine, | ||
6 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
7 | __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, | ||
8 | __out IBootstrapperApplication** ppApplication | 5 | __out IBootstrapperApplication** ppApplication |
9 | ); | 6 | ); |
diff --git a/src/api/burn/test/BalUtilUnitTest/precomp.h b/src/api/burn/test/BalUtilUnitTest/precomp.h index 218cab68..57487bc5 100644 --- a/src/api/burn/test/BalUtilUnitTest/precomp.h +++ b/src/api/burn/test/BalUtilUnitTest/precomp.h | |||
@@ -15,8 +15,8 @@ | |||
15 | #include <dutil.h> | 15 | #include <dutil.h> |
16 | #include <dictutil.h> | 16 | #include <dictutil.h> |
17 | 17 | ||
18 | #include <BootstrapperEngine.h> | 18 | #include <baenginetypes.h> |
19 | #include <BootstrapperApplication.h> | 19 | #include <batypes.h> |
20 | 20 | ||
21 | #include <BAFunctions.h> | 21 | #include <BAFunctions.h> |
22 | #include <IBootstrapperEngine.h> | 22 | #include <IBootstrapperEngine.h> |