FPRTestUtils.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2020 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 <Foundation/Foundation.h>
  15. #import "FirebasePerformance/Sources/Timer/FIRTrace+Internal.h"
  16. #import "FirebasePerformance/Sources/Timer/FIRTrace+Private.h"
  17. #import "FirebasePerformance/Sources/Loggers/FPRGDTEvent.h"
  18. #import <GoogleDataTransport/GoogleDataTransport.h>
  19. NS_ASSUME_NONNULL_BEGIN
  20. @interface FPRTestUtils : NSObject
  21. /** Default initializer. */
  22. - (instancetype)init NS_UNAVAILABLE;
  23. /** Provide the NSBundle instance that can to be used for testing. SPM tests will have a different
  24. * bundle when compared to the default unit test bundle. */
  25. + (NSBundle *)getBundle;
  26. /** Creates a Performance Trace object. */
  27. + (FIRTrace *)createRandomTraceWithName:(NSString *)name;
  28. /** Add verbose session to specific Performance Trace object. */
  29. + (FIRTrace *)addVerboseSessionToTrace:(FIRTrace *)trace;
  30. /** Creates a random Performance Metric Proto object. */
  31. + (firebase_perf_v1_PerfMetric)createRandomPerfMetric:(NSString *)traceName;
  32. /**
  33. * Creates a random Performance Metric Proto object, with verbose
  34. * session ID if it is set as verbose.
  35. */
  36. + (firebase_perf_v1_PerfMetric)createVerboseRandomPerfMetric:(NSString *)traceName;
  37. /** Creates a random internal Performance Metric Proto object. */
  38. + (firebase_perf_v1_PerfMetric)createRandomInternalPerfMetric:(NSString *)traceName;
  39. /** Creates a random network request Performance Metric Proto object. */
  40. + (firebase_perf_v1_PerfMetric)createRandomNetworkPerfMetric:(NSString *)url;
  41. /** Creates a random gauge Performance Metric Proto object. */
  42. + (firebase_perf_v1_PerfMetric)createRandomGaugePerfMetric;
  43. /** Creates a random GDTCOREvent object. */
  44. + (GDTCOREvent *)createRandomTraceGDTEvent:(NSString *)traceName;
  45. /** Creates a random GDTCOREvent object with internal trace event. */
  46. + (GDTCOREvent *)createRandomInternalTraceGDTEvent:(NSString *)traceName;
  47. /** Creates a random GDTCOREvent object with network event. */
  48. + (GDTCOREvent *)createRandomNetworkGDTEvent:(NSString *)url;
  49. @end
  50. NS_ASSUME_NONNULL_END