//////////////////////////////////////////////////////////////////////////////// // (c) Copyright, Ubisoft Entertainment Inc. || Created by Harbour // //////////////////////////////////////////////////////////////////////////////// #include "tests/config.h" #include "tests/common/helpers.h" #include "tests/fixture/memoryCheckFixture.h" #include "tests/fixture/authenticationFixture.h" #include #include #include namespace US_NS {; US_DEFINE_TEST(TestPlatformHelper); typedef AuthenticationFixture<1> PLATFORM_HELPER; typedef LeakChecker PLATFORM_HELPER_NOLOGIN; /// @test Validates that the appId can be retrieved before createSession TEST_F(PLATFORM_HELPER_NOLOGIN, USNOT_GetApplicationId) { const AsyncResult applicationIdResult = PlatformHelper::getFirstPartyApplicationId(ggp::GetPrimaryPlayerId()); ASSERT_TRUE(AsyncHelper::waitSuccess(applicationIdResult)); EXPECT_EQ(String(NS_COMMON::FIRSTPARTY_APP_ID), applicationIdResult.getResult()); // Check that a second call will not try to get a new JWT token const AsyncResult applicationIdCachedResult = PlatformHelper::getFirstPartyApplicationId(ggp::GetPrimaryPlayerId()); ASSERT_TRUE(applicationIdCachedResult.hasSucceeded()); EXPECT_EQ(String(NS_COMMON::FIRSTPARTY_APP_ID), applicationIdCachedResult.getResult()); } /// @test Validates that the appId can be retrieved after createSession and the result is returned synchronously TEST_F(PLATFORM_HELPER, US_GetApplicationIdAfterCreateSession) { const AsyncResult applicationIdResult = PlatformHelper::getFirstPartyApplicationId(ggp::GetPrimaryPlayerId()); ASSERT_TRUE(applicationIdResult.hasSucceeded()); EXPECT_EQ(String(NS_COMMON::FIRSTPARTY_APP_ID), applicationIdResult.getResult()); } };