Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions storage/integration_test/src/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class FirebaseStorageTest : public FirebaseTest {
void Terminate();
// Sign in an anonymous user.
void SignIn();
// Sign out the current user, if applicable.
void SignOut();
// Create a unique working folder and return a reference to it.
firebase::storage::StorageReference CreateFolder();

Expand Down Expand Up @@ -107,9 +109,8 @@ void FirebaseStorageTest::SetUp() {
}

void FirebaseStorageTest::TearDown() {
if (initialized_) {
Terminate();
}
SignOut();
Terminate();
FirebaseTest::TearDown();
}

Expand Down Expand Up @@ -201,6 +202,24 @@ void FirebaseStorageTest::SignIn() {
ProcessEvents(100);
}

void FirebaseStorageTest::SignOut() {
if (auth_ == nullptr) {
// Auth is not set up.
return;
}
if (auth_->current_user() == nullptr) {
// Already signed out.
return;
}
auth_->SignOut();
// Wait for the sign-out to finish.
while (auth_->current_user() != nullptr) {
if (ProcessEvents(100)) break;
}
ProcessEvents(100);
EXPECT_EQ(auth_->current_user(), nullptr);
}

firebase::storage::StorageReference FirebaseStorageTest::CreateFolder() {
// Generate a folder for the test data based on the time in milliseconds.
int64_t time_in_microseconds = GetCurrentTimeInMicroseconds();
Expand Down