Fixing TAEF unit tests to build against public TAEF release. See readme.md for details (#31)
This commit is contained in:
Родитель
8f583018fc
Коммит
1bff60a1f2
|
@ -1,16 +1,16 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Xbox.Services.140.UWP.Cpp", "Microsoft.Xbox.Services.140.UWP.Cpp.vcxproj", "{8F96710E-5169-4917-8874-7DE248F4D243}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpprestsdk140.uwp.static", "..\..\External\cpprestsdk\Release\src\build\vs14.uwp\cpprestsdk140.uwp.static.vcxproj", "{9AD285A2-301E-47A0-A299-14AD5D4F2758}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpprestsdk140.uwp.staticlib", "..\..\External\cpprestsdk\Release\src\build\vs14.uwp\cpprestsdk140.uwp.staticlib.vcxproj", "{47A5CFDC-C244-45A6-9830-38CB303CB495}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
..\..\External\cpprestsdk\Release\src\build\winrt.vcxitems*{9ad285a2-301e-47a0-a299-14ad5d4f2758}*SharedItemsImports = 4
|
||||
..\..\External\cpprestsdk\Release\src\build\common.vcxitems*{9ad285a2-301e-47a0-a299-14ad5d4f2758}*SharedItemsImports = 4
|
||||
..\..\External\cpprestsdk\Release\src\build\common.vcxitems*{47a5cfdc-c244-45a6-9830-38cb303cb495}*SharedItemsImports = 4
|
||||
..\..\External\cpprestsdk\Release\src\build\winrt.vcxitems*{47a5cfdc-c244-45a6-9830-38cb303cb495}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
|
@ -33,18 +33,18 @@ Global
|
|||
{8F96710E-5169-4917-8874-7DE248F4D243}.Release|x64.Build.0 = Release|x64
|
||||
{8F96710E-5169-4917-8874-7DE248F4D243}.Release|x86.ActiveCfg = Release|Win32
|
||||
{8F96710E-5169-4917-8874-7DE248F4D243}.Release|x86.Build.0 = Release|Win32
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Debug|x64.Build.0 = Debug|x64
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Debug|x86.Build.0 = Debug|Win32
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Release|ARM.Build.0 = Release|ARM
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Release|x64.ActiveCfg = Release|x64
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Release|x64.Build.0 = Release|x64
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Release|x86.ActiveCfg = Release|Win32
|
||||
{9AD285A2-301E-47A0-A299-14AD5D4F2758}.Release|x86.Build.0 = Release|Win32
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|x64.Build.0 = Debug|x64
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|x86.Build.0 = Debug|Win32
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|ARM.Build.0 = Release|ARM
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|x64.ActiveCfg = Release|x64
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|x64.Build.0 = Release|x64
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|x86.ActiveCfg = Release|Win32
|
||||
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -405,8 +405,8 @@
|
|||
<ClInclude Include="..\..\Source\System\system_internal.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\External\cpprestsdk\Release\src\build\vs14.uwp\cpprestsdk140.uwp.static.vcxproj">
|
||||
<Project>{9AD285A2-301E-47A0-A299-14AD5D4F2758}</Project>
|
||||
<ProjectReference Include="..\..\External\cpprestsdk\Release\src\build\vs14.uwp\cpprestsdk140.uwp.staticlib.vcxproj">
|
||||
<Project>{47a5cfdc-c244-45a6-9830-38cb303cb495}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -7,7 +7,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Xbox.Services.Uni
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Xbox.System.140.UnitTest.Shared", "..\Microsoft.Xbox.Services.UnitTest.140.Shared\Microsoft.Xbox.Services.UnitTest.140.Shared.vcxitems", "{E73D47A1-2CF5-4ADA-B9E7-F2619F666162}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpprestsdk140.static", "..\..\External\cpprestsdk\Release\src\build\vs14\casablanca140.static.vcxproj", "{04D42F35-E5D5-4D95-980E-1BD7E900F2DD}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpprestsdk140.static", "..\..\External\cpprestsdk\Release\src\build\vs14.static\casablanca140.static.vcxproj", "{04D42F35-E5D5-4D95-980E-1BD7E900F2DD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
|
|
|
@ -107,15 +107,12 @@
|
|||
$(ProjectDir)..\..\Tests\UnitTests\Mocks;
|
||||
$(ProjectDir)..\..\Tests\UnitTests\Support;
|
||||
..\..\External\cpprestsdk\Release\include;
|
||||
..\..\TAEF\Include;
|
||||
..\..\MorroMock;
|
||||
c:\Program Files (x86)\Windows Kits\10\Testing\Development\inc;
|
||||
%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='x64'">
|
||||
..\..\TAEF\Library\Release\x64;%(AdditionalLibraryDirectories)
|
||||
</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32'">$(ProjectDir)..\..\TAEF\Library\Release\x86\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='x64'">C:\Program Files (x86)\Windows Kits\10\Testing\Development\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32'">C:\Program Files (x86)\Windows Kits\10\Testing\Development\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
|
@ -227,7 +224,7 @@
|
|||
<ClInclude Include="..\..\Tests\UnitTests\Tests\Services\SocialManagerHelper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\External\cpprestsdk\Release\src\build\vs14\casablanca140.static.vcxproj">
|
||||
<ProjectReference Include="..\..\External\cpprestsdk\Release\src\build\vs14.static\casablanca140.static.vcxproj">
|
||||
<Project>{04d42f35-e5d5-4d95-980e-1bd7e900f2dd}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
To compile the TAEF project, you must install TAEF. Here's how:
|
||||
|
||||
1) Install Windows Driver Kit (WDK 10) at https://developer.microsoft.com/en-us/windows/hardware/windows-driver-kit. This will install the TAEF MSI.
|
||||
|
||||
2) Now run, "C:\Program Files (x86)\Windows Kits\10\Testing\Runtimes\Test Authoring and Execution Framework x64-x64_en-us.msi" which installs TAEF to "C:\Program Files (x86)\Windows Kits\10\Testing"
|
||||
|
||||
|
|
@ -314,6 +314,11 @@
|
|||
<ClInclude Include="..\..\Tests\UnitTests\Mocks\StockMocks.h" />
|
||||
<ClInclude Include="..\..\Tests\UnitTests\Support\iso8601.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\External\cpprestsdk\Release\src\build\vs14\casablanca140.static.vcxproj">
|
||||
<Project>{04d42f35-e5d5-4d95-980e-1bd7e900f2dd}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\External\Packages\boost.1.58.0.0\build\native\boost.targets" Condition="Exists('..\..\External\Packages\boost.1.58.0.0\build\native\boost.targets')" />
|
||||
<Import Project="..\..\External\Packages\boost_system-vc140.1.58.0-vs140rc\build\native\boost_system-vc140.targets" Condition="Exists('..\..\External\Packages\boost_system-vc140.1.58.0-vs140rc\build\native\boost_system-vc140.targets')" />
|
||||
|
@ -323,11 +328,6 @@
|
|||
<Import Project="..\..\External\Packages\boost_date_time-vc140.1.58.0-vs140rc\build\native\boost_date_time-vc140.targets" Condition="Exists('..\..\External\Packages\boost_date_time-vc140.1.58.0-vs140rc\build\native\boost_date_time-vc140.targets')" />
|
||||
<Import Project="..\..\External\Packages\boost_regex-vc140.1.58.0-vs140rc\build\native\boost_regex-vc140.targets" Condition="Exists('..\..\External\Packages\boost_regex-vc140.1.58.0-vs140rc\build\native\boost_regex-vc140.targets')" />
|
||||
</ImportGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Casablanca\Release\src\build\vs14\casablanca140.static.vcxproj">
|
||||
<Project>{04d42f35-e5d5-4d95-980e-1bd7e900f2dd}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<ProjectFolder>Microsoft.Xbox.System.UnitTestNew</ProjectFolder>
|
||||
<OutDir>$(ProjectDir)..\..\Binaries\$(Configuration)\$(Platform)\$(ProjectName)\</OutDir>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 376b3241ad81be444fdb0c5b961cdda07d7dd3c5
|
||||
Subproject commit a439d852acb10d122ae4d5c503847fc98c75a749
|
|
@ -642,32 +642,32 @@ public:
|
|||
|
||||
pplx::event writeFinishEvent;
|
||||
int writeDelay = 0;
|
||||
xbox::services::presence::presence_service_impl::set_presence_set_finished_handler([&writeFinishEvent, &writeDelay](int delay)
|
||||
{
|
||||
writeDelay = delay;
|
||||
writeFinishEvent.set();
|
||||
});
|
||||
//xbox::services::presence::presence_service_impl::set_presence_set_finished_handler([&writeFinishEvent, &writeDelay](int delay)
|
||||
//{
|
||||
// writeDelay = delay;
|
||||
// writeFinishEvent.set();
|
||||
//});
|
||||
|
||||
auto presenceWriter = xbox::services::presence::presence_writer::get_presence_writer_singleton();
|
||||
presenceWriter->start_writer(
|
||||
xboxLiveContext->presence_service()._Impl()
|
||||
);
|
||||
//auto presenceWriter = xbox::services::presence::presence_writer::get_presence_writer_singleton();
|
||||
//presenceWriter->start_writer(
|
||||
// xboxLiveContext->presence_service()._Impl()
|
||||
//);
|
||||
|
||||
writeFinishEvent.wait();
|
||||
writeFinishEvent.reset();
|
||||
//writeFinishEvent.wait();
|
||||
//writeFinishEvent.reset();
|
||||
|
||||
|
||||
VERIFY_ARE_EQUAL_STR(L"POST", httpCall->HttpMethod);
|
||||
VERIFY_ARE_EQUAL_STR(L"https://userpresence.mockenv.xboxlive.com", httpCall->ServerName);
|
||||
VERIFY_ARE_EQUAL_STR(
|
||||
L"/users/xuid(TestXboxUserId)/devices/current/titles/current",
|
||||
httpCall->PathQueryFragment.to_string()
|
||||
);
|
||||
//VERIFY_ARE_EQUAL_STR(L"POST", httpCall->HttpMethod);
|
||||
//VERIFY_ARE_EQUAL_STR(L"https://userpresence.mockenv.xboxlive.com", httpCall->ServerName);
|
||||
//VERIFY_ARE_EQUAL_STR(
|
||||
// L"/users/xuid(TestXboxUserId)/devices/current/titles/current",
|
||||
// httpCall->PathQueryFragment.to_string()
|
||||
// );
|
||||
|
||||
VERIFY_IS_TRUE(writeDelay == 1);
|
||||
VERIFY_IS_TRUE(httpCall->CallCounter == 1);
|
||||
|
||||
presenceWriter->stop_writer(xboxLiveContext->user()->XboxUserId->Data());
|
||||
//presenceWriter->stop_writer(xboxLiveContext->user()->XboxUserId->Data());
|
||||
writeFinishEvent.wait();
|
||||
xbox::services::presence::presence_service_impl::set_presence_set_finished_handler(nullptr);
|
||||
|
||||
|
@ -676,39 +676,40 @@ public:
|
|||
DEFINE_TEST_CASE(TestPresenceWriterNoHeartbeatAfter)
|
||||
{
|
||||
DEFINE_TEST_CASE_PROPERTIES(TestPresenceWriterNoHeartbeatAfter);
|
||||
pplx::event writeFinishEvent;
|
||||
int writeDelay = 0;
|
||||
xbox::services::presence::presence_service_impl::set_presence_set_finished_handler([&writeFinishEvent, &writeDelay](int delay)
|
||||
{
|
||||
writeDelay = delay;
|
||||
writeFinishEvent.set();
|
||||
});
|
||||
|
||||
auto xboxLiveContext = GetMockXboxLiveContext_Cpp();
|
||||
auto httpCall = m_mockXboxSystemFactory->GetMockHttpCall();
|
||||
httpCall->ResultValue = StockMocks::CreateMockHttpCallResponse(L"");
|
||||
auto presenceWriter = xbox::services::presence::presence_writer::get_presence_writer_singleton();
|
||||
presenceWriter->start_writer(
|
||||
xboxLiveContext->presence_service()._Impl()
|
||||
);
|
||||
VERIFY_IS_TRUE(false);
|
||||
//pplx::event writeFinishEvent;
|
||||
//int writeDelay = 0;
|
||||
//xbox::services::presence::presence_service_impl::set_presence_set_finished_handler([&writeFinishEvent, &writeDelay](int delay)
|
||||
//{
|
||||
// writeDelay = delay;
|
||||
// writeFinishEvent.set();
|
||||
//});
|
||||
//
|
||||
//auto xboxLiveContext = GetMockXboxLiveContext_Cpp();
|
||||
//auto httpCall = m_mockXboxSystemFactory->GetMockHttpCall();
|
||||
//httpCall->ResultValue = StockMocks::CreateMockHttpCallResponse(L"");
|
||||
//auto presenceWriter = xbox::services::presence::presence_writer::get_presence_writer_singleton();
|
||||
//presenceWriter->start_writer(
|
||||
// xboxLiveContext->presence_service()._Impl()
|
||||
// );
|
||||
|
||||
writeFinishEvent.wait();
|
||||
//writeFinishEvent.wait();
|
||||
|
||||
VERIFY_ARE_EQUAL_STR(L"POST", httpCall->HttpMethod);
|
||||
VERIFY_ARE_EQUAL_STR(L"https://userpresence.mockenv.xboxlive.com", httpCall->ServerName);
|
||||
VERIFY_ARE_EQUAL_STR(
|
||||
L"/users/xuid(TestXboxUserId)/devices/current/titles/current",
|
||||
httpCall->PathQueryFragment.to_string()
|
||||
);
|
||||
//VERIFY_ARE_EQUAL_STR(L"POST", httpCall->HttpMethod);
|
||||
//VERIFY_ARE_EQUAL_STR(L"https://userpresence.mockenv.xboxlive.com", httpCall->ServerName);
|
||||
//VERIFY_ARE_EQUAL_STR(
|
||||
// L"/users/xuid(TestXboxUserId)/devices/current/titles/current",
|
||||
// httpCall->PathQueryFragment.to_string()
|
||||
// );
|
||||
|
||||
VERIFY_IS_TRUE(writeDelay == presenceWriter->s_defaultHeartBeatDelayInMins);
|
||||
VERIFY_IS_TRUE(httpCall->CallCounter == 1);
|
||||
//VERIFY_IS_TRUE(writeDelay == presenceWriter->s_defaultHeartBeatDelayInMins);
|
||||
//VERIFY_IS_TRUE(httpCall->CallCounter == 1);
|
||||
|
||||
writeFinishEvent.reset();
|
||||
//writeFinishEvent.reset();
|
||||
|
||||
presenceWriter->stop_writer(xboxLiveContext->user()->XboxUserId->Data());
|
||||
writeFinishEvent.wait();
|
||||
xbox::services::presence::presence_service_impl::set_presence_set_finished_handler(nullptr);
|
||||
//presenceWriter->stop_writer(xboxLiveContext->user()->XboxUserId->Data());
|
||||
//writeFinishEvent.wait();
|
||||
//xbox::services::presence::presence_service_impl::set_presence_set_finished_handler(nullptr);
|
||||
|
||||
}
|
||||
|
||||
|
@ -716,118 +717,120 @@ public:
|
|||
DEFINE_TEST_CASE(TestMultiUserPresenceWriter)
|
||||
{
|
||||
DEFINE_TEST_CASE_PROPERTIES(TestMultiUserPresenceWriter);
|
||||
pplx::event writeFinishEvent;
|
||||
int writeDelay = 0;
|
||||
int eventExpecting = 2;
|
||||
xbox::services::presence::presence_service_impl::set_presence_set_finished_handler([&writeFinishEvent, &writeDelay, &eventExpecting](int delay)
|
||||
{
|
||||
writeDelay = delay;
|
||||
if (!--eventExpecting)
|
||||
{
|
||||
writeFinishEvent.set();
|
||||
}
|
||||
});
|
||||
VERIFY_IS_TRUE(false);
|
||||
//pplx::event writeFinishEvent;
|
||||
//int writeDelay = 0;
|
||||
//int eventExpecting = 2;
|
||||
//xbox::services::presence::presence_service_impl::set_presence_set_finished_handler([&writeFinishEvent, &writeDelay, &eventExpecting](int delay)
|
||||
//{
|
||||
// writeDelay = delay;
|
||||
// if (!--eventExpecting)
|
||||
// {
|
||||
// writeFinishEvent.set();
|
||||
// }
|
||||
//});
|
||||
|
||||
auto xboxLiveContext = GetMockXboxLiveContext_Cpp();
|
||||
auto xboxLiveContext1 = GetMockXboxLiveContext_Cpp(L"TestUser1");
|
||||
//auto xboxLiveContext = GetMockXboxLiveContext_Cpp();
|
||||
//auto xboxLiveContext1 = GetMockXboxLiveContext_Cpp(L"TestUser1");
|
||||
|
||||
auto httpCall = m_mockXboxSystemFactory->GetMockHttpCall();
|
||||
httpCall->ResultValue = StockMocks::CreateMockHttpCallResponse(L"");
|
||||
httpCall->set_custom_header(L"X-Heartbeat-After", L"60");
|
||||
auto presenceWriter = xbox::services::presence::presence_writer::get_presence_writer_singleton();
|
||||
presenceWriter->start_writer(
|
||||
xboxLiveContext->presence_service()._Impl()
|
||||
);
|
||||
//auto httpCall = m_mockXboxSystemFactory->GetMockHttpCall();
|
||||
//httpCall->ResultValue = StockMocks::CreateMockHttpCallResponse(L"");
|
||||
//httpCall->set_custom_header(L"X-Heartbeat-After", L"60");
|
||||
//auto presenceWriter = xbox::services::presence::presence_writer::get_presence_writer_singleton();
|
||||
//presenceWriter->start_writer(
|
||||
// xboxLiveContext->presence_service()._Impl()
|
||||
//);
|
||||
|
||||
presenceWriter->start_writer(
|
||||
xboxLiveContext1->presence_service()._Impl()
|
||||
);
|
||||
//presenceWriter->start_writer(
|
||||
// xboxLiveContext1->presence_service()._Impl()
|
||||
//);
|
||||
|
||||
writeFinishEvent.wait();
|
||||
//writeFinishEvent.wait();
|
||||
|
||||
VERIFY_ARE_EQUAL_STR(L"POST", httpCall->HttpMethod);
|
||||
VERIFY_ARE_EQUAL_STR(L"https://userpresence.mockenv.xboxlive.com", httpCall->ServerName);
|
||||
//VERIFY_ARE_EQUAL_STR(L"POST", httpCall->HttpMethod);
|
||||
//VERIFY_ARE_EQUAL_STR(L"https://userpresence.mockenv.xboxlive.com", httpCall->ServerName);
|
||||
|
||||
VERIFY_IS_TRUE(writeDelay == 1);
|
||||
VERIFY_ARE_EQUAL_UINT(2, httpCall->CallCounter);
|
||||
VERIFY_ARE_EQUAL_UINT(2, presenceWriter->tracking_count());
|
||||
//VERIFY_IS_TRUE(writeDelay == 1);
|
||||
//VERIFY_ARE_EQUAL_UINT(2, httpCall->CallCounter);
|
||||
//VERIFY_ARE_EQUAL_UINT(2, presenceWriter->tracking_count());
|
||||
|
||||
writeFinishEvent.reset();
|
||||
eventExpecting = 2;
|
||||
//writeFinishEvent.reset();
|
||||
//eventExpecting = 2;
|
||||
|
||||
presenceWriter->stop_writer(xboxLiveContext->user()->XboxUserId->Data());
|
||||
presenceWriter->stop_writer(xboxLiveContext1->user()->XboxUserId->Data());
|
||||
writeFinishEvent.wait();
|
||||
xbox::services::presence::presence_service_impl::set_presence_set_finished_handler(nullptr);
|
||||
//presenceWriter->stop_writer(xboxLiveContext->user()->XboxUserId->Data());
|
||||
//presenceWriter->stop_writer(xboxLiveContext1->user()->XboxUserId->Data());
|
||||
//writeFinishEvent.wait();
|
||||
//xbox::services::presence::presence_service_impl::set_presence_set_finished_handler(nullptr);
|
||||
}
|
||||
|
||||
DEFINE_TEST_CASE(TestMultiUserMultiContextPresenceWriter)
|
||||
{
|
||||
DEFINE_TEST_CASE_PROPERTIES(TestPresenceWriter);
|
||||
VERIFY_IS_TRUE(false);
|
||||
|
||||
pplx::event writeFinishEvent;
|
||||
int writeDelay = 0;
|
||||
int eventExpecting = 2;
|
||||
xbox::services::presence::presence_service_impl::set_presence_set_finished_handler([&writeFinishEvent, &writeDelay, &eventExpecting](int delay)
|
||||
{
|
||||
writeDelay = delay;
|
||||
if (!--eventExpecting)
|
||||
{
|
||||
writeFinishEvent.set();
|
||||
}
|
||||
});
|
||||
//pplx::event writeFinishEvent;
|
||||
//int writeDelay = 0;
|
||||
//int eventExpecting = 2;
|
||||
//xbox::services::presence::presence_service_impl::set_presence_set_finished_handler([&writeFinishEvent, &writeDelay, &eventExpecting](int delay)
|
||||
//{
|
||||
// writeDelay = delay;
|
||||
// if (!--eventExpecting)
|
||||
// {
|
||||
// writeFinishEvent.set();
|
||||
// }
|
||||
//});
|
||||
|
||||
auto xboxLiveContext1_User1 = GetMockXboxLiveContext_WinRT();
|
||||
auto xboxLiveContext2_User1 = ref new Microsoft::Xbox::Services::XboxLiveContext(xboxLiveContext1_User1->User);
|
||||
//auto xboxLiveContext1_User1 = GetMockXboxLiveContext_WinRT();
|
||||
//auto xboxLiveContext2_User1 = ref new Microsoft::Xbox::Services::XboxLiveContext(xboxLiveContext1_User1->User);
|
||||
|
||||
auto xboxLiveContext1_User2 = GetMockXboxLiveContext_WinRT(L"TestUser1");
|
||||
auto xboxLiveContext2_User2 = ref new Microsoft::Xbox::Services::XboxLiveContext(xboxLiveContext1_User1->User);
|
||||
//auto xboxLiveContext1_User2 = GetMockXboxLiveContext_WinRT(L"TestUser1");
|
||||
//auto xboxLiveContext2_User2 = ref new Microsoft::Xbox::Services::XboxLiveContext(xboxLiveContext1_User1->User);
|
||||
|
||||
auto httpCall = m_mockXboxSystemFactory->GetMockHttpCall();
|
||||
httpCall->ResultValue = StockMocks::CreateMockHttpCallResponse(L"");
|
||||
httpCall->set_custom_header(L"X-Heartbeat-After", L"60");
|
||||
auto presenceWriter = xbox::services::presence::presence_writer::get_presence_writer_singleton();
|
||||
presenceWriter->start_writer(
|
||||
xboxLiveContext1_User1->PresenceService->GetCppObj()._Impl()
|
||||
);
|
||||
//auto httpCall = m_mockXboxSystemFactory->GetMockHttpCall();
|
||||
//httpCall->ResultValue = StockMocks::CreateMockHttpCallResponse(L"");
|
||||
//httpCall->set_custom_header(L"X-Heartbeat-After", L"60");
|
||||
//auto presenceWriter = xbox::services::presence::presence_writer::get_presence_writer_singleton();
|
||||
//presenceWriter->start_writer(
|
||||
// xboxLiveContext1_User1->PresenceService->GetCppObj()._Impl()
|
||||
//);
|
||||
|
||||
presenceWriter->start_writer(
|
||||
xboxLiveContext2_User1->PresenceService->GetCppObj()._Impl()
|
||||
);
|
||||
VERIFY_ARE_EQUAL_UINT(1, presenceWriter->tracking_count());
|
||||
//presenceWriter->start_writer(
|
||||
// xboxLiveContext2_User1->PresenceService->GetCppObj()._Impl()
|
||||
//);
|
||||
//VERIFY_ARE_EQUAL_UINT(1, presenceWriter->tracking_count());
|
||||
|
||||
presenceWriter->start_writer(
|
||||
xboxLiveContext1_User2->PresenceService->GetCppObj()._Impl()
|
||||
);
|
||||
presenceWriter->start_writer(
|
||||
xboxLiveContext2_User2->PresenceService->GetCppObj()._Impl()
|
||||
);
|
||||
VERIFY_ARE_EQUAL_UINT(2, presenceWriter->tracking_count());
|
||||
//presenceWriter->start_writer(
|
||||
// xboxLiveContext1_User2->PresenceService->GetCppObj()._Impl()
|
||||
//);
|
||||
//presenceWriter->start_writer(
|
||||
// xboxLiveContext2_User2->PresenceService->GetCppObj()._Impl()
|
||||
//);
|
||||
//VERIFY_ARE_EQUAL_UINT(2, presenceWriter->tracking_count());
|
||||
|
||||
writeFinishEvent.wait();
|
||||
//writeFinishEvent.wait();
|
||||
|
||||
VERIFY_ARE_EQUAL_UINT(2, presenceWriter->tracking_count());
|
||||
//VERIFY_ARE_EQUAL_UINT(2, presenceWriter->tracking_count());
|
||||
|
||||
VERIFY_ARE_EQUAL_STR(L"POST", httpCall->HttpMethod);
|
||||
VERIFY_ARE_EQUAL_STR(L"https://userpresence.mockenv.xboxlive.com", httpCall->ServerName);
|
||||
//VERIFY_ARE_EQUAL_STR(L"POST", httpCall->HttpMethod);
|
||||
//VERIFY_ARE_EQUAL_STR(L"https://userpresence.mockenv.xboxlive.com", httpCall->ServerName);
|
||||
|
||||
VERIFY_IS_TRUE(writeDelay == 1);
|
||||
VERIFY_IS_TRUE(httpCall->CallCounter == 2);
|
||||
//VERIFY_IS_TRUE(writeDelay == 1);
|
||||
//VERIFY_IS_TRUE(httpCall->CallCounter == 2);
|
||||
|
||||
writeFinishEvent.reset();
|
||||
eventExpecting = 2;
|
||||
//writeFinishEvent.reset();
|
||||
//eventExpecting = 2;
|
||||
|
||||
presenceWriter->stop_writer(xboxLiveContext1_User1->User->XboxUserId->Data());
|
||||
VERIFY_ARE_EQUAL_UINT(1, presenceWriter->tracking_count());
|
||||
presenceWriter->stop_writer(xboxLiveContext2_User1->User->XboxUserId->Data());
|
||||
VERIFY_ARE_EQUAL_UINT(1, presenceWriter->tracking_count());
|
||||
presenceWriter->stop_writer(xboxLiveContext1_User2->User->XboxUserId->Data());
|
||||
VERIFY_ARE_EQUAL_UINT(0, presenceWriter->tracking_count());
|
||||
presenceWriter->stop_writer(xboxLiveContext2_User2->User->XboxUserId->Data());
|
||||
VERIFY_ARE_EQUAL_UINT(0, presenceWriter->tracking_count());
|
||||
//presenceWriter->stop_writer(xboxLiveContext1_User1->User->XboxUserId->Data());
|
||||
//VERIFY_ARE_EQUAL_UINT(1, presenceWriter->tracking_count());
|
||||
//presenceWriter->stop_writer(xboxLiveContext2_User1->User->XboxUserId->Data());
|
||||
//VERIFY_ARE_EQUAL_UINT(1, presenceWriter->tracking_count());
|
||||
//presenceWriter->stop_writer(xboxLiveContext1_User2->User->XboxUserId->Data());
|
||||
//VERIFY_ARE_EQUAL_UINT(0, presenceWriter->tracking_count());
|
||||
//presenceWriter->stop_writer(xboxLiveContext2_User2->User->XboxUserId->Data());
|
||||
//VERIFY_ARE_EQUAL_UINT(0, presenceWriter->tracking_count());
|
||||
|
||||
writeFinishEvent.wait();
|
||||
xbox::services::presence::presence_service_impl::set_presence_set_finished_handler(nullptr);
|
||||
//writeFinishEvent.wait();
|
||||
//xbox::services::presence::presence_service_impl::set_presence_set_finished_handler(nullptr);
|
||||
}
|
||||
|
||||
DEFINE_TEST_CASE(TestPresenceInvalidArgs)
|
||||
|
|
Загрузка…
Ссылка в новой задаче