Skip to content

Commit 6d8c059

Browse files
authored
Enabling access control tests (#5794)
* Enabling access control tests * Fixing run as * Removing try catch * Adding testdef to proj file * Fixing testdef name * Fixing testdef name 2 * Fixing cleanup * Fixing typo in dll name * Adding vclibs to test app * Adding failing images to bypass list for lack of VC libs
1 parent c84ae19 commit 6d8c059

File tree

5 files changed

+45
-30
lines changed

5 files changed

+45
-30
lines changed

test/AccessControlTests/APITests.cpp

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation and Contributors.
1+
// Copyright (c) Microsoft Corporation and Contributors.
22
// Licensed under the MIT License.
33

44
#include "pch.h"
@@ -32,7 +32,7 @@ namespace Test::AccessControl
3232

3333
static PCWSTR GetTestPackageFullName()
3434
{
35-
return L"AccessControlTestPackage_1.0.0.0_" WINDOWSAPPRUNTIME_TEST_PACKAGE_DDLM_ARCHITECTURE "8wekyb3d8bbwe";
35+
return L"AccessControlTestAppPackage_1.0.0.0_" WINDOWSAPPRUNTIME_TEST_PACKAGE_DDLM_ARCHITECTURE "__8wekyb3d8bbwe";
3636
}
3737

3838
static PCWSTR GetTestPackageFamilyName()
@@ -58,46 +58,32 @@ namespace Test::AccessControl
5858
BEGIN_TEST_CLASS(APITests)
5959
TEST_CLASS_PROPERTY(L"Description", L"Windows App SDK AccessControl test")
6060
TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
61-
TEST_CLASS_PROPERTY(L"RunAs:Class", L"RestrictedUser")
61+
TEST_CLASS_PROPERTY(L"RunAs", L"RestrictedUser")
6262
END_TEST_CLASS()
6363

6464
TEST_CLASS_SETUP(ClassInit)
6565
{
66-
try
67-
{
68-
::Test::Packages::RemovePackage(GetTestPackageFamilyName());
69-
::Test::Bootstrap::Setup();
70-
::Test::Packages::WapProj::AddPackage(TAEF::GetDeploymentDir(), GetTestPackageFile(), L".msix"); // Installs AccessControlTests.msix
71-
}
72-
catch (...)
73-
{
74-
return false;
75-
}
66+
::Test::Packages::RemovePackage(GetTestPackageFullName());
67+
::Test::Bootstrap::Setup();
68+
::Test::Packages::WapProj::AddPackage(TAEF::GetDeploymentDir(), GetTestPackageFile(), L".msix"); // Installs AccessControlTests.msix
7669

7770
m_testAppLauncher = winrt::create_instance<IApplicationActivationManager>(CLSID_ApplicationActivationManager, CLSCTX_ALL);
7871
return true;
7972
}
8073

8174
TEST_CLASS_CLEANUP(ClassUninit)
8275
{
83-
try
84-
{
85-
if (m_processHandle.is_valid())
86-
{
87-
VERIFY_IS_TRUE(wil::handle_wait(m_processHandle.get(), 10000));
88-
89-
DWORD exitCode{};
90-
VERIFY_WIN32_BOOL_SUCCEEDED(GetExitCodeProcess(m_processHandle.get(), &exitCode));
91-
VERIFY_ARE_EQUAL(exitCode, 0u);
92-
}
93-
// Remove in reverse order to avoid conflicts between inter-dependent packages.
94-
::Test::Packages::RemovePackage(GetTestPackageFamilyName());
95-
::Test::Bootstrap::Cleanup();
96-
}
97-
catch (...)
76+
if (m_processHandle.is_valid())
9877
{
99-
return false;
78+
VERIFY_IS_TRUE(wil::handle_wait(m_processHandle.get(), 10000));
79+
80+
DWORD exitCode{};
81+
VERIFY_WIN32_BOOL_SUCCEEDED(GetExitCodeProcess(m_processHandle.get(), &exitCode));
82+
VERIFY_ARE_EQUAL(exitCode, 0u);
10083
}
84+
// Remove in reverse order to avoid conflicts between inter-dependent packages.
85+
::Test::Packages::RemovePackage(GetTestPackageFullName());
86+
::Test::Bootstrap::Cleanup();
10187
return true;
10288
}
10389

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
{
3+
"Tests": [
4+
{
5+
"Description": "Access Control Tests",
6+
"Filename": "AccessControlTests.dll",
7+
"Parameters": "",
8+
"Architectures": ["x64", "x86", "arm64"],
9+
"Status": "Enabled"
10+
}
11+
]
12+
}

test/AccessControlTests/AccessControlTests.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,6 @@
243243
</Target>
244244
<Target Name="CopyFiles" AfterTargets="AfterBuild">
245245
<Copy SkipUnchangedFiles="true" SourceFiles="$(OutDir)\..\WindowsAppRuntime_BootstrapDLL\Microsoft.WindowsAppRuntime.Bootstrap.dll" DestinationFolder="$(OutDir)" />
246+
<Copy SkipUnchangedFiles="true" SourceFiles="AccessControlTests.testdef" DestinationFolder="$(OutDir)" />
246247
</Target>
247248
</Project>

test/BypassTests.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1674,5 +1674,20 @@
16741674
"release_x86_Windows.Server.2019.DataCenter.zh-CN.OAuth2ManagerTests::OAuth2APITests::ExtensionTokenRequest",
16751675
"release_x86_Windows.Server.2019.DataCenter.zh-CN.OAuth2ManagerTests::OAuth2APITests::TokenRequestErrorResponse",
16761676
"release_x86_Windows.Server.2019.DataCenter.zh-CN.OAuth2ManagerTests::OAuth2APITests::AdditionalParams",
1677-
"release_x86_Windows.Server.2019.DataCenter.zh-CN.OAuth2ManagerTests::OAuth2APITests::CompleteInvalidState"
1677+
"release_x86_Windows.Server.2019.DataCenter.zh-CN.OAuth2ManagerTests::OAuth2APITests::CompleteInvalidState",
1678+
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::AccessControl::APITests::FlatAPITest",
1679+
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::AccessControl::APITests::WinRTStringTest",
1680+
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::AccessControl::APITests::WinRTBytesTest",
1681+
"release_x64_Win10_rs5_DC.Test::AccessControl::APITests::FlatAPITest",
1682+
"release_x64_Win10_rs5_DC.Test::AccessControl::APITests::WinRTStringTest",
1683+
"release_x64_Win10_rs5_DC.Test::AccessControl::APITests::WinRTBytesTest",
1684+
"release_x86_Windows.10.Enterprise.22h2.Test::AccessControl::APITests::FlatAPITest",
1685+
"release_x86_Windows.10.Enterprise.22h2.Test::AccessControl::APITests::WinRTStringTest",
1686+
"release_x86_Windows.10.Enterprise.22h2.Test::AccessControl::APITests::WinRTBytesTest",
1687+
"release_x86_Windows.11.Professional.23H2.zh-CN.Test::AccessControl::APITests::FlatAPITest",
1688+
"release_x86_Windows.11.Professional.23H2.zh-CN.Test::AccessControl::APITests::WinRTStringTest",
1689+
"release_x86_Windows.11.Professional.23H2.zh-CN.Test::AccessControl::APITests::WinRTBytesTest",
1690+
"release_x86_Windows.Server.2019.DataCenter.zh-CN.Test::AccessControl::APITests::FlatAPITest",
1691+
"release_x86_Windows.Server.2019.DataCenter.zh-CN.Test::AccessControl::APITests::WinRTStringTest",
1692+
"release_x86_Windows.Server.2019.DataCenter.zh-CN.Test::AccessControl::APITests::WinRTBytesTest"
16781693
]

test/TestApps/AccessControlTestAppPackage/Package.appxmanifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<Dependencies>
2323
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
2424
<PackageDependency Name="Microsoft.WindowsAppRuntime.Framework.4.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" MinVersion="0.0.0.0"/>
25+
<PackageDependency Name="Microsoft.VCLibs.140.00.UWPDesktop" MinVersion="0.0.0.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
2526
</Dependencies>
2627

2728
<Resources>

0 commit comments

Comments
 (0)