Skip to content

Commit 31e40b2

Browse files
authored
Merge branch 'dev' into bugfix/integration-tests-mac-openssl-error
2 parents eba69c8 + 08f1456 commit 31e40b2

File tree

17 files changed

+93
-49
lines changed

17 files changed

+93
-49
lines changed

admob/integration_test/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase AdMob test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/AdMob', '6.24.0'
7+
pod 'Firebase/AdMob', '7.0.0'
88
end
99

1010
post_install do |installer|

analytics/integration_test/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Analytics test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Analytics', '6.24.0'
7+
pod 'Firebase/Analytics', '7.0.0'
88
end
99

1010
post_install do |installer|

app/integration_test/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase App test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Analytics', '6.24.0'
7+
pod 'Firebase/Analytics', '7.0.0'
88
end
99

1010
post_install do |installer|

auth/integration_test/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Auth test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Auth', '6.24.0'
7+
pod 'Firebase/Auth', '7.0.0'
88
end
99

1010
post_install do |installer|

database/integration_test/Podfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Realtime Database test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Database', '6.24.0'
8-
pod 'Firebase/Auth', '6.24.0'
7+
pod 'Firebase/Database', '7.0.0'
8+
pod 'Firebase/Auth', '7.0.0'
99
end
1010

1111
post_install do |installer|

database/integration_test/src/integration_test.cc

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ class FirebaseDatabaseTest : public FirebaseTest {
137137
// Sign in an anonymous user.
138138
static void SignIn();
139139
// Sign out the current user, if applicable.
140+
// If this is an anonymous user, deletes the user instead,
141+
// to avoid polluting the user list.
140142
static void SignOut();
141143

142144
// Initialize Firebase Database.
@@ -341,12 +343,19 @@ void FirebaseDatabaseTest::SignOut() {
341343
// Already signed out.
342344
return;
343345
}
344-
345-
shared_auth_->SignOut();
346-
347-
// Wait for the sign-out to finish.
348-
while (shared_auth_->current_user() != nullptr) {
349-
if (ProcessEvents(100)) break;
346+
if (shared_auth_->current_user()->is_anonymous()) {
347+
// If signed in anonymously, delete the anonymous user.
348+
WaitForCompletion(shared_auth_->current_user()->Delete(), "DeleteAnonymousUser");
349+
}
350+
else {
351+
// If not signed in anonymously (e.g. if the tests were modified to sign in
352+
// as an actual user), just sign out normally.
353+
shared_auth_->SignOut();
354+
355+
// Wait for the sign-out to finish.
356+
while (shared_auth_->current_user() != nullptr) {
357+
if (ProcessEvents(100)) break;
358+
}
350359
}
351360
EXPECT_EQ(shared_auth_->current_user(), nullptr);
352361
}
@@ -1180,16 +1189,22 @@ TEST_F(FirebaseDatabaseTest, TestInfoConnected) {
11801189
}
11811190
LogDebug("Disconnecting...");
11821191
database_->GoOffline();
1192+
// Pause a moment to give the SDK time to realize we are disconnected.
1193+
ProcessEvents(1000);
11831194
{
11841195
auto disconnected = info.GetValue();
11851196
WaitForCompletion(disconnected, "GetValue 3");
11861197
EXPECT_EQ(disconnected.result()->value(), false);
11871198
}
11881199
LogDebug("Reconnecting...");
11891200
database_->GoOnline();
1201+
// Pause a moment to give the SDK time to realize we are reconnected.
11901202
ProcessEvents(1000);
11911203
// Force getting a value so that we reconnect to the database.
11921204
WaitForCompletion(ref.GetValue(), "GetValue 4 [ignored]");
1205+
// Pause another moment to REALLY give the SDK time to realize we are
1206+
// reconnected.
1207+
ProcessEvents(1000);
11931208
{
11941209
auto reconnected = info.GetValue();
11951210
WaitForCompletion(reconnected, "GetValue 5");

dynamic_links/integration_test/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Dynamic Links test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/DynamicLinks', '6.24.0'
7+
pod 'Firebase/DynamicLinks', '7.0.0'
88
end
99

1010
post_install do |installer|

firestore/integration_test/Podfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Realtime Firestore test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Firestore', '6.32.2'
8-
pod 'Firebase/Auth', '6.32.2'
7+
pod 'Firebase/Firestore', '7.0.0'
8+
pod 'Firebase/Auth', '7.0.0'
99
end
1010

1111
post_install do |installer|

firestore/integration_test/src/integration_test.cc

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class FirebaseFirestoreBasicTest : public FirebaseTest {
7676
// Sign in an anonymous user.
7777
static void SignIn();
7878
// Sign out the current user, if applicable.
79+
// If this is an anonymous user, deletes the user instead,
80+
// to avoid polluting the user list.
7981
static void SignOut();
8082

8183
// Initialize Firestore.
@@ -282,11 +284,19 @@ void FirebaseFirestoreBasicTest::SignOut() {
282284
return;
283285
}
284286

285-
shared_auth_->SignOut();
286-
287-
// Wait for the sign-out to finish.
288-
while (shared_auth_->current_user() != nullptr) {
289-
if (ProcessEvents(100)) break;
287+
if (shared_auth_->current_user()->is_anonymous()) {
288+
// If signed in anonymously, delete the anonymous user.
289+
WaitForCompletion(shared_auth_->current_user()->Delete(), "DeleteAnonymousUser");
290+
}
291+
else {
292+
// If not signed in anonymously (e.g. if the tests were modified to sign in
293+
// as an actual user), just sign out normally.
294+
shared_auth_->SignOut();
295+
296+
// Wait for the sign-out to finish.
297+
while (shared_auth_->current_user() != nullptr) {
298+
if (ProcessEvents(100)) break;
299+
}
290300
}
291301
EXPECT_EQ(shared_auth_->current_user(), nullptr);
292302
}

functions/integration_test/Podfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Cloud Functions for Firebase test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Functions', '6.24.0'
8-
pod 'Firebase/Auth', '6.24.0'
7+
pod 'Firebase/Functions', '7.0.0'
8+
pod 'Firebase/Auth', '7.0.0'
99
end
1010

1111
post_install do |installer|

installations/integration_test/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Installations test application.
55

66
target 'integration_test' do

instance_id/integration_test/Podfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Instance ID test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Analytics', '6.24.0'
8-
pod 'FirebaseInstanceID', '4.3.4'
7+
pod 'Firebase/Analytics', '7.0.0'
8+
pod 'FirebaseInstanceID', '7.0.0'
99
end
1010

1111
post_install do |installer|

messaging/integration_test/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Cloud Messaging test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Messaging', '6.24.0'
7+
pod 'Firebase/Messaging', '7.0.0'
88
end
99

1010
post_install do |installer|

remote_config/integration_test/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Firebase Remote Config test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/RemoteConfig', '6.24.0'
7+
pod 'Firebase/RemoteConfig', '7.0.0'
88
end
99

1010
post_install do |installer|

storage/integration_test/Podfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
source 'https://github.com/CocoaPods/Specs.git'
3-
platform :ios, '8.0'
3+
platform :ios, '10.0'
44
# Cloud Storage for Firebase test application.
55

66
target 'integration_test' do
7-
pod 'Firebase/Storage', '6.24.0'
8-
pod 'Firebase/Auth', '6.24.0'
7+
pod 'Firebase/Storage', '7.0.0'
8+
pod 'Firebase/Auth', '7.0.0'
99
end
1010

1111
post_install do |installer|

storage/integration_test/src/integration_test.cc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class FirebaseStorageTest : public FirebaseTest {
8787
// Sign in an anonymous user.
8888
static void SignIn();
8989
// Sign out the current user, if applicable.
90+
// If this is an anonymous user, deletes the user instead,
91+
// to avoid polluting the user list.
9092
static void SignOut();
9193

9294
// Initialize Firebase Storage.
@@ -279,10 +281,19 @@ void FirebaseStorageTest::SignOut() {
279281
// Already signed out.
280282
return;
281283
}
282-
shared_auth_->SignOut();
283-
// Wait for the sign-out to finish.
284-
while (shared_auth_->current_user() != nullptr) {
285-
if (ProcessEvents(100)) break;
284+
if (shared_auth_->current_user()->is_anonymous()) {
285+
// If signed in anonymously, delete the anonymous user.
286+
WaitForCompletion(shared_auth_->current_user()->Delete(), "DeleteAnonymousUser");
287+
}
288+
else {
289+
// If not signed in anonymously (e.g. if the tests were modified to sign in
290+
// as an actual user), just sign out normally.
291+
shared_auth_->SignOut();
292+
293+
// Wait for the sign-out to finish.
294+
while (shared_auth_->current_user() != nullptr) {
295+
if (ProcessEvents(100)) break;
296+
}
286297
}
287298
EXPECT_EQ(shared_auth_->current_user(), nullptr);
288299
}

testing/sample_framework/src/desktop/desktop_app_framework.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <algorithm>
2020
#include <cstring>
2121
#include <iostream>
22+
#include <mutex>
2223
#include <string>
2324
#include <thread> // NOLINT
2425
#include <vector>
@@ -95,7 +96,7 @@ std::string PathForResource() {
9596
return std::string();
9697
}
9798
void LogMessageV(bool suppress, const char* format, va_list list) {
98-
// Save the log to the g_full_logs list regardless of whether it should be
99+
// Save the log to the Full Logs list regardless of whether it should be
99100
// suppressed.
100101
static const int kLineBufferSize = 1024;
101102
char buffer[kLineBufferSize + 2];
@@ -122,20 +123,27 @@ void LogMessage(const char* format, ...) {
122123

123124
static bool g_save_full_log = false;
124125
static std::vector<std::string> g_full_logs; // NOLINT
126+
static std::mutex g_full_log_mutex;
125127

126-
void AddToFullLog(const char* str) { g_full_logs.push_back(std::string(str)); }
128+
void AddToFullLog(const char* str) {
129+
std::lock_guard<std::mutex> guard(g_full_log_mutex);
130+
g_full_logs.push_back(std::string(str)); }
127131

128132
bool GetPreserveFullLog() { return g_save_full_log; }
129133
void SetPreserveFullLog(bool b) { g_save_full_log = b; }
130134

131-
void ClearFullLog() { g_full_logs.clear(); }
135+
void ClearFullLog() {
136+
std::lock_guard<std::mutex> guard(g_full_log_mutex);
137+
g_full_logs.clear();
138+
}
132139

133140
void OutputFullLog() {
141+
std::lock_guard<std::mutex> guard(g_full_log_mutex);
134142
for (int i = 0; i < g_full_logs.size(); ++i) {
135143
fputs(g_full_logs[i].c_str(), stdout);
136144
}
137145
fflush(stdout);
138-
ClearFullLog();
146+
g_full_logs.clear();
139147
}
140148

141149
WindowContext GetWindowContext() { return nullptr; }

0 commit comments

Comments
 (0)