@@ -56,8 +56,13 @@ static const int kPhoneAuthCompletionWaitMs = 8000; // NOLINT
5656static const int kPhoneAuthTimeoutMs = 0 ; // NOLINT
5757
5858// Set these in Firebase Console for your app.
59- static const char kPhoneAuthTestPhoneNumber [] = " +12345556789" ; // NOLINT
60- static const char kPhoneAuthTestVerificationCode [] = " 123456" ; // NOLINT
59+ static const char * kPhoneAuthTestPhoneNumbers [] = {
60+ " +12345556780" , " +12345556781" , " +12345556782" , " +12345556783" ,
61+ " +12345556784" , " +12345556785" , " +12345556786" , " +12345556787" ,
62+ " +12345556788" , " +12345556789" }; // NOLINT
63+ static const char kPhoneAuthTestVerificationCode [] = " 123456" ; // NOLINT
64+ static const int kPhoneAuthTestNumPhoneNumbers =
65+ sizeof (kPhoneAuthTestPhoneNumbers ) / sizeof (kPhoneAuthTestPhoneNumbers [0 ]);
6166
6267static const char kTestPassword [] = " testEmailPassword123" ;
6368static const char kTestEmailBad [] = " bad.test.email@example.com" ;
@@ -860,8 +865,12 @@ TEST_F(FirebaseAuthTest, TestPhoneAuth) {
860865 LogDebug (" Creating listener." );
861866 PhoneListener listener;
862867 LogDebug (" Calling VerifyPhoneNumber." );
863- phone_provider.VerifyPhoneNumber (kPhoneAuthTestPhoneNumber ,
864- kPhoneAuthTimeoutMs , nullptr , &listener);
868+ // Randomly choose one of the phone numbers to avoid collisions.
869+ const int random_phone_number =
870+ app_framework::GetCurrentTimeInMicroseconds () % kPhoneAuthTestNumPhoneNumbers ;
871+ phone_provider.VerifyPhoneNumber (
872+ kPhoneAuthTestPhoneNumbers [random_phone_number], kPhoneAuthTimeoutMs ,
873+ nullptr , &listener);
865874 // Wait for OnCodeSent() callback.
866875 int wait_ms = 0 ;
867876 LogDebug (" Waiting for code send." );
0 commit comments