//////////////////////////////////////////////////////////////////////////////// // (c) Copyright, Ubisoft Entertainment Inc. || Created by Harbour // //////////////////////////////////////////////////////////////////////////////// /// @file authenticationFixture.h /// @cond PREVENTS_DOXYGEN_WARNING #pragma once #include "tests/fixture/memoryCheckFixture.h" #include #include #include #include #if !defined(US_SDK_S2S) #include #endif #include namespace US_NS {; struct EventNotification; namespace AsyncHelper { ::testing::AssertionResult waitSuccess(const AsyncResultBase& result, TimeMilli timeout = NS_COMMON::DEFAULT_WAIT_TIME); ::testing::AssertionResult waitFailure(const AsyncResultBase& result, Errors::ErrorCode error); bool waitFailureResponse(const AsyncResultBase& result, Errors::ErrorCode error); } namespace EventsNotificationHelper { inline bool waitForEventConfig(ListenerHandler& handler); } class AuthenticationFixtureBase : public LeakChecker { }; // Creates many facades (number specified in the template argument). template class AuthenticationFixture : public AuthenticationFixtureBase { protected: AuthenticationFixture(); #if defined(US_SDK_S2S) virtual ~AuthenticationFixture() = default; #else virtual ~AuthenticationFixture(); #endif void SetUp() override; void TearDown() override; uint32 getInstancesCount() const; Facade& getFacade(uint32 index = 0); const Facade& getFacade(uint32 index = 0) const; const Facade& getFacadeConst(uint32 index = 0) const; FacadeInternal& getFacadeInternal(uint32 index = 0); const FacadeInternal& getFacadeInternal(uint32 index = 0) const; ListenerHandler& getHandler(uint32 index = 0); #if !defined(US_SDK_S2S) const PlayerCredentials& getCredentials(uint32 index = 0) const; Vector getWebSocketContentTypes() const; String getWebSocketJsonData() const; #endif #if !defined(US_SDK_S2S) bool isEnvironmentNot(Environment target = Environment::Uat); #endif void testCall(); #if !defined(US_DLL) void waitForPostLoginCompletion(uint32 waitTimeInMSec = 10000); #endif static const uint32 m_facadesCount = facadesCount; static const bool m_executeLogin = executeLogin; private: US_CLASS_COPY_NOT_ALLOWED(AuthenticationFixture); void SetUp(uint32 index); void TearDown(uint32 index); bool isLoginRequired() const; bool m_loginIsSuccessfulArray[facadesCount]; Facade* m_facades[facadesCount]; ListenerHandler* m_handlers[facadesCount]; #if !defined(US_SDK_S2S) mutable Vector* m_notificationContentTypes; PlayerCredentials* m_credentials[facadesCount]; #endif }; }; #include "authenticationFixture.inl" /// @endcond