Skip to content

Temporarily disbale a smoke test case for Crashlytics. #2831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@

import static com.google.common.truth.Truth.assertThat;

import android.os.Bundle;
import androidx.test.core.app.ApplicationProvider;
import com.google.firebase.analytics.FirebaseAnalytics;
//import android.os.Bundle;
//import androidx.test.core.app.ApplicationProvider;
//import com.google.firebase.analytics.FirebaseAnalytics;

import androidx.test.runner.AndroidJUnit4;
import com.google.firebase.crashlytics.internal.breadcrumbs.BreadcrumbSource;
import com.google.firebase.crashlytics.internal.common.CrashlyticsCore;
import java.lang.reflect.Field;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
//import com.google.firebase.crashlytics.internal.breadcrumbs.BreadcrumbSource;
//import com.google.firebase.crashlytics.internal.common.CrashlyticsCore;
//import java.lang.reflect.Field;
//import java.util.concurrent.CountDownLatch;
//import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -36,30 +36,35 @@
@RunWith(AndroidJUnit4.class)
public final class CrashlyticsTest {

@Test
public void analyticsIntegration() {
// Validates that Firebase Analytics and Crashlytics interoperability is working, by confirming
// that events sent to Firebase Analytics are received by the Crashlytics breadcrumb handler.
try {
BreadcrumbSource breadcrumbSource = FirebaseCrashlytics.getInstance().core.breadcrumbSource;
final CountDownLatch eventReceivedLatch = new CountDownLatch(1);
breadcrumbSource.registerBreadcrumbHandler(breadcrumbHandler -> {
eventReceivedLatch.countDown();
});

Bundle eventBundle = new Bundle();
eventBundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "testName");
FirebaseAnalytics.getInstance(ApplicationProvider.getApplicationContext()).logEvent(
FirebaseAnalytics.Event.APP_OPEN, eventBundle);

// Wait up to 2 seconds, which is plenty of time for the event
eventReceivedLatch.await(2000, TimeUnit.MILLISECONDS);
assertThat(eventReceivedLatch.getCount()).isEqualTo(0);

} catch (Exception e) {
throw new RuntimeException(e);
}
}
// TODO(yifany): Uncomment after M100 releases.
//
// Fields `core` and `breadcrumbSource` were made visible for test in
// https://github.com/firebase/firebase-android-sdk/pull/2737, which goes out in
// 18.2.0 (M100). This test case that builds against 18.1.0 is expected to fail.
// @Test
// public void analyticsIntegration() {
// // Validates that Firebase Analytics and Crashlytics interoperability is working, by confirming
// // that events sent to Firebase Analytics are received by the Crashlytics breadcrumb handler.
// try {
// BreadcrumbSource breadcrumbSource = FirebaseCrashlytics.getInstance().core.breadcrumbSource;
// final CountDownLatch eventReceivedLatch = new CountDownLatch(1);
// breadcrumbSource.registerBreadcrumbHandler(breadcrumbHandler -> {
// eventReceivedLatch.countDown();
// });
//
// Bundle eventBundle = new Bundle();
// eventBundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "testName");
// FirebaseAnalytics.getInstance(ApplicationProvider.getApplicationContext()).logEvent(
// FirebaseAnalytics.Event.APP_OPEN, eventBundle);
//
// // Wait up to 2 seconds, which is plenty of time for the event
// eventReceivedLatch.await(2000, TimeUnit.MILLISECONDS);
// assertThat(eventReceivedLatch.getCount()).isEqualTo(0);
//
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// }

@Test
public void setCustomKeys() {
Expand Down