Index: ios/chrome/test/ocmock/scoped_verifying_mock_object.h |
diff --git a/ios/chrome/test/ocmock/scoped_verifying_mock_object.h b/ios/chrome/test/ocmock/scoped_verifying_mock_object.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2074d90ceb250aa9037d4023dd11cdab8b3185cd |
--- /dev/null |
+++ b/ios/chrome/test/ocmock/scoped_verifying_mock_object.h |
@@ -0,0 +1,23 @@ |
+// 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_VERIFYING_MOCK_OBJECT_H_ |
+#define IOS_CHROME_TEST_OCMOCK_SCOPED_VERIFYING_MOCK_OBJECT_H_ |
+ |
+#include "ios/chrome/test/ocmock/scoped_mock_object.h" |
+#include "third_party/ocmock/gtest_support.h" |
+ |
+// Helper class that constructs an OCMock and automatically verifies the mock |
+// upon destruction. |
+template <typename NST> |
+class ScopedVerifyingMockObject : public ScopedMockObject<NST> { |
+ public: |
+ ScopedVerifyingMockObject() {} |
+ |
+ ~ScopedVerifyingMockObject() { |
+ EXPECT_OCMOCK_VERIFY(ScopedMockObject<NST>::get()); |
+ } |
+}; |
+ |
+#endif // IOS_CHROME_TEST_OCMOCK_SCOPED_VERIFYING_MOCK_OBJECT_H_ |