mmentovai@google.com | aa13be6 | 2008-09-03 03:20:34 +0900 | [diff] [blame] | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
jeremy@chromium.org | 0d8eba7 | 2008-12-03 04:20:15 +0900 | [diff] [blame] | 5 | #ifndef TESTING_PLATFORM_TEST_H_ |
| 6 | #define TESTING_PLATFORM_TEST_H_ |
mmentovai@google.com | aa13be6 | 2008-09-03 03:20:34 +0900 | [diff] [blame] | 7 | |
jeremy@chromium.org | 0d8eba7 | 2008-12-03 04:20:15 +0900 | [diff] [blame] | 8 | #include <gtest/gtest.h> |
mmentovai@google.com | aa13be6 | 2008-09-03 03:20:34 +0900 | [diff] [blame] | 9 | |
jeremy@chromium.org | 0d8eba7 | 2008-12-03 04:20:15 +0900 | [diff] [blame] | 10 | #if defined(GTEST_OS_MAC) |
mmentovai@google.com | aa13be6 | 2008-09-03 03:20:34 +0900 | [diff] [blame] | 11 | #ifdef __OBJC__ |
| 12 | @class NSAutoreleasePool; |
| 13 | #else |
| 14 | class NSAutoreleasePool; |
| 15 | #endif |
| 16 | |
| 17 | // The purpose of this class us to provide a hook for platform-specific |
mark@chromium.org | c8cddec | 2009-08-21 07:37:59 +0900 | [diff] [blame] | 18 | // operations across unit tests. For example, on the Mac, it creates and |
| 19 | // releases an outer NSAutoreleasePool for each test case. For now, it's only |
| 20 | // implemented on the Mac. To enable this for another platform, just adjust |
| 21 | // the #ifdefs and add a platform_test_<platform>.cc implementation file. |
mmentovai@google.com | aa13be6 | 2008-09-03 03:20:34 +0900 | [diff] [blame] | 22 | class PlatformTest : public testing::Test { |
lpromero@google.com | 5e21f7b | 2012-10-12 01:08:07 +0900 | [diff] [blame] | 23 | public: |
| 24 | virtual ~PlatformTest(); |
| 25 | |
maruel@chromium.org | e574344 | 2009-03-05 21:46:38 +0900 | [diff] [blame] | 26 | protected: |
mark@chromium.org | c8cddec | 2009-08-21 07:37:59 +0900 | [diff] [blame] | 27 | PlatformTest(); |
mmentovai@google.com | aa13be6 | 2008-09-03 03:20:34 +0900 | [diff] [blame] | 28 | |
| 29 | private: |
| 30 | NSAutoreleasePool* pool_; |
| 31 | }; |
| 32 | #else |
| 33 | typedef testing::Test PlatformTest; |
jeremy@chromium.org | 0d8eba7 | 2008-12-03 04:20:15 +0900 | [diff] [blame] | 34 | #endif // GTEST_OS_MAC |
mmentovai@google.com | aa13be6 | 2008-09-03 03:20:34 +0900 | [diff] [blame] | 35 | |
jeremy@chromium.org | 0d8eba7 | 2008-12-03 04:20:15 +0900 | [diff] [blame] | 36 | #endif // TESTING_PLATFORM_TEST_H_ |