From 901dc7c91f33e38f59860f231f1d62f867f260dd Mon Sep 17 00:00:00 2001 From: "drsanta@google.com" Date: Tue, 1 Sep 2020 13:38:38 -0400 Subject: [PATCH 1/6] remove use of std::to_string in auth integration test --- auth/integration_test/src/integration_test.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/auth/integration_test/src/integration_test.cc b/auth/integration_test/src/integration_test.cc index 83ddf1fcda..d70fe60fe5 100644 --- a/auth/integration_test/src/integration_test.cc +++ b/auth/integration_test/src/integration_test.cc @@ -389,9 +389,11 @@ TEST_F(FirebaseAuthTest, TestTokensAndAuthStateListeners) { } static std::string GenerateEmailAddress() { + char time_string[22]; + snprintf(time_str, 22, "%d", app_framework::GetCurrentTimeInMicroseconds()); std::string email = "random_user_" + - std::to_string(app_framework::GetCurrentTimeInMicroseconds()) + + + time_str + "@gmail.com"; LogDebug("Generated email address: %s", email.c_str()); return email; @@ -712,8 +714,6 @@ TEST_F(FirebaseAuthTest, TestWithCustomEmailAndPassword) { EXPECT_NE(auth_->current_user(), nullptr); } -#if ! defined(__linux__) -// Test is disabled on linux due to the need to unlock the keystore. TEST_F(FirebaseAuthTest, TestAuthPersistenceWithAnonymousSignin) { WaitForCompletion(auth_->SignInAnonymously(), "SignInAnonymously"); ASSERT_NE(auth_->current_user(), nullptr); @@ -726,10 +726,7 @@ TEST_F(FirebaseAuthTest, TestAuthPersistenceWithAnonymousSignin) { EXPECT_TRUE(auth_->current_user()->is_anonymous()); DeleteUser(); } -#endif // ! defined(__linux__) -#if ! defined(__linux__) -// Test is disabled on linux due to the need to unlock the keychain. TEST_F(FirebaseAuthTest, TestAuthPersistenceWithEmailSignin) { std::string email = GenerateEmailAddress(); WaitForCompletion( @@ -767,8 +764,6 @@ TEST_F(FirebaseAuthTest, TestAuthPersistenceWithEmailSignin) { EXPECT_NE(auth_->current_user(), nullptr); DeleteUser(); } -#endif // ! defined(__linux__) - class PhoneListener : public firebase::auth::PhoneAuthProvider::Listener { public: From 4fde99c971e9f223ad1fb7d463851f8104c4b33e Mon Sep 17 00:00:00 2001 From: "drsanta@google.com" Date: Tue, 1 Sep 2020 14:07:46 -0400 Subject: [PATCH 2/6] fixed variable name --- auth/integration_test/src/integration_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auth/integration_test/src/integration_test.cc b/auth/integration_test/src/integration_test.cc index d70fe60fe5..7ec23b42ae 100644 --- a/auth/integration_test/src/integration_test.cc +++ b/auth/integration_test/src/integration_test.cc @@ -390,10 +390,10 @@ TEST_F(FirebaseAuthTest, TestTokensAndAuthStateListeners) { static std::string GenerateEmailAddress() { char time_string[22]; - snprintf(time_str, 22, "%d", app_framework::GetCurrentTimeInMicroseconds()); + snprintf(time_string, 22, "%d", app_framework::GetCurrentTimeInMicroseconds()); std::string email = "random_user_" + - + time_str + + + time_string + "@gmail.com"; LogDebug("Generated email address: %s", email.c_str()); return email; From 11470e43bbd43b6457a9060724e197fc15e4ee30 Mon Sep 17 00:00:00 2001 From: "drsanta@google.com" Date: Tue, 1 Sep 2020 14:40:24 -0400 Subject: [PATCH 3/6] use std::string::append directly --- auth/integration_test/src/integration_test.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/auth/integration_test/src/integration_test.cc b/auth/integration_test/src/integration_test.cc index 7ec23b42ae..ae7247c66e 100644 --- a/auth/integration_test/src/integration_test.cc +++ b/auth/integration_test/src/integration_test.cc @@ -391,10 +391,9 @@ TEST_F(FirebaseAuthTest, TestTokensAndAuthStateListeners) { static std::string GenerateEmailAddress() { char time_string[22]; snprintf(time_string, 22, "%d", app_framework::GetCurrentTimeInMicroseconds()); - std::string email = - "random_user_" + - + time_string + - "@gmail.com"; + std::string email = "random_user_"; + email.append(time_string); + email.append("@gmail.com"); LogDebug("Generated email address: %s", email.c_str()); return email; } From d31f939a5de06b40f6f707984fbdaed4ee99e659 Mon Sep 17 00:00:00 2001 From: "drsanta@google.com" Date: Tue, 1 Sep 2020 16:00:50 -0400 Subject: [PATCH 4/6] messaging test fix candidate --- messaging/integration_test/src/integration_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/messaging/integration_test/src/integration_test.cc b/messaging/integration_test/src/integration_test.cc index 34845e477b..1eca7a34c8 100644 --- a/messaging/integration_test/src/integration_test.cc +++ b/messaging/integration_test/src/integration_test.cc @@ -386,7 +386,10 @@ static std::string ConstructHtmlToSendMessage( "document.write('

Failed to send notification.

');" "document.write('Status '+xhttp.status+': '+xhttp.response);" "}},"; - h += std::to_string(delay_seconds * 1000) + ");}"; + char delay_seconds_string[22]; + snprintf(delay_seconds_string, 22, "%d", delay_seconds); + h += delay_seconds_string; + h += ");}"; return h; } From 9bc5df7d9251f706f6c875b7f887bd5b4d590d77 Mon Sep 17 00:00:00 2001 From: "drsanta@google.com" Date: Tue, 1 Sep 2020 17:24:09 -0400 Subject: [PATCH 5/6] re-added guards against persistence auth tests on linux --- auth/integration_test/src/integration_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auth/integration_test/src/integration_test.cc b/auth/integration_test/src/integration_test.cc index ae7247c66e..6034f3b5ab 100644 --- a/auth/integration_test/src/integration_test.cc +++ b/auth/integration_test/src/integration_test.cc @@ -713,6 +713,8 @@ TEST_F(FirebaseAuthTest, TestWithCustomEmailAndPassword) { EXPECT_NE(auth_->current_user(), nullptr); } +#if ! defined(__linux__) +// Test is disabled on linux due to the need to unlock the keystore. TEST_F(FirebaseAuthTest, TestAuthPersistenceWithAnonymousSignin) { WaitForCompletion(auth_->SignInAnonymously(), "SignInAnonymously"); ASSERT_NE(auth_->current_user(), nullptr); @@ -725,7 +727,10 @@ TEST_F(FirebaseAuthTest, TestAuthPersistenceWithAnonymousSignin) { EXPECT_TRUE(auth_->current_user()->is_anonymous()); DeleteUser(); } +#endif // ! defined(__linux__) +#if ! defined(__linux__) +// Test is disabled on linux due to the need to unlock the keychain. TEST_F(FirebaseAuthTest, TestAuthPersistenceWithEmailSignin) { std::string email = GenerateEmailAddress(); WaitForCompletion( @@ -763,6 +768,7 @@ TEST_F(FirebaseAuthTest, TestAuthPersistenceWithEmailSignin) { EXPECT_NE(auth_->current_user(), nullptr); DeleteUser(); } +#endif // ! defined(__linux__) class PhoneListener : public firebase::auth::PhoneAuthProvider::Listener { public: From 39647c583b268c2ff69e18d75c1ea50017b34c99 Mon Sep 17 00:00:00 2001 From: "drsanta@google.com" Date: Tue, 1 Sep 2020 17:35:50 -0400 Subject: [PATCH 6/6] put pack newline --- auth/integration_test/src/integration_test.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/auth/integration_test/src/integration_test.cc b/auth/integration_test/src/integration_test.cc index 6034f3b5ab..37ceb8b495 100644 --- a/auth/integration_test/src/integration_test.cc +++ b/auth/integration_test/src/integration_test.cc @@ -770,6 +770,7 @@ TEST_F(FirebaseAuthTest, TestAuthPersistenceWithEmailSignin) { } #endif // ! defined(__linux__) + class PhoneListener : public firebase::auth::PhoneAuthProvider::Listener { public: PhoneListener()