FIRCLSMockMXDiagnosticPayload.m 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "Crashlytics/UnitTests/Mocks/FIRCLSMockMXDiagnosticPayload.h"
  15. #if CLS_METRICKIT_SUPPORTED
  16. @interface FIRCLSMockMXDiagnosticPayload ()
  17. @property(readwrite, strong, nullable) NSArray<MXCPUExceptionDiagnostic *> *cpuExceptionDiagnostics;
  18. @property(readwrite, strong, nullable)
  19. NSArray<MXDiskWriteExceptionDiagnostic *> *diskWriteExceptionDiagnostics;
  20. @property(readwrite, strong, nullable) NSArray<MXHangDiagnostic *> *hangDiagnostics;
  21. @property(readwrite, strong, nullable) NSArray<MXCrashDiagnostic *> *crashDiagnostics;
  22. @property(readwrite, strong, nonnull) NSDate *timeStampBegin;
  23. @property(readwrite, strong, nonnull) NSDate *timeStampEnd;
  24. @end
  25. @implementation FIRCLSMockMXDiagnosticPayload
  26. @synthesize cpuExceptionDiagnostics = _cpuExceptionDiagnostics;
  27. @synthesize diskWriteExceptionDiagnostics = _diskWriteExceptionDiagnostics;
  28. @synthesize hangDiagnostics = _hangDiagnostics;
  29. @synthesize crashDiagnostics = _crashDiagnostics;
  30. @synthesize timeStampEnd = _timeStampEnd;
  31. @synthesize timeStampBegin = _timeStampBegin;
  32. - (instancetype)initWithDiagnostics:(NSDictionary *)diagnostics
  33. timeStampBegin:(NSDate *)timeStampBegin
  34. timeStampEnd:(NSDate *)timeStampEnd
  35. applicationVersion:(NSString *)applicationVersion {
  36. self = [super init];
  37. _timeStampBegin = timeStampBegin;
  38. _timeStampEnd = timeStampEnd;
  39. _crashDiagnostics = [diagnostics objectForKey:@"crashes"];
  40. _hangDiagnostics = [diagnostics objectForKey:@"hangs"];
  41. _cpuExceptionDiagnostics = [diagnostics objectForKey:@"cpuExceptionDiagnostics"];
  42. _diskWriteExceptionDiagnostics = [diagnostics objectForKey:@"diskWriteExceptionDiagnostics"];
  43. return self;
  44. }
  45. @end
  46. #endif