[LYN-4915] [iOS] [Android] awscoreconfiguration.setreg, awsMetricsClientConfigurationsetreg and authenticationProvider.setreg couldn't be loaded when the application starts (#1716)

[LYN-4915] [iOS] [Android] awscoreconfiguration.setreg, awsMetricsClientConfiguration.setreg and authenticationProvider.setreg couldn't be loaded when the application starts
This commit is contained in:
Junbo Liang
2021-07-02 11:12:45 -07:00
committed by GitHub
parent dfef909b51
commit 9f2b31e077
35 changed files with 3943 additions and 3999 deletions
@@ -47,7 +47,7 @@ class GoogleAuthenticationProviderTest
})");
m_settingsRegistry->MergeSettingsFile(path, AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_googleAuthenticationProviderLocalMock.Initialize(m_settingsRegistry);
m_googleAuthenticationProviderLocalMock.Initialize();
}
void TearDown() override
@@ -63,7 +63,7 @@ public:
TEST_F(GoogleAuthenticationProviderTest, Initialize_Success)
{
AWSClientAuthUnitTest::GoogleAuthenticationProviderLocalMock mock;
ASSERT_TRUE(mock.Initialize(m_settingsRegistry));
ASSERT_TRUE(mock.Initialize());
ASSERT_EQ(mock.m_settings->m_appClientId, "TestGoogleClientId");
}
@@ -117,14 +117,19 @@ TEST_F(GoogleAuthenticationProviderTest, RefreshTokensAsync_Fail_RequestHttpErro
TEST_F(GoogleAuthenticationProviderTest, Initialize_Fail_EmptyRegistry)
{
AZ::SettingsRegistry::Unregister(m_settingsRegistry.get());
AZStd::shared_ptr<AZ::SettingsRegistryImpl> registry = AZStd::make_shared<AZ::SettingsRegistryImpl>();
registry->SetContext(m_serializeContext.get());
AZ::SettingsRegistry::Register(registry.get());
AWSClientAuthUnitTest::GoogleAuthenticationProviderLocalMock mock;
ASSERT_FALSE(mock.Initialize(registry));
ASSERT_FALSE(mock.Initialize());
ASSERT_EQ(mock.m_settings->m_appClientId, "");
AZ::SettingsRegistry::Unregister(registry.get());
registry.reset();
// Restore
mock.Initialize(m_settingsRegistry);
AZ::SettingsRegistry::Register(m_settingsRegistry.get());
mock.Initialize();
}