Skip to content
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

001 fix(ttd): Add TimeToDisplay integration to force fetch the data #4669

Merged
merged 41 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
290f3c3
feat(ttid): Add support for measuring Time to Initial Display for alr…
krystofwoldrich Mar 14, 2025
9520bfd
fix(ttd): Equalize TTID and TTFD duration when TTFD manual API is cal…
krystofwoldrich Mar 14, 2025
fd98178
feat(ttd): Add `createTimeToFullDisplay({useFocusEffect})` to allow r…
krystofwoldrich Mar 18, 2025
eee7cec
add createTimeToInitialDisplay
krystofwoldrich Mar 18, 2025
a33f929
add changelog
krystofwoldrich Mar 18, 2025
ceedad9
wip!: Add TimeToDisplay integration to force fetch the data
krystofwoldrich Mar 19, 2025
64fb9cc
add ios implementation and end timestamp align
krystofwoldrich Mar 19, 2025
6c66f29
Add `popTimeToDisplayFor` mock function to NATIVE interface for testing
krystofwoldrich Mar 20, 2025
a00860e
fix
krystofwoldrich Mar 20, 2025
7c2dad9
fix lint useFocus
krystofwoldrich Mar 21, 2025
3d745b1
add time to initial display tests
krystofwoldrich Mar 21, 2025
c5048bd
add ttd integration tests
krystofwoldrich Mar 21, 2025
7a0950d
fix lint useFocus
krystofwoldrich Mar 21, 2025
ce4d13f
fix lint
krystofwoldrich Mar 21, 2025
8f69e40
Merge branch 'kw-record-ttd-on-focus' into kw-force-fetch-ttd
krystofwoldrich Mar 21, 2025
3fa5860
Revert "Merge branch 'kw-record-ttd-on-focus' into kw-force-fetch-ttd"
krystofwoldrich Mar 21, 2025
1764f2a
fix file name
krystofwoldrich Mar 21, 2025
40a95ed
Merge commit '8f0282eec10cc336045d1bda2dcc1277bb5343d5' into kw-recor…
krystofwoldrich Mar 21, 2025
d21477b
fix lint
krystofwoldrich Mar 21, 2025
b8e6638
Merge branch 'kw-record-ttd-on-focus' into kw-force-fetch-ttd
krystofwoldrich Mar 21, 2025
053139c
add android draw reported tests
krystofwoldrich Mar 21, 2025
bda2845
add ios tests
krystofwoldrich Mar 21, 2025
f399dad
fix android tests deps
krystofwoldrich Mar 21, 2025
df06195
add full display to sample app
krystofwoldrich Mar 21, 2025
44f2404
fix file name casing
krystofwoldrich Mar 21, 2025
ea4f624
update e2e test to check all transaction for ttid and ttfd
krystofwoldrich Mar 21, 2025
a9aa34a
Merge branch 'main' into kw/fix-ttfd-before-auto-ttid-equal-duration
krystofwoldrich Mar 24, 2025
a26b576
Update CHANGELOG.md
krystofwoldrich Mar 24, 2025
e0ce666
Update CHANGELOG.md
krystofwoldrich Mar 24, 2025
cd9daac
Merge remote-tracking branch 'origin/kw/fix-ttfd-before-auto-ttid-equ…
krystofwoldrich Mar 24, 2025
1cf5664
Remove commented code SpaceflightNewsScreen.tsx
krystofwoldrich Mar 24, 2025
5ce5f1a
Update App.tsx
krystofwoldrich Mar 24, 2025
6f0e3b8
Merge branch 'kw-record-ttd-on-focus' into kw-force-fetch-ttd
krystofwoldrich Mar 24, 2025
c371ad0
add changelog
krystofwoldrich Mar 24, 2025
8ec235c
fix marking span as used
krystofwoldrich Mar 24, 2025
892e122
add buffer tests
krystofwoldrich Mar 24, 2025
815e857
Improve comment clarity in RNSentryTimeToDisplay.m to specify the pur…
krystofwoldrich Mar 24, 2025
17a6bfe
Merge branch 'main' into kw-force-fetch-ttd
krystofwoldrich Mar 25, 2025
f121b97
Update ArticleCard.tsx
krystofwoldrich Mar 26, 2025
687172a
Merge branch 'main' into kw-force-fetch-ttd
krystofwoldrich Mar 26, 2025
b6bbe21
Update CHANGELOG.md
krystofwoldrich Mar 26, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

- Change `gradle.projectsEvaluated` to `project.afterEvaluate` in the Sentry Gradle Plugin to fix tasks not being created when using `--configure-on-demand` ([#4687](https://github.com/getsentry/sentry-react-native/pull/4687))
- Remove `SENTRY_FORCE_FOREGROUND` from Xcode Scripts as the underlying `--force-foreground` Sentry CLI is no-op since v2.37.0 ([#4689](https://github.com/getsentry/sentry-react-native/pull/4689))
- TTID and TTFD use native getters instead of events to pass timestamps to the JS layer ([#4669](https://github.com/getsentry/sentry-react-native/pull/4669))

## 6.10.0

Expand Down
1 change: 1 addition & 0 deletions packages/core/RNSentryAndroidTester/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.test:core-ktx:1.6.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.10.0'
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.2.1'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
package io.sentry.react

import android.app.Activity
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import com.facebook.react.bridge.ReactApplicationContext
import io.sentry.android.core.BuildInfoProvider
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.mock
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.whenever
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class RNSentryOnDrawReporterTest {
companion object {
private const val TTID_PREFIX = RNSentryOnDrawReporterManager.TTID_PREFIX
private const val TTFD_PREFIX = RNSentryOnDrawReporterManager.TTFD_PREFIX
private const val SPAN_ID = "test-span-id"
private const val NEW_SPAN_ID = "new-test-span-id"
}

@Before
fun setUp() {
MockitoAnnotations.openMocks(this)
}

@Test
fun `when parentSpanId and timeToFullDisplay are set the next render timestamp is saved`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setFullDisplay(true)
reporter.setParentSpanId(SPAN_ID)

assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID))
}

@Test
fun `when parentSpanId and timeToInitialDisplay are set the next render timestamp is saved`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setInitialDisplay(true)
reporter.setParentSpanId(SPAN_ID)

assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID))
}

@Test
fun `when parentSpanId and timeToFullDisplay are set the next render timestamp is saved - reversed order`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setParentSpanId(SPAN_ID)
reporter.setFullDisplay(true)

assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID))
}

@Test
fun `when parentSpanId and timeToInitialDisplay are set the next render timestamp is saved - reversed order`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setParentSpanId(SPAN_ID)
reporter.setInitialDisplay(true)

assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID))
}

@Test
fun `when display flag and parentSpanId changes the next full display render is saved`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setFullDisplay(true)
reporter.setParentSpanId(SPAN_ID)
RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID)

reporter.setFullDisplay(false)
reporter.setFullDisplay(true)
reporter.setParentSpanId(NEW_SPAN_ID)
assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + NEW_SPAN_ID))
}

@Test
fun `when display flag and parentSpanId changes the next initial display render is saved`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setInitialDisplay(true)
reporter.setParentSpanId(SPAN_ID)
RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID)

reporter.setInitialDisplay(false)
reporter.setInitialDisplay(true)
reporter.setParentSpanId(NEW_SPAN_ID)
assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + NEW_SPAN_ID))
}

@Test
fun `when parentSpanId doesn't change the next full display render is not saved`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setFullDisplay(true)
reporter.setParentSpanId(SPAN_ID)
RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID)

reporter.setFullDisplay(false)
reporter.setFullDisplay(true)
reporter.setParentSpanId(SPAN_ID)
assertNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID))
}

@Test
fun `when parentSpanId doesn't change the next initial display render is not saved`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setInitialDisplay(true)
reporter.setParentSpanId(SPAN_ID)
RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID)

reporter.setInitialDisplay(false)
reporter.setInitialDisplay(true)
reporter.setParentSpanId(SPAN_ID)
assertNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID))
}

@Test
fun `when display flag doesn't change the next full display render is not saved`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setFullDisplay(true)
reporter.setParentSpanId(SPAN_ID)
RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID)

reporter.setFullDisplay(true)
assertNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID))
}

@Test
fun `when display flag doesn't change the next initial display render is not saved`() {
val reporter = createTestRNSentryOnDrawReporterView()
reporter.setInitialDisplay(true)
reporter.setParentSpanId(SPAN_ID)
RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID)

reporter.setInitialDisplay(true)
assertNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID))
}

class TestRNSentryOnDrawReporterView(
context: Context,
reactContext: ReactApplicationContext,
buildInfo: BuildInfoProvider,
) : RNSentryOnDrawReporterManager.RNSentryOnDrawReporterView(context, reactContext, buildInfo) {
override fun registerForNextDraw(
activity: Activity,
callback: Runnable,
buildInfo: BuildInfoProvider,
) {
callback.run()
}
}

private fun createTestRNSentryOnDrawReporterView(): TestRNSentryOnDrawReporterView =
TestRNSentryOnDrawReporterView(ApplicationProvider.getApplicationContext(), mockReactContext(), mockBuildInfo())

private fun mockReactContext(): ReactApplicationContext {
val reactContext = mock<ReactApplicationContext>()
whenever(reactContext.getCurrentActivity()).thenReturn(mock<Activity>())
return reactContext
}

private fun mockBuildInfo(): BuildInfoProvider = mock()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.sentry.react

import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class RNSentryTimeToDisplayTest {
companion object {
val TEST_ID = "test-id"
val TEST_VAL = 123.4
}

@Before
fun setUp() {
}

@Test
fun `puts and pops record`() {
RNSentryTimeToDisplay.putTimeToDisplayFor(TEST_ID, TEST_VAL)

val firstPop = RNSentryTimeToDisplay.popTimeToDisplayFor(TEST_ID)
val secondPop = RNSentryTimeToDisplay.popTimeToDisplayFor(TEST_ID)

assertEquals(firstPop, TEST_VAL, 0.0)
assertNull(secondPop)
}

@Test
fun `removes oldes entry when full`() {
val maxSize = RNSentryTimeToDisplay.ENTRIES_MAX_SIZE + 1
for (i in 1..maxSize) {
RNSentryTimeToDisplay.putTimeToDisplayFor("$TEST_ID-$i", i.toDouble())
}

val oldestEntry = RNSentryTimeToDisplay.popTimeToDisplayFor("$TEST_ID-1")
val secondOldestEntry = RNSentryTimeToDisplay.popTimeToDisplayFor("$TEST_ID-2")
val newestEntry = RNSentryTimeToDisplay.popTimeToDisplayFor("$TEST_ID-$maxSize")

assertNull(oldestEntry)
assertNotNull(secondOldestEntry)
assertNotNull(newestEntry)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
3339C4812D6625570088EB3A /* RNSentryUserTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3339C4802D6625570088EB3A /* RNSentryUserTests.mm */; };
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */; };
3380C6C42CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3380C6C32CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift */; };
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */; };
33AFDFED2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AFDFEC2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m */; };
33AFDFF12B8D15E500AAB120 /* RNSentryDependencyContainerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */; };
33DEDFEA2D8DBE67006066E4 /* RNSentryOnDrawReporterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFE92D8DBE5B006066E4 /* RNSentryOnDrawReporterTests.swift */; };
33DEDFED2D8DC825006066E4 /* RNSentryOnDrawReporter+Test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFEC2D8DC820006066E4 /* RNSentryOnDrawReporter+Test.mm */; };
33DEDFF02D9185EB006066E4 /* RNSentryTimeToDisplayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFEF2D9185E3006066E4 /* RNSentryTimeToDisplayTests.swift */; };
33F58AD02977037D008F60EA /* RNSentryTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 33F58ACF2977037D008F60EA /* RNSentryTests.mm */; };
AEFB00422CC90C4B00EC8A9A /* RNSentryBreadcrumbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */; };
B5859A50A3E865EF5E61465A /* libPods-RNSentryCocoaTesterTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 650CB718ACFBD05609BF2126 /* libPods-RNSentryCocoaTesterTests.a */; };
Expand All @@ -37,12 +39,16 @@
3380C6C32CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryReplayPostInitTests.swift; sourceTree = "<group>"; };
338739072A7D7D2800950DDD /* RNSentryReplay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryReplay.h; path = ../ios/RNSentryReplay.h; sourceTree = "<group>"; };
33958C672BFCEF5A00AD1FB6 /* RNSentryOnDrawReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryOnDrawReporter.h; path = ../ios/RNSentryOnDrawReporter.h; sourceTree = "<group>"; };
33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryOnDrawReporterTests.m; sourceTree = "<group>"; };
33AFDFEC2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryFramesTrackerListenerTests.m; sourceTree = "<group>"; };
33AFDFEE2B8D14C200AAB120 /* RNSentryFramesTrackerListenerTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentryFramesTrackerListenerTests.h; sourceTree = "<group>"; };
33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryDependencyContainerTests.m; sourceTree = "<group>"; };
33AFDFF22B8D15F600AAB120 /* RNSentryDependencyContainerTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentryDependencyContainerTests.h; sourceTree = "<group>"; };
33AFE0132B8F31AF00AAB120 /* RNSentryDependencyContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryDependencyContainer.h; path = ../ios/RNSentryDependencyContainer.h; sourceTree = "<group>"; };
33DEDFE92D8DBE5B006066E4 /* RNSentryOnDrawReporterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryOnDrawReporterTests.swift; sourceTree = "<group>"; };
33DEDFEB2D8DC800006066E4 /* RNSentryOnDrawReporter+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNSentryOnDrawReporter+Test.h"; sourceTree = "<group>"; };
33DEDFEC2D8DC820006066E4 /* RNSentryOnDrawReporter+Test.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "RNSentryOnDrawReporter+Test.mm"; sourceTree = "<group>"; };
33DEDFEE2D8DD431006066E4 /* RNSentryTimeToDisplay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryTimeToDisplay.h; path = ../ios/RNSentryTimeToDisplay.h; sourceTree = SOURCE_ROOT; };
33DEDFEF2D9185E3006066E4 /* RNSentryTimeToDisplayTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryTimeToDisplayTests.swift; sourceTree = "<group>"; };
33F58ACF2977037D008F60EA /* RNSentryTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RNSentryTests.mm; sourceTree = "<group>"; };
650CB718ACFBD05609BF2126 /* libPods-RNSentryCocoaTesterTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNSentryCocoaTesterTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E2321E7CFA55AB617247098E /* Pods-RNSentryCocoaTesterTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.debug.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -91,6 +97,10 @@
3360899029524164007C7730 /* RNSentryCocoaTesterTests */ = {
isa = PBXGroup;
children = (
33DEDFEF2D9185E3006066E4 /* RNSentryTimeToDisplayTests.swift */,
33DEDFEC2D8DC820006066E4 /* RNSentryOnDrawReporter+Test.mm */,
33DEDFEB2D8DC800006066E4 /* RNSentryOnDrawReporter+Test.h */,
33DEDFE92D8DBE5B006066E4 /* RNSentryOnDrawReporterTests.swift */,
3339C47F2D6625260088EB3A /* RNSentry+Test.h */,
332D334A2CDCC8EB00547D76 /* RNSentryCocoaTesterTests-Bridging-Header.h */,
332D33492CDCC8E100547D76 /* RNSentryTests.h */,
Expand All @@ -101,7 +111,6 @@
33AFDFEE2B8D14C200AAB120 /* RNSentryFramesTrackerListenerTests.h */,
33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */,
33AFDFF22B8D15F600AAB120 /* RNSentryDependencyContainerTests.h */,
33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */,
3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */,
332D33462CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift */,
3380C6C32CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift */,
Expand All @@ -121,6 +130,7 @@
33AFE0122B8F319000AAB120 /* RNSentry */ = {
isa = PBXGroup;
children = (
33DEDFEE2D8DD431006066E4 /* RNSentryTimeToDisplay.h */,
3380C6C02CDEC56B0018B9B6 /* Replay */,
332D33482CDBDC7300547D76 /* RNSentry.h */,
3360843A2C32E3A8008CC412 /* RNSentryReplayBreadcrumbConverter.h */,
Expand Down Expand Up @@ -244,11 +254,13 @@
files = (
AEFB00422CC90C4B00EC8A9A /* RNSentryBreadcrumbTests.swift in Sources */,
332D33472CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift in Sources */,
33DEDFEA2D8DBE67006066E4 /* RNSentryOnDrawReporterTests.swift in Sources */,
33AFDFF12B8D15E500AAB120 /* RNSentryDependencyContainerTests.m in Sources */,
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */,
33DEDFED2D8DC825006066E4 /* RNSentryOnDrawReporter+Test.mm in Sources */,
33F58AD02977037D008F60EA /* RNSentryTests.mm in Sources */,
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */,
3339C4812D6625570088EB3A /* RNSentryUserTests.mm in Sources */,
33DEDFF02D9185EB006066E4 /* RNSentryTimeToDisplayTests.swift in Sources */,
3380C6C42CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift in Sources */,
33AFDFED2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m in Sources */,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
//

#import "RNSentryBreadcrumb.h"
#import "RNSentryOnDrawReporter+Test.h"
#import "RNSentryReplay.h"
#import "RNSentryReplayBreadcrumbConverter.h"
#import "RNSentryReplayMask.h"
#import "RNSentryReplayUnmask.h"
#import "RNSentryTimeToDisplay.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#import "RNSentryOnDrawReporter.h"
#import <Foundation/Foundation.h>

@interface
RNSentryOnDrawReporterView (Testing)

+ (instancetype)createWithMockedListener;
- (RNSentryEmitNewFrameEvent)createEmitNewFrameEvent;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#import "RNSentryOnDrawReporter+Test.h"

@interface MockedListener : NSObject <RNSentryFramesTrackerListenerProtocol>
@property (strong, nonatomic) RNSentryEmitNewFrameEvent emitNewFrameEvent;
- (instancetype)initWithMockedListener:(RNSentryEmitNewFrameEvent)emitNewFrameEvent;
@end

@implementation MockedListener

- (instancetype)initWithMockedListener:(RNSentryEmitNewFrameEvent)emitNewFrameEvent
{
self = [super init];
if (self) {
_emitNewFrameEvent = [emitNewFrameEvent copy];
}
return self;
}

- (void)startListening
{
self.emitNewFrameEvent(@([[NSDate date] timeIntervalSince1970]));
}

- (void)framesTrackerHasNewFrame:(nonnull NSDate *)newFrameDate
{
NSLog(@"Not implemented in the test mock");
}

@end

@implementation
RNSentryOnDrawReporterView (Testing)

+ (instancetype)createWithMockedListener
{
return [[self alloc] initWithMockedListener];
}

- (instancetype)initWithMockedListener
{
self = [super init];
if (self) {
self.framesListener =
[[MockedListener alloc] initWithMockedListener:[self createEmitNewFrameEvent]];
}
return self;
}

@end

This file was deleted.

Loading
Loading