-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae04cd4
commit d3441ae
Showing
9 changed files
with
134 additions
and
6 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...d-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/session/SessionSpanTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package io.embrace.android.embracesdk.session | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import io.embrace.android.embracesdk.IntegrationTestRule | ||
import io.embrace.android.embracesdk.recordSession | ||
import org.junit.Assert.assertFalse | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
internal class SessionSpanTest { | ||
|
||
@Rule | ||
@JvmField | ||
val testRule: IntegrationTestRule = IntegrationTestRule { | ||
IntegrationTestRule.Harness(startImmediately = false) | ||
} | ||
|
||
@Test | ||
fun `there is always a valid session when background activity is enabled`() { | ||
with(testRule) { | ||
harness.overriddenConfigService.backgroundActivityCaptureEnabled = true | ||
startSdk() | ||
checkNotNull(harness.recordSession { | ||
assertFalse(embrace.currentSessionId.isNullOrBlank()) | ||
}) | ||
assertFalse(embrace.currentSessionId.isNullOrBlank()) | ||
checkNotNull(harness.recordSession { | ||
assertFalse(embrace.currentSessionId.isNullOrBlank()) | ||
}) | ||
} | ||
} | ||
|
||
@Test | ||
fun `no valid session when bg activity not enabled after backgrounding`() { | ||
with(testRule) { | ||
harness.overriddenConfigService.backgroundActivityCaptureEnabled = false | ||
startSdk() | ||
checkNotNull(harness.recordSession { | ||
assertFalse(embrace.currentSessionId.isNullOrBlank()) | ||
}) | ||
assertTrue(embrace.currentSessionId.isNullOrBlank()) | ||
checkNotNull(harness.recordSession { | ||
assertFalse(embrace.currentSessionId.isNullOrBlank()) | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters