@@ -898,6 +898,52 @@ void main() {
898
898
expect ((capturedEvent.breadcrumbs ?? []).isEmpty, true );
899
899
});
900
900
901
+ test ('Clears breadcrumbs on Android if mechanism.handled is null' ,
902
+ () async {
903
+ fixture.options.enableScopeSync = true ;
904
+ fixture.options.platformChecker =
905
+ MockPlatformChecker (platform: MockPlatform .android ());
906
+
907
+ final client = fixture.getSut ();
908
+ final event = SentryEvent (exceptions: [
909
+ SentryException (
910
+ type: "type" ,
911
+ value: "value" ,
912
+ mechanism: Mechanism (type: 'type' ),
913
+ )
914
+ ], breadcrumbs: [
915
+ Breadcrumb ()
916
+ ]);
917
+ await client.captureEvent (event);
918
+
919
+ final capturedEnvelope = (fixture.transport).envelopes.first;
920
+ final capturedEvent = await eventFromEnvelope (capturedEnvelope);
921
+
922
+ expect ((capturedEvent.breadcrumbs ?? []).isEmpty, true );
923
+ });
924
+
925
+ test ('Clears breadcrumbs on Android if theres no mechanism' , () async {
926
+ fixture.options.enableScopeSync = true ;
927
+ fixture.options.platformChecker =
928
+ MockPlatformChecker (platform: MockPlatform .android ());
929
+
930
+ final client = fixture.getSut ();
931
+ final event = SentryEvent (exceptions: [
932
+ SentryException (
933
+ type: "type" ,
934
+ value: "value" ,
935
+ )
936
+ ], breadcrumbs: [
937
+ Breadcrumb ()
938
+ ]);
939
+ await client.captureEvent (event);
940
+
941
+ final capturedEnvelope = (fixture.transport).envelopes.first;
942
+ final capturedEvent = await eventFromEnvelope (capturedEnvelope);
943
+
944
+ expect ((capturedEvent.breadcrumbs ?? []).isEmpty, true );
945
+ });
946
+
901
947
test ('Does not clear breadcrumbs on Android if mechanism.handled is false' ,
902
948
() async {
903
949
fixture.options.enableScopeSync = true ;
@@ -924,6 +970,42 @@ void main() {
924
970
925
971
expect ((capturedEvent.breadcrumbs ?? []).isNotEmpty, true );
926
972
});
973
+
974
+ test (
975
+ 'Does not clear breadcrumbs on Android if any mechanism.handled is false' ,
976
+ () async {
977
+ fixture.options.enableScopeSync = true ;
978
+ fixture.options.platformChecker =
979
+ MockPlatformChecker (platform: MockPlatform .android ());
980
+
981
+ final client = fixture.getSut ();
982
+ final event = SentryEvent (exceptions: [
983
+ SentryException (
984
+ type: "type" ,
985
+ value: "value" ,
986
+ mechanism: Mechanism (
987
+ type: 'type' ,
988
+ handled: true ,
989
+ ),
990
+ ),
991
+ SentryException (
992
+ type: "type" ,
993
+ value: "value" ,
994
+ mechanism: Mechanism (
995
+ type: 'type' ,
996
+ handled: false ,
997
+ ),
998
+ )
999
+ ], breadcrumbs: [
1000
+ Breadcrumb ()
1001
+ ]);
1002
+ await client.captureEvent (event);
1003
+
1004
+ final capturedEnvelope = (fixture.transport).envelopes.first;
1005
+ final capturedEvent = await eventFromEnvelope (capturedEnvelope);
1006
+
1007
+ expect ((capturedEvent.breadcrumbs ?? []).isNotEmpty, true );
1008
+ });
927
1009
});
928
1010
929
1011
group ('ClientReportRecorder' , () {
@@ -1118,7 +1200,8 @@ class Fixture {
1118
1200
final recorder = MockClientReportRecorder ();
1119
1201
final transport = MockTransport ();
1120
1202
1121
- final options = SentryOptions (dsn: fakeDsn);
1203
+ final options = SentryOptions (dsn: fakeDsn)
1204
+ ..platformChecker = MockPlatformChecker (platform: MockPlatform .iOS ());
1122
1205
1123
1206
late SentryTransactionContext _context;
1124
1207
late SentryTracer tracer;
0 commit comments