64 lines
2.1 KiB
C++
64 lines
2.1 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// (c) Copyright, Ubisoft Entertainment Inc. || Created by Harbour //
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#include "tests/config.h"
|
|
#include "tests/common/helpers.h"
|
|
#include "tests/fixture/memoryCheckFixture.h"
|
|
#include <ubiservices/core/http/httpEngine.h>
|
|
#include <ubiservices/core/http/curl/httpRequestCurl.h>
|
|
#include <ubiservices/services/http/request/httpGet.h>
|
|
|
|
namespace US_NS {;
|
|
US_DEFINE_TEST(TestHttpRequestCurl);
|
|
};
|
|
|
|
#if !defined(US_DLL)
|
|
|
|
namespace US_NS {;
|
|
|
|
#if defined(US_TARGET_WINDOWS) || defined(US_TARGET_OSX) || defined(US_TARGET_LINUX) || defined(US_TARGET_GGP)
|
|
|
|
typedef LeakChecker HTTP_REQUEST_CURL;
|
|
|
|
TEST_F(HTTP_REQUEST_CURL, US_CurlRequestCertificateValid)
|
|
{
|
|
struct Local
|
|
{
|
|
static void initEngineWithProxy(HttpEngine& engine)
|
|
{
|
|
HttpConfig httpConfig;
|
|
#if defined(US_TEST_ENABLE_PROXY)
|
|
httpConfig.m_proxy = HttpProxyConfig(US_TEST_NS::PROXY_NAME, US_TEST_NS::PROXY_PORT);
|
|
#endif
|
|
engine.initialize(httpConfig);
|
|
}
|
|
};
|
|
|
|
const uint32 REQUEST_TIMEOUT_MS = 5000u;
|
|
|
|
HttpEngine engine;
|
|
Local::initEngineWithProxy(engine);
|
|
|
|
HttpHeader header;
|
|
header["DummyHeaderKeyGet"] = "DummyHeaderValueGet";
|
|
|
|
const Vector<StringUrl> urls = Vector<StringUrl>({
|
|
"https://uat-public-ubiservices.ubi.com",
|
|
"https://dev-public-ubiservices.ubi.com",
|
|
"https://public-ubiservices.ubi.com", //prod
|
|
"https://cert2-public-ubiservices.ubi.com" });
|
|
|
|
for (Vector<String>::const_iterator urlIt = urls.begin(); urlIt != urls.end(); urlIt++)
|
|
{
|
|
HttpGet request(*urlIt, header);
|
|
HttpRequestContext requestContextGet = engine.createRequest(request, HttpRetryHandler(HttpRetryConfig(0u)));
|
|
US_EXPECT_PROPERTY_WAIT(requestContextGet, HttpRequestContext::isComplete, true, REQUEST_TIMEOUT_MS);
|
|
EXPECT_TRUE(requestContextGet.hasSucceeded()) << "Failed for url : " << urlIt->getUtf8();
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
#endif // US_DLL
|