@@ -56,8 +56,13 @@ static const int kPhoneAuthCompletionWaitMs = 8000; // NOLINT
56
56
static const int kPhoneAuthTimeoutMs = 0 ; // NOLINT
57
57
58
58
// 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 ]);
61
66
62
67
static const char kTestPassword [] = " testEmailPassword123" ;
63
68
static const char kTestEmailBad [] =
" [email protected] " ;
@@ -860,8 +865,12 @@ TEST_F(FirebaseAuthTest, TestPhoneAuth) {
860
865
LogDebug (" Creating listener." );
861
866
PhoneListener listener;
862
867
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);
865
874
// Wait for OnCodeSent() callback.
866
875
int wait_ms = 0 ;
867
876
LogDebug (" Waiting for code send." );
0 commit comments