Skip to content

Replace the NSBundle swizzle with an injected GIDBundle seam - #658

Merged
w-goog merged 11 commits into
mainfrom
codegen/ocmock-01-bundle-seam
Oct 21, 2026
Merged

w-goog merged 11 commits into
mainfrom
codegen/ocmock-01-bundle-seam

Conversation

@w-goog

@w-goog w-goog commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

It's happening!!!!!!!! First of a stack of ~9 PRs removing OCMock & GULSwizzler from the unit tests. This one takes out the NSBundle swizzle in GIDFakeMainBundle and the mocked NSBundle / NSUserDefaults in the migration test.

  • New GIDBundle protocol covering the two things the SDK reads from a bundle (bundleIdentifier and objectForInfoDictionaryKey:), with NSBundle conforming and a GIDFakeBundle for tests.
  • GIDSignIn, GIDAuthStateMigration, and GIDSignInCallbackSchemes take the bundle (and the first two, user defaults) through new private designated initializers. The existing initializers pass mainBundle / standardUserDefaults.
  • GIDFakeMainBundle is now a GIDFakeBundle subclass with the same helpers - no more swizzling!!! :D
  • The migration tests now use the fakes, or real UIKit constructs where applicable.

Note for reviewers: the OS routes callbacks by the main bundle regardless of what's injected, and the URL scheme check + legacy keychain fingerprint both read the injected one - so, the bundle has to be the running app's. I documented that on the initializers (rather than enforcing it), as they're private.

Known follow-up: GIDAppCheck still reads GIDClientID from the main bundle on its own...on my TODO list as future work.

@w-goog
w-goog requested a review from ch40w31 October 21, 2026 00:20
@w-goog
w-goog merged commit 5140b1e into main Oct 21, 2026
29 checks passed
@w-goog
w-goog deleted the codegen/ocmock-01-bundle-seam branch October 21, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants