FIRCLSMockReportManager.m 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright 2019 Google
  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/FIRCLSMockReportManager.h"
  15. #import "Crashlytics/Crashlytics/Components/FIRCLSContext.h"
  16. #import "Crashlytics/UnitTests/Mocks/FIRCLSMockReportUploader.h"
  17. #import "FirebaseInstallations/Source/Library/Private/FirebaseInstallationsInternal.h"
  18. @interface FIRCLSMockReportManager () {
  19. FIRCLSMockReportUploader *_uploader;
  20. }
  21. @end
  22. @implementation FIRCLSMockReportManager
  23. // these have to be synthesized, to override the pre-existing method
  24. @synthesize bundleIdentifier;
  25. - (instancetype)initWithFileManager:(FIRCLSFileManager *)fileManager
  26. installations:(FIRInstallations *)installations
  27. analytics:(id<FIRAnalyticsInterop>)analytics
  28. googleAppID:(NSString *)googleAppID
  29. dataArbiter:(FIRCLSDataCollectionArbiter *)dataArbiter
  30. googleTransport:(GDTCORTransport *)googleTransport
  31. appIDModel:(FIRCLSApplicationIdentifierModel *)appIDModel
  32. settings:(FIRCLSSettings *)settings {
  33. self = [super initWithFileManager:fileManager
  34. installations:installations
  35. analytics:analytics
  36. googleAppID:googleAppID
  37. dataArbiter:dataArbiter
  38. googleTransport:googleTransport
  39. appIDModel:appIDModel
  40. settings:settings];
  41. if (!self) {
  42. return nil;
  43. }
  44. _uploader = [[FIRCLSMockReportUploader alloc] initWithQueue:self.operationQueue
  45. dataSource:self
  46. fileManager:fileManager
  47. analytics:analytics];
  48. return self;
  49. }
  50. - (FIRCLSReportUploader *)uploader {
  51. return _uploader;
  52. }
  53. - (BOOL)startCrashReporterWithProfilingMark:(FIRCLSProfileMark)mark
  54. report:(FIRCLSInternalReport *)report {
  55. NSLog(@"Crash Reporting system disabled for testing");
  56. return YES;
  57. }
  58. - (BOOL)installCrashReportingHandlers:(FIRCLSContextInitData *)initData {
  59. return YES;
  60. // This actually installs crash handlers, there is no need to do that during testing.
  61. }
  62. - (void)crashReportingSetupCompleted {
  63. // This stuff does operations on the main thread, which we don't want during tests.
  64. }
  65. @end