Index: ios/testing/ocmock_complex_type_helper_unittest.mm |
diff --git a/ios/testing/ocmock_complex_type_helper_unittest.mm b/ios/testing/ocmock_complex_type_helper_unittest.mm |
index 709c7b978647c41a5228960c026dfd14f7226f1e..ab859ca8f973492dbfc9b494db80699474b31b85 100644 |
--- a/ios/testing/ocmock_complex_type_helper_unittest.mm |
+++ b/ios/testing/ocmock_complex_type_helper_unittest.mm |
@@ -5,11 +5,14 @@ |
#import "ios/testing/ocmock_complex_type_helper.h" |
#include "base/logging.h" |
-#import "base/mac/scoped_nsobject.h" |
#include "testing/platform_test.h" |
#import "third_party/ocmock/OCMock/OCMock.h" |
#include "third_party/ocmock/gtest_support.h" |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
// A complex type to test with.. |
struct SampleComplexType { |
int number; |
@@ -49,9 +52,9 @@ - (void)passScalar:(ScalarType)foo { |
protected: |
void SetUp() override { |
PlatformTest::SetUp(); |
- helped_mock_.reset([[MockClass alloc] |
- initWithRepresentedObject: |
- [OCMockObject mockForProtocol:@protocol(TestedProtocol)]]); |
+ OCMockObject* protocol_mock = |
liaoyuke
2017/06/14 00:12:45
this temporary variable helps with formatting.
|
+ [OCMockObject mockForProtocol:@protocol(TestedProtocol)]; |
+ helped_mock_ = [[MockClass alloc] initWithRepresentedObject:protocol_mock]; |
} |
void TearDown() override { |
@@ -59,7 +62,7 @@ void TearDown() override { |
PlatformTest::TearDown(); |
} |
- base::scoped_nsobject<id> helped_mock_; |
+ id helped_mock_; |
}; |
TEST_F(OCMockComplexTypeHelperTest, nilObjectStillWorks) { |
@@ -68,7 +71,7 @@ void TearDown() override { |
} |
TEST_F(OCMockComplexTypeHelperTest, anyObjectStillWorks) { |
- base::scoped_nsobject<id> someObject([[NSObject alloc] init]); |
+ id someObject = [[NSObject alloc] init]; |
[[helped_mock_ expect] passObject:OCMOCK_ANY]; |
[helped_mock_ passObject:someObject]; |
} |