Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions test/BypassTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1619,11 +1619,21 @@
"release_x64_Windows.10.Enterprise.LTSC.2021.UnpackagedTests#metadataSet1::VerifyUnregisterAndUnregisterAll",
"release_x64_Windows.10.Enterprise.LTSC.2021.UnpackagedTests#metadataSet1::VerifyForegroundHandlerSucceeds",
"release_x64_Windows.10.Enterprise.LTSC.2021.UnpackagedTests#metadataSet1::VerifyForegroundHandlerFails",
"release_x64_Win10_rs5_DC.LRPTests::LaunchLRP_FromCoCreateInstance",
"release_x64_Win10_rs5_DC.LRPTests::LaunchLRP_FromStartupTask",
"release_x64_Win10_rs5_DC.LRPTests::AddToastRegistrationMappingNoSink",
"release_x64_Win10_rs5_DC.LRPTests::RemoveToastRegistrationMappingNoSink",
"release_x64_Win10_rs5_DC.LRPTests::AddRemoveToastRegistrationMappingWithSink",
"release_x64_Win10_rs5_DC.Test::LRP::LRPTests::LaunchLRP_FromStartupTask",
"release_x64_Win10_rs5_DC.Test::LRP::LRPTests::AddRemoveToastRegistrationMappingNoSink",
"release_x64_Win10_rs5_DC.Test::LRP::LRPTests::AddRemoveToastRegistrationMappingWithSink",
"release_x64_Win10_rs5_DC.Test::LRP::LRPTests::RegisterUnregisterLongRunningActivatorWithClsid",
"release_x64_Win10_rs5_DC.Test::LRP::LRPTests::RegisterUnregisterLongRunningActivator",
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::LRP::LRPTests::LaunchLRP_FromStartupTask",
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::LRP::LRPTests::AddRemoveToastRegistrationMappingNoSink",
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::LRP::LRPTests::AddRemoveToastRegistrationMappingWithSink",
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::LRP::LRPTests::RegisterUnregisterLongRunningActivatorWithClsid",
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::LRP::LRPTests::RegisterUnregisterLongRunningActivator",
"release_x86_Windows.Server.2019.DataCenter.zh-CN.Test::LRP::LRPTests::LaunchLRP_FromStartupTask",
"release_x86_Windows.Server.2019.DataCenter.zh-CN.Test::LRP::LRPTests::AddRemoveToastRegistrationMappingNoSink",
"release_x86_Windows.Server.2019.DataCenter.zh-CN.Test::LRP::LRPTests::AddRemoveToastRegistrationMappingWithSink",
"release_x86_Windows.Server.2019.DataCenter.zh-CN.Test::LRP::LRPTests::RegisterUnregisterLongRunningActivatorWithClsid",
"release_x86_Windows.Server.2019.DataCenter.zh-CN.Test::LRP::LRPTests::RegisterUnregisterLongRunningActivator",
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::DynamicDependency::Test_WinRT::Create_Delete",
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framework_WindowsAppRuntime",
"release_x64_Windows.10.Enterprise.LTSC.2021.Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Frameworks_WindowsAppRuntime_MathAdd",
Expand Down
28 changes: 22 additions & 6 deletions test/LRPTests/APITests.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"
#include <TestDef.h>
#include <TlHelp32.h>
#include <NotificationsLongRunningProcess_h.h>
#include "NotificationPlatformActivation.h"
#include "MddWin11.h"

using namespace WEX::Common;
using namespace WEX::Logging;
Expand All @@ -26,7 +27,7 @@ namespace Test::LRP
BEGIN_TEST_CLASS(LRPTests)
TEST_CLASS_PROPERTY(L"Description", L"Windows App SDK Push Notifications Long Running Process tests")
TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
TEST_CLASS_PROPERTY(L"RunAs:Class", L"RestrictedUser")
TEST_CLASS_PROPERTY(L"RunAs", L"RestrictedUser")
END_TEST_CLASS()

wil::com_ptr<INotificationsLongRunningPlatform> GetNotificationPlatform()
Expand All @@ -40,13 +41,28 @@ namespace Test::LRP
TEST_CLASS_SETUP(ClassInit)
{

::Test::Bootstrap::SetupPackages(Test::Bootstrap::Packages::Framework | Test::Bootstrap::Packages::Singleton);
::Test::Bootstrap::Setup();

PCWSTR testFrameworkPackageFamilyName = ::Test::Bootstrap::TP::WindowsAppRuntimeFramework::c_PackageFamilyName;
PCWSTR testMainPackageFamilyName = ::Test::Bootstrap::TP::WindowsAppRuntimeMain::c_PackageFamilyName;


// For Windows 11 newer versions, the TestInitialize will fail fast if we pass a non null package family name.
// https://github.com/microsoft/WindowsAppSDK/blob/main/dev/Common/WindowsAppRuntime.VersionInfo.cpp#L123-L133
if (MddCore::Win11::IsSupported())
{
testMainPackageFamilyName = nullptr;
}

::WindowsAppRuntime::VersionInfo::TestInitialize(testFrameworkPackageFamilyName, testMainPackageFamilyName);

return true;
}

TEST_CLASS_CLEANUP(ClassUninit)
{
::Test::Bootstrap::CleanupPackages(Test::Bootstrap::Packages::Framework | Test::Bootstrap::Packages::Singleton);
::WindowsAppRuntime::VersionInfo::TestShutdown();
::Test::Bootstrap::Cleanup();
return true;
}

Expand Down Expand Up @@ -77,7 +93,7 @@ namespace Test::LRP
&processInfo)));

// Wait for the process to come up and be captured in the snapshot from verification step.
Sleep(1000);
Sleep(5000);
VerifyLRP_IsRunning(true);
}

Expand All @@ -92,7 +108,7 @@ namespace Test::LRP
BOOL result{ Process32First(processesSnapshot.get(), &processEntry) };
while (result != FALSE)
{
if (wcscmp(L"PushNotificationsLongRunningTask.exe", processEntry.szExeFile) == 0)
if (_wcsicmp(L"PushNotificationsLongRunningTask.exe", processEntry.szExeFile) == 0)
{
VERIFY_IS_TRUE(isRunning);
DWORD processId{ processEntry.th32ProcessID };
Expand Down
11 changes: 11 additions & 0 deletions test/LRPTests/LRPTests.testdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Tests": [
{
"Description": "Push Notifications Long Running Process (LRP) tests",
"Filename": "LRPTests.dll",
"Parameters": "",
"Architectures": ["x64", "x86"],
"Status": "Enabled"
}
]
}
8 changes: 8 additions & 0 deletions test/LRPTests/LRPTests.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.WindowsAppRuntime.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\WindowsAppRuntime_DLL</AdditionalLibraryDirectories>
<DelayLoadDLLs>Microsoft.WindowsAppRuntime.Bootstrap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>Microsoft.WindowsAppRuntime.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
Expand Down Expand Up @@ -115,6 +117,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\dev\WindowsAppRuntime_BootstrapDLL\WindowsAppRuntime_BootstrapDLL.vcxproj">
<Project>{f76b776e-86f5-48c5-8fc7-d2795ecc9746}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(NugetPackageDirectory)\Microsoft.Taef.$(MicrosoftTaefVersion)\build\Microsoft.Taef.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.Taef.$(MicrosoftTaefVersion)\build\Microsoft.Taef.targets')" />
Expand All @@ -129,6 +136,7 @@
<Target Name="CopyFiles" AfterTargets="AfterBuild">
<Copy SkipUnchangedFiles="true" SourceFiles="$(OutDir)\..\WindowsAppRuntime_BootstrapDLL\Microsoft.WindowsAppRuntime.Bootstrap.dll" DestinationFolder="$(OutDir)" />
<Copy SkipUnchangedFiles="true" SourceFiles="$(OutDir)\..\WindowsAppRuntime_DLL\Microsoft.Internal.FrameworkUdk.dll" DestinationFolder="$(OutDir)" />
<Copy SkipUnchangedFiles="true" SourceFiles="LRPTests.testdef" DestinationFolder="$(OutDir)" />
</Target>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion test/LRPTests/pch.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#ifndef PCH_H
Expand Down Expand Up @@ -40,6 +40,7 @@
#include <WindowsAppRuntime.Test.Package.h>
#include <WindowsAppRuntime.Test.TAEF.h>
#include <WindowsAppRuntime.Test.Bootstrap.h>
#include <WindowsAppRuntime.VersionInfo.h>
#include <windows.applicationmodel.h>
#include <windows.applicationmodel.background.h>
#include <ShObjIdl_core.h>
Expand Down
Loading