@@ -5,76 +5,89 @@ import 'package:sentry/sentry.dart';
5
5
import 'package:sentry/src/load_dart_debug_images_integration.dart' ;
6
6
import 'package:test/test.dart' ;
7
7
8
+ import 'mocks/mock_platform.dart' ;
9
+ import 'mocks/mock_platform_checker.dart' ;
10
+
8
11
void main () {
9
12
group (LoadDartDebugImagesIntegration (), () {
10
13
late Fixture fixture;
11
14
12
- setUp (() {
13
- fixture = Fixture ();
14
- });
15
-
16
- test ('adds itself to sdk.integrations' , () {
17
- expect (
18
- fixture.options.sdk.integrations.contains ('loadDartImageIntegration' ),
19
- true ,
20
- );
21
- });
22
-
23
- test ('Event processor is added to options' , () {
24
- expect (fixture.options.eventProcessors.length, 1 );
25
- expect (
26
- fixture.options.eventProcessors.first.runtimeType.toString (),
27
- '_LoadImageIntegrationEventProcessor' ,
28
- );
29
- });
30
-
31
- test (
32
- 'Event processor does not add debug image if symbolication is not needed' ,
33
- () async {
34
- final event = _getEvent (needsSymbolication: false );
35
- final processor = fixture.options.eventProcessors.first;
36
- final resultEvent = await processor.apply (event, Hint ());
37
-
38
- expect (resultEvent, equals (event));
39
- });
40
-
41
- test ('Event processor does not add debug image if stackTrace is null' ,
42
- () async {
43
- final event = _getEvent ();
44
- final processor = fixture.options.eventProcessors.first;
45
- final resultEvent = await processor.apply (event, Hint ());
46
-
47
- expect (resultEvent, equals (event));
48
- });
49
-
50
- test (
51
- 'Event processor does not add debug image if enableDartSymbolication is false' ,
52
- () async {
53
- fixture.options.enableDartSymbolication = false ;
54
- final event = _getEvent ();
55
- final processor = fixture.options.eventProcessors.first;
56
- final resultEvent = await processor.apply (event, Hint ());
57
-
58
- expect (resultEvent, equals (event));
59
- });
60
-
61
- test ('Event processor adds debug image when symbolication is needed' ,
62
- () async {
63
- final stackTrace = '''
15
+ final platforms = [
16
+ MockPlatform .iOS (),
17
+ MockPlatform .macOS (),
18
+ MockPlatform .android (),
19
+ ];
20
+
21
+ for (final platform in platforms) {
22
+ setUp (() {
23
+ fixture = Fixture ();
24
+ fixture.options.platformChecker =
25
+ MockPlatformChecker (platform: platform);
26
+ });
27
+
28
+ test ('adds itself to sdk.integrations' , () {
29
+ expect (
30
+ fixture.options.sdk.integrations.contains ('loadDartImageIntegration' ),
31
+ true ,
32
+ );
33
+ });
34
+
35
+ test ('Event processor is added to options' , () {
36
+ expect (fixture.options.eventProcessors.length, 1 );
37
+ expect (
38
+ fixture.options.eventProcessors.first.runtimeType.toString (),
39
+ '_LoadImageIntegrationEventProcessor' ,
40
+ );
41
+ });
42
+
43
+ test (
44
+ 'Event processor does not add debug image if symbolication is not needed' ,
45
+ () async {
46
+ final event = _getEvent (needsSymbolication: false );
47
+ final processor = fixture.options.eventProcessors.first;
48
+ final resultEvent = await processor.apply (event, Hint ());
49
+
50
+ expect (resultEvent, equals (event));
51
+ });
52
+
53
+ test ('Event processor does not add debug image if stackTrace is null' ,
54
+ () async {
55
+ final event = _getEvent ();
56
+ final processor = fixture.options.eventProcessors.first;
57
+ final resultEvent = await processor.apply (event, Hint ());
58
+
59
+ expect (resultEvent, equals (event));
60
+ });
61
+
62
+ test (
63
+ 'Event processor does not add debug image if enableDartSymbolication is false' ,
64
+ () async {
65
+ fixture.options.enableDartSymbolication = false ;
66
+ final event = _getEvent ();
67
+ final processor = fixture.options.eventProcessors.first;
68
+ final resultEvent = await processor.apply (event, Hint ());
69
+
70
+ expect (resultEvent, equals (event));
71
+ });
72
+
73
+ test ('Event processor adds debug image when symbolication is needed' ,
74
+ () async {
75
+ final stackTrace = '''
64
76
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
65
77
build_id: 'b680cb890f9e3c12a24b172d050dec73'
66
78
isolate_dso_base: 10000000
67
79
''' ;
68
- SentryEvent event = _getEvent ();
69
- final processor = fixture.options.eventProcessors.first;
70
- final resultEvent = await processor.apply (
71
- event, Hint ()..set (hintRawStackTraceKey, stackTrace));
72
-
73
- expect (resultEvent? .debugMeta? .images.length, 1 );
74
- final debugImage = resultEvent? .debugMeta? .images.first;
75
- expect (debugImage? .debugId, isNotEmpty);
76
- expect (debugImage? .imageAddr, equals ('0x10000000' ));
77
- });
80
+ SentryEvent event = _getEvent ();
81
+ final processor = fixture.options.eventProcessors.first;
82
+ final resultEvent = await processor.apply (
83
+ event, Hint ()..set (hintRawStackTraceKey, stackTrace));
84
+
85
+ expect (resultEvent? .debugMeta? .images.length, 1 );
86
+ final debugImage = resultEvent? .debugMeta? .images.first;
87
+ expect (debugImage? .debugId, isNotEmpty);
88
+ expect (debugImage? .imageAddr, equals ('0x10000000' ));
89
+ });
90
+ }
78
91
});
79
92
}
80
93
0 commit comments