Index: ios/chrome/test/ocmock/scoped_mock_object.h |
diff --git a/ios/chrome/test/ocmock/scoped_mock_object.h b/ios/chrome/test/ocmock/scoped_mock_object.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0d4ab610c4efc118e73b641c20300862c3f7dd39 |
--- /dev/null |
+++ b/ios/chrome/test/ocmock/scoped_mock_object.h |
@@ -0,0 +1,20 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef IOS_CHROME_TEST_OCMOCK_SCOPED_MOCK_OBJECT_H_ |
+#define IOS_CHROME_TEST_OCMOCK_SCOPED_MOCK_OBJECT_H_ |
+ |
+#include "base/mac/scoped_nsobject.h" |
+#import "third_party/ocmock/OCMock/OCMock.h" |
+ |
+// Helper class that constructs an OCMock and manages ownership of it. |
+template <typename NST> |
+class ScopedMockObject : public base::scoped_nsobject<id> { |
+ public: |
+ ScopedMockObject() |
+ : base::scoped_nsobject<id>( |
+ [[OCMockObject mockForClass:[NST class]] retain]) {} |
+}; |
+ |
+#endif // IOS_CHROME_TEST_OCMOCK_SCOPED_MOCK_OBJECT_H_ |