@@ -1385,10 +1385,11 @@ class ActivityLifecycleIntegrationTest {
13851385 }
13861386
13871387 @Test
1388- fun `starts new trace if performance is disabled` () {
1388+ fun `starts new trace if performance is disabled and trace ID generation is enabled ` () {
13891389 val sut = fixture.getSut()
13901390 val activity = mock<Activity >()
13911391 fixture.options.tracesSampleRate = null
1392+ fixture.options.isEnableAutoTraceIdGeneration = true ;
13921393
13931394 val argumentCaptor: ArgumentCaptor <ScopeCallback > = ArgumentCaptor .forClass(ScopeCallback ::class .java)
13941395 val scope = Scope (fixture.options)
@@ -1405,6 +1406,28 @@ class ActivityLifecycleIntegrationTest {
14051406 assertNotSame(propagationContextAtStart, scope.propagationContext)
14061407 }
14071408
1409+ @Test
1410+ fun `does not start a new trace if performance is disabled and trace ID generation is disabled` () {
1411+ val sut = fixture.getSut()
1412+ val activity = mock<Activity >()
1413+ fixture.options.tracesSampleRate = null
1414+ fixture.options.isEnableAutoTraceIdGeneration = false ;
1415+
1416+ val argumentCaptor: ArgumentCaptor <ScopeCallback > = ArgumentCaptor .forClass(ScopeCallback ::class .java)
1417+ val scope = Scope (fixture.options)
1418+ val propagationContextAtStart = scope.propagationContext
1419+ whenever(fixture.scopes.configureScope(argumentCaptor.capture())).thenAnswer {
1420+ argumentCaptor.value.run (scope)
1421+ }
1422+
1423+ sut.register(fixture.scopes, fixture.options)
1424+ sut.onActivityCreated(activity, fixture.bundle)
1425+
1426+ // once for the screen
1427+ verify(fixture.scopes).configureScope(any())
1428+ assertSame(propagationContextAtStart, scope.propagationContext)
1429+ }
1430+
14081431 @Test
14091432 fun `sets the activity as the current screen` () {
14101433 val sut = fixture.getSut()
0 commit comments