GIDFakeMainBundle.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright 2021 Google LLC
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * @class GIDFakeMainBundle
  20. * @brief Helps fake [NSBundle mainBundle]
  21. */
  22. @interface GIDFakeMainBundle : NSObject
  23. /**
  24. * @fn initWithClientID:serverClientID:hostedDomain:openIDRealm:
  25. * @brief Initializes a GIDFakeMainBundle object.
  26. * @param clientID The fake client idenfitier for the app.
  27. * @param serverClientID The fake server client idenfitier for the app.
  28. * @param hostedDomain The fake hosted domain for the app.
  29. * @param openIDRealm The fake OpenID realm for the app.
  30. */
  31. - (instancetype)initWithClientID:(nullable id)clientID
  32. serverClientID:(nullable id)serverClientID
  33. hostedDomain:(nullable id)hostedDomain
  34. openIDRealm:(nullable id)openIDRealm
  35. NS_DESIGNATED_INITIALIZER;
  36. /**
  37. * @fn init:
  38. * @brief Initializes a GIDFakeMainBundle object with `nil` to all of the designated initializer's parameters.
  39. */
  40. - (instancetype)init;
  41. /**
  42. * @fn startFaking:
  43. * @brief Starts faking [NSBundle mainBundle]
  44. */
  45. - (void)startFaking;
  46. /**
  47. * @fn startFakingWithClientID:
  48. * @brief Starts faking [NSBundle mainBundle]
  49. * @param clientID The fake client idenfitier for the app.
  50. */
  51. - (void)startFakingWithClientID:(nullable NSString *)clientID;
  52. /**
  53. * @fn stopFaking
  54. * @brief Stops faking [NSBundle mainBundle]
  55. */
  56. - (void)stopFaking;
  57. #pragma mark - URL Schemes
  58. /**
  59. * @fn fakeAllSchemesSupported
  60. * @brief Fakes all URL schemes in the info.plist.
  61. */
  62. - (void)fakeAllSchemesSupported;
  63. /**
  64. * @fn fakeAllSchemesSupportedAndMerged
  65. * @brief Fakes all URL schemes in the info.plist as a single scheme definition.
  66. */
  67. - (void)fakeAllSchemesSupportedAndMerged;
  68. /**
  69. * @fn fakeAllSchemesSupportedWithCasesMangled
  70. * @brief Fakes all URL schemes in the info.plist but flips A-Z with a-z and vice-versa.
  71. */
  72. - (void)fakeAllSchemesSupportedWithCasesMangled;
  73. /**
  74. * @fn fakeMissingClientIdScheme
  75. * @brief Fakes a missing client ID scheme in the info.plist.
  76. */
  77. - (void)fakeMissingClientIdScheme;
  78. /**
  79. * @fn fakeMissingAllSchemes
  80. * @brief Fakes missing the CFBundleURLTypes section of the info.plist entirely.
  81. */
  82. - (void)fakeMissingAllSchemes;
  83. /**
  84. * @fn fakeOtherSchemes
  85. * @brief Fakes other irrelevant schemes in the info.plist.
  86. */
  87. - (void)fakeOtherSchemes;
  88. /**
  89. * @fn fakeOtherSchemesAndAllSchemes
  90. * @brief Fakes other irrelevant schemes in the info.plist.
  91. */
  92. - (void)fakeOtherSchemesAndAllSchemes;
  93. /**
  94. * @fn fakeWithClientID:serverClientID:hostedDomain:openIDRealm:
  95. * @brief Sets values for faked Info.plist params.
  96. * @param clientID The fake client idenfitier for the app.
  97. * @param serverClientID The fake server client idenfitier for the app.
  98. * @param hostedDomain The fake hosted domain for the app.
  99. * @param openIDRealm The fake OpenID realm for the app.
  100. */
  101. - (void)fakeWithClientID:(nullable id)clientID
  102. serverClientID:(nullable id)serverClientID
  103. hostedDomain:(nullable id)hostedDomain
  104. openIDRealm:(nullable id)openIDRealm;
  105. @end
  106. NS_ASSUME_NONNULL_END