[Mac] Use non-autoreleased mock object in ScopedBundleSwizzlerMac

The "release" call in the destructor might or might not destroy the
mock object, depending on current autorelease pool.
If we add to the picture the local autorelease pool (used in tests),
we no longer can name the class "Scoped".

The fix creates OCPartialMockObject without the helper function,
avoiding the autoreleasability.

Change-Id: Id17a1ef571246370f6e84cde60773f90d7d35cb0
Reviewed-on: https://chromium-review.googlesource.com/c/1375871
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616424}
diff --git a/chrome/test/base/scoped_bundle_swizzler_mac.mm b/chrome/test/base/scoped_bundle_swizzler_mac.mm
index 90aaf14b..294fa13b 100644
--- a/chrome/test/base/scoped_bundle_swizzler_mac.mm
+++ b/chrome/test/base/scoped_bundle_swizzler_mac.mm
@@ -11,6 +11,7 @@
 #include "base/mac/scoped_objc_class_swizzler.h"
 #include "base/strings/sys_string_conversions.h"
 #import "third_party/ocmock/OCMock/OCMock.h"
+#import "third_party/ocmock/OCMock/OCPartialMockObject.h"
 
 static NSBundle* g_original_main_bundle = nil;
 static id g_swizzled_main_bundle = nil;
@@ -33,7 +34,8 @@
 
   g_original_main_bundle = [NSBundle mainBundle];
   g_swizzled_main_bundle =
-      [[OCMockObject partialMockForObject:g_original_main_bundle] retain];
+      [[OCPartialMockObject alloc] initWithObject:g_original_main_bundle];
+
   NSString* identifier = base::SysUTF8ToNSString(base::mac::BaseBundleID());
   CHECK(identifier);
   [[[g_swizzled_main_bundle stub] andReturn:identifier] bundleIdentifier];