Skip to content

Commit 54e7da2

Browse files
committed
RUM-10363: Apply suggested changes
1 parent 30a3c26 commit 54e7da2

File tree

8 files changed

+32
-39
lines changed

8 files changed

+32
-39
lines changed

dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/DatadogCoreTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import com.datadog.android.core.internal.privacy.ConsentProvider
2828
import com.datadog.android.core.internal.system.BuildSdkVersionProvider
2929
import com.datadog.android.core.internal.user.MutableUserInfoProvider
3030
import com.datadog.android.core.thread.FlushableExecutorService
31+
import com.datadog.android.internal.tests.stub.StubTimeProvider
3132
import com.datadog.android.internal.time.TimeProvider
3233
import com.datadog.android.ndk.internal.NdkCrashHandler
3334
import com.datadog.android.privacy.TrackingConsent
@@ -39,7 +40,6 @@ import com.datadog.tools.unit.extensions.TestConfigurationExtension
3940
import com.datadog.tools.unit.extensions.config.TestConfiguration
4041
import com.datadog.tools.unit.forge.aThrowable
4142
import com.datadog.tools.unit.forge.exhaustiveAttributes
42-
import com.datadog.android.internal.tests.stub.StubTimeProvider
4343
import com.google.gson.JsonObject
4444
import fr.xgouchet.elmyr.Forge
4545
import fr.xgouchet.elmyr.annotation.AdvancedForgery

dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/internal/persistence/file/batch/BatchFileOrchestratorTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import com.datadog.android.core.internal.metrics.MetricsDispatcher
1212
import com.datadog.android.core.internal.metrics.RemovalReason
1313
import com.datadog.android.core.internal.persistence.file.FileOrchestrator
1414
import com.datadog.android.core.internal.persistence.file.FilePersistenceConfig
15+
import com.datadog.android.internal.tests.stub.StubTimeProvider
1516
import com.datadog.android.utils.forge.Configurator
1617
import com.datadog.android.utils.verifyLog
17-
import com.datadog.android.internal.tests.stub.StubTimeProvider
1818
import fr.xgouchet.elmyr.Forge
1919
import fr.xgouchet.elmyr.annotation.IntForgery
2020
import fr.xgouchet.elmyr.annotation.LongForgery

dd-sdk-android-core/src/test/kotlin/com/datadog/android/error/internal/DatadogExceptionHandlerTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.datadog.android.core.internal.CoreFeature
2121
import com.datadog.android.core.internal.thread.waitToIdle
2222
import com.datadog.android.core.internal.utils.TAG_DATADOG_UPLOAD
2323
import com.datadog.android.core.internal.utils.UPLOAD_WORKER_NAME
24+
import com.datadog.android.internal.tests.stub.StubTimeProvider
2425
import com.datadog.android.internal.time.TimeProvider
2526
import com.datadog.android.internal.utils.loggableStackTrace
2627
import com.datadog.android.utils.config.ApplicationContextTestConfiguration
@@ -30,7 +31,6 @@ import com.datadog.tools.unit.annotations.TestConfigurationsProvider
3031
import com.datadog.tools.unit.extensions.TestConfigurationExtension
3132
import com.datadog.tools.unit.extensions.config.TestConfiguration
3233
import com.datadog.tools.unit.setStaticValue
33-
import com.datadog.android.internal.tests.stub.StubTimeProvider
3434
import fr.xgouchet.elmyr.Forge
3535
import fr.xgouchet.elmyr.annotation.Forgery
3636
import fr.xgouchet.elmyr.annotation.LongForgery

features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumContinuousActionScopeTest.kt

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ internal class RumContinuousActionScopeTest {
305305
val expectedAttributes = mutableMapOf<String, Any?>()
306306
expectedAttributes.putAll(fakeAttributes)
307307
expectedAttributes.putAll(attributes)
308-
val stopActionTime = TEST_INACTIVITY_MS * 2
308+
val stopActionDelay = TEST_INACTIVITY_MS * 2
309309

310310
// When
311-
fakeEvent = RumRawEvent.StopAction(type, name, attributes, timeWithOffset(stopActionTime))
311+
fakeEvent = RumRawEvent.StopAction(type, name, attributes, timeWithOffset(stopActionDelay))
312312
val result = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
313313
val result2 = testedScope.handleEvent(
314-
mockEvent(stopActionTime + TEST_INACTIVITY_MS * 2),
314+
mockEvent(stopActionDelay + TEST_INACTIVITY_MS * 2),
315315
fakeDatadogContext,
316316
mockEventWriteScope,
317317
mockWriter
@@ -382,13 +382,13 @@ internal class RumContinuousActionScopeTest {
382382
val expectedAttributes = mutableMapOf<String, Any?>()
383383
expectedAttributes.putAll(fakeAttributes)
384384
expectedAttributes.putAll(attributes)
385-
val stopActionTime = TEST_INACTIVITY_MS * 2
385+
val stopActionDelay = TEST_INACTIVITY_MS * 2
386386

387387
// When
388-
fakeEvent = RumRawEvent.StopAction(null, null, attributes, timeWithOffset(stopActionTime))
388+
fakeEvent = RumRawEvent.StopAction(null, null, attributes, timeWithOffset(stopActionDelay))
389389
val result = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
390390
val result2 = testedScope.handleEvent(
391-
mockEvent(stopActionTime + TEST_INACTIVITY_MS * 2),
391+
mockEvent(stopActionDelay + TEST_INACTIVITY_MS * 2),
392392
fakeDatadogContext,
393393
mockEventWriteScope,
394394
mockWriter
@@ -465,11 +465,11 @@ internal class RumContinuousActionScopeTest {
465465
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), fakeEventTime)
466466
val expectedStoppedTimestamp = fakeEvent.eventTime.nanoTime
467467
val result2 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
468-
val stopResourceTime = TEST_INACTIVITY_MS * 2
469-
fakeEvent = RumRawEvent.StopResource(key, statusCode, size, kind, emptyMap(), timeWithOffset(stopResourceTime))
468+
val stopResourceDelay = TEST_INACTIVITY_MS * 2
469+
fakeEvent = RumRawEvent.StopResource(key, statusCode, size, kind, emptyMap(), timeWithOffset(stopResourceDelay))
470470
val result3 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
471471
val result4 = testedScope.handleEvent(
472-
mockEvent(stopResourceTime + TEST_INACTIVITY_MS * 2 + 1),
472+
mockEvent(stopResourceDelay + TEST_INACTIVITY_MS * 2 + 1),
473473
fakeDatadogContext,
474474
mockEventWriteScope,
475475
mockWriter
@@ -548,19 +548,19 @@ internal class RumContinuousActionScopeTest {
548548
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), fakeEventTime)
549549
val expectedStoppedTimestamp = fakeEvent.eventTime.nanoTime
550550
val result2 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
551-
val stopResourceTime = TEST_INACTIVITY_MS * 2
551+
val stopResourceDelay = TEST_INACTIVITY_MS * 2
552552
fakeEvent = RumRawEvent.StopResourceWithError(
553553
key,
554554
statusCode,
555555
message,
556556
source,
557557
throwable,
558558
emptyMap(),
559-
timeWithOffset(stopResourceTime)
559+
timeWithOffset(stopResourceDelay)
560560
)
561561
val result3 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
562562
val result4 = testedScope.handleEvent(
563-
mockEvent(stopResourceTime + TEST_INACTIVITY_MS * 2),
563+
mockEvent(stopResourceDelay + TEST_INACTIVITY_MS * 2),
564564
fakeDatadogContext,
565565
mockEventWriteScope,
566566
mockWriter
@@ -652,7 +652,7 @@ internal class RumContinuousActionScopeTest {
652652
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), fakeEventTime)
653653
val expectedStoppedTimestamp = fakeEvent.eventTime.nanoTime
654654
val result2 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
655-
val stopResourceTime = TEST_INACTIVITY_MS * 2
655+
val stopResourceDelay = TEST_INACTIVITY_MS * 2
656656
fakeEvent = RumRawEvent.StopResourceWithStackTrace(
657657
key,
658658
statusCode,
@@ -661,11 +661,11 @@ internal class RumContinuousActionScopeTest {
661661
stackTrace,
662662
errorType,
663663
emptyMap(),
664-
timeWithOffset(stopResourceTime)
664+
timeWithOffset(stopResourceDelay)
665665
)
666666
val result3 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
667667
val result4 = testedScope.handleEvent(
668-
mockEvent(stopResourceTime + TEST_INACTIVITY_MS * 2),
668+
mockEvent(stopResourceDelay + TEST_INACTIVITY_MS * 2),
669669
fakeDatadogContext,
670670
mockEventWriteScope,
671671
mockWriter
@@ -749,12 +749,12 @@ internal class RumContinuousActionScopeTest {
749749
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), fakeEventTime)
750750
val expectedStoppedTimestamp = fakeEvent.eventTime.nanoTime
751751
val result2 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
752-
val gcTime = TEST_INACTIVITY_MS * 2
753-
fakeEvent = mockEvent(gcTime)
752+
val gcDelay = TEST_INACTIVITY_MS * 2
753+
fakeEvent = mockEvent(gcDelay)
754754
@Suppress("UNUSED_VALUE")
755755
key = null
756756
System.gc()
757-
val result3 = testedScope.handleEvent(mockEvent(gcTime), fakeDatadogContext, mockEventWriteScope, mockWriter)
757+
val result3 = testedScope.handleEvent(mockEvent(gcDelay), fakeDatadogContext, mockEventWriteScope, mockWriter)
758758

759759
// Then
760760
argumentCaptor<ActionEvent> {
@@ -828,12 +828,12 @@ internal class RumContinuousActionScopeTest {
828828
attributes = emptyMap()
829829
)
830830
val result = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
831-
val stopActionTime = TEST_INACTIVITY_MS * 2
832-
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), timeWithOffset(stopActionTime))
831+
val stopActionDelay = TEST_INACTIVITY_MS * 2
832+
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), timeWithOffset(stopActionDelay))
833833
val expectedStoppedTimestamp = fakeEvent.eventTime.nanoTime
834834
val result2 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
835835
val result3 = testedScope.handleEvent(
836-
mockEvent(stopActionTime + TEST_INACTIVITY_MS * 2),
836+
mockEvent(stopActionDelay + TEST_INACTIVITY_MS * 2),
837837
fakeDatadogContext,
838838
mockEventWriteScope,
839839
mockWriter
@@ -2740,11 +2740,11 @@ internal class RumContinuousActionScopeTest {
27402740
// When
27412741
fakeEvent = RumRawEvent.StartResource(key, url, method, emptyMap())
27422742
val result = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
2743-
val stopActionTime = TEST_INACTIVITY_MS * 2
2744-
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), timeWithOffset(stopActionTime))
2743+
val stopActionDelay = TEST_INACTIVITY_MS * 2
2744+
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), timeWithOffset(stopActionDelay))
27452745
val result2 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
27462746
val result3 = testedScope.handleEvent(
2747-
mockEvent(stopActionTime + TEST_INACTIVITY_MS * 2),
2747+
mockEvent(stopActionDelay + TEST_INACTIVITY_MS * 2),
27482748
fakeDatadogContext,
27492749
mockEventWriteScope,
27502750
mockWriter
@@ -2833,11 +2833,11 @@ internal class RumContinuousActionScopeTest {
28332833
// When
28342834
fakeEvent = RumRawEvent.StartResource(key, url, method, emptyMap())
28352835
val result = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
2836-
val stopActionTime = TEST_INACTIVITY_MS * 2
2837-
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), timeWithOffset(stopActionTime))
2836+
val stopActionDelay = TEST_INACTIVITY_MS * 2
2837+
fakeEvent = RumRawEvent.StopAction(fakeType, fakeName, emptyMap(), timeWithOffset(stopActionDelay))
28382838
val result2 = testedScope.handleEvent(fakeEvent, fakeDatadogContext, mockEventWriteScope, mockWriter)
28392839
val result3 = testedScope.handleEvent(
2840-
mockEvent(stopActionTime + TEST_MAX_DURATION_MS),
2840+
mockEvent(stopActionDelay + TEST_MAX_DURATION_MS),
28412841
fakeDatadogContext,
28422842
mockEventWriteScope,
28432843
mockWriter

features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScopeTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import com.datadog.android.api.storage.EventType
1818
import com.datadog.android.api.storage.NoOpDataWriter
1919
import com.datadog.android.core.InternalSdkCore
2020
import com.datadog.android.core.internal.net.FirstPartyHostHeaderTypeResolver
21-
import com.datadog.android.internal.time.TimeProvider
21+
import com.datadog.android.internal.tests.stub.StubTimeProvider
2222
import com.datadog.android.rum.RumSessionListener
2323
import com.datadog.android.rum.RumSessionType
2424
import com.datadog.android.rum.internal.domain.InfoProvider
@@ -40,7 +40,6 @@ import com.datadog.android.rum.metric.networksettled.InitialResourceIdentifier
4040
import com.datadog.android.rum.model.RumVitalAppLaunchEvent
4141
import com.datadog.android.rum.model.ViewEvent
4242
import com.datadog.android.rum.utils.forge.Configurator
43-
import com.datadog.android.internal.tests.stub.StubTimeProvider
4443
import com.datadog.tools.unit.forge.exhaustiveAttributes
4544
import fr.xgouchet.elmyr.Forge
4645
import fr.xgouchet.elmyr.annotation.BoolForgery

features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/instrumentation/MainLooperLongTaskStrategyTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package com.datadog.android.rum.internal.instrumentation
88

99
import android.os.Looper
10+
import com.datadog.android.internal.tests.stub.StubTimeProvider
1011
import com.datadog.android.rum.internal.monitor.AdvancedRumMonitor
1112
import com.datadog.android.rum.utils.config.GlobalRumMonitorTestConfiguration
1213
import com.datadog.android.rum.utils.forge.Configurator
@@ -16,7 +17,6 @@ import com.datadog.tools.unit.extensions.TestConfigurationExtension
1617
import com.datadog.tools.unit.extensions.config.TestConfiguration
1718
import com.datadog.tools.unit.getStaticValue
1819
import com.datadog.tools.unit.setStaticValue
19-
import com.datadog.android.internal.tests.stub.StubTimeProvider
2020
import fr.xgouchet.elmyr.Forge
2121
import fr.xgouchet.elmyr.annotation.IntForgery
2222
import fr.xgouchet.elmyr.annotation.LongForgery

reliability/stub-core/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ dependencies {
4444
implementation(libs.bundles.testTools)
4545
implementation(libs.okHttp)
4646
implementation(libs.gson)
47-
48-
implementation(testFixtures(project(":dd-sdk-android-internal")))
4947
}
5048

5149
androidLibraryConfig()

reliability/stub-core/src/main/kotlin/com/datadog/android/core/stub/StubSDKCore.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import com.datadog.android.api.feature.Feature
2020
import com.datadog.android.api.feature.FeatureScope
2121
import com.datadog.android.core.InternalSdkCore
2222
import com.datadog.android.core.internal.net.FirstPartyHostHeaderTypeResolver
23-
import com.datadog.android.internal.time.TimeProvider
24-
import com.datadog.android.internal.tests.stub.StubTimeProvider
2523
import fr.xgouchet.elmyr.Forge
2624
import org.mockito.Mockito.mock
2725
import org.mockito.kotlin.doReturn
@@ -161,8 +159,6 @@ class StubSDKCore(
161159

162160
override val internalLogger: InternalLogger = StubInternalLogger()
163161

164-
override val timeProvider: TimeProvider = StubTimeProvider()
165-
166162
override fun registerFeature(feature: Feature) {
167163
stubFeatureScope(feature, StubFeatureScope(feature, { datadogContext }))
168164
}

0 commit comments

Comments
 (0)