This commit is contained in:
Jason Sandlin 2017-06-23 14:14:21 -07:00 коммит произвёл GitHub
Родитель c26636f340
Коммит 6773495807
3 изменённых файлов: 94 добавлений и 2 удалений

Просмотреть файл

@ -3,9 +3,10 @@
#pragma once
#include "pch_common.h"
#ifdef XSAPI_CPP
#undef XSAPI_CPP
#endif
#define XSAPI_CPP 1
#include "pch_common.h"

Просмотреть файл

@ -38,6 +38,62 @@ MockHttpCall::get_response(
return pplx::task_from_result(ResultValue);
}
#if TV_API | XBOX_UWP
/// <summary>
/// Attach the Xbox Live token, sign the request, send the request to the service, and return the response.
/// </summary>
pplx::task<std::shared_ptr<http_call_response>>
MockHttpCall::get_response_with_auth(
_In_ Windows::Xbox::System::User^ user,
_In_ http_call_response_body_type httpCallResponseBodyType,
_In_ bool allUsersAuthRequired
)
{
if (FAILED(ResultHR))
{
throw ResultHR;
}
CallCounter++;
return pplx::task_from_result(ResultValue);
}
#elif UNIT_TEST_SERVICES || !XSAPI_CPP
pplx::task<std::shared_ptr<http_call_response>>
MockHttpCall::get_response_with_auth(
_In_ Microsoft::Xbox::Services::System::XboxLiveUser^ user,
_In_ http_call_response_body_type httpCallResponseBodyType,
_In_ bool allUsersAuthRequired
)
{
if (FAILED(ResultHR))
{
throw ResultHR;
}
CallCounter++;
return pplx::task_from_result(ResultValue);
}
#else
pplx::task<std::shared_ptr<http_call_response>> get_response_with_auth(
_In_ std::shared_ptr<xbox::services::system::xbox_live_user> user,
_In_ http_call_response_body_type httpCallResponseBodyType,
_In_ bool allUsersAuthRequired
)
{
if (FAILED(ResultHR))
{
throw ResultHR;
}
CallCounter++;
return pplx::task_from_result(ResultValue);
}
#endif
pplx::task<std::shared_ptr<http_call_response>>
MockHttpCall::get_response(
_In_ http_call_response_body_type httpCallResponseBodyType,

Просмотреть файл

@ -15,6 +15,41 @@ public:
_In_ http_call_response_body_type httpCallResponseBodyType
) override;
#if TV_API | XBOX_UWP
/// <summary>
/// Attach the Xbox Live token, sign the request, send the request to the service, and return the response.
/// </summary>
virtual pplx::task<std::shared_ptr<http_call_response>> get_response_with_auth(
_In_ Windows::Xbox::System::User^ user,
_In_ http_call_response_body_type httpCallResponseBodyType = http_call_response_body_type::json_body,
_In_ bool allUsersAuthRequired = false
) override;
#elif UNIT_TEST_SERVICES || !XSAPI_CPP
/// <summary>
/// Attach the Xbox Live token, sign the request, send the request to the service, and return the response.
/// </summary>
virtual pplx::task<std::shared_ptr<http_call_response>> get_response_with_auth(
_In_ Microsoft::Xbox::Services::System::XboxLiveUser^ user,
_In_ http_call_response_body_type httpCallResponseBodyType = http_call_response_body_type::json_body,
_In_ bool allUsersAuthRequired = false
) override;
#else
/// <summary>
/// Attach the Xbox Live token, sign the request, send the request to the service, and return the response.
/// </summary>
virtual pplx::task<std::shared_ptr<http_call_response>> get_response_with_auth(
_In_ std::shared_ptr<xbox::services::system::xbox_live_user> user,
_In_ http_call_response_body_type httpCallResponseBodyType = http_call_response_body_type::json_body,
_In_ bool allUsersAuthRequired = false
) override;
#endif
virtual pplx::task< std::shared_ptr<http_call_response> > get_response(
_In_ http_call_response_body_type httpCallResponseBodyType,
_In_ const web::http::http_request& httpRequest