| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef TESTING_PLATFORM_TEST_H_ | 5 #ifndef TESTING_PLATFORM_TEST_H_ |
| 6 #define TESTING_PLATFORM_TEST_H_ | 6 #define TESTING_PLATFORM_TEST_H_ |
| 7 | 7 |
| 8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
| 9 | 9 |
| 10 #if defined(GTEST_OS_MAC) | 10 #if defined(GTEST_OS_MAC) |
| 11 #ifndef __OBJC__ | 11 #include <objc/objc.h> |
| 12 typedef void* id; | |
| 13 #endif | |
| 14 | 12 |
| 15 // The purpose of this class us to provide a hook for platform-specific | 13 // The purpose of this class us to provide a hook for platform-specific |
| 16 // operations across unit tests. For example, on the Mac, it creates and | 14 // operations across unit tests. For example, on the Mac, it creates and |
| 17 // releases an outer NSAutoreleasePool for each test case. For now, it's only | 15 // releases an outer NSAutoreleasePool for each test case. For now, it's only |
| 18 // implemented on the Mac. To enable this for another platform, just adjust | 16 // implemented on the Mac. To enable this for another platform, just adjust |
| 19 // the #ifdefs and add a platform_test_<platform>.cc implementation file. | 17 // the #ifdefs and add a platform_test_<platform>.cc implementation file. |
| 20 class PlatformTest : public testing::Test { | 18 class PlatformTest : public testing::Test { |
| 21 public: | 19 public: |
| 22 virtual ~PlatformTest(); | 20 virtual ~PlatformTest(); |
| 23 | 21 |
| 24 protected: | 22 protected: |
| 25 PlatformTest(); | 23 PlatformTest(); |
| 26 | 24 |
| 27 private: | 25 private: |
| 28 // |pool_| is a NSAutoreleasePool, but since this header may be imported from | 26 // |pool_| is a NSAutoreleasePool, but since this header may be imported from |
| 29 // files built with Objective-C ARC that forbids explicit usage of | 27 // files built with Objective-C ARC that forbids explicit usage of |
| 30 // NSAutoreleasePools, it is declared as id here. | 28 // NSAutoreleasePools, it is declared as id here. |
| 31 id pool_; | 29 id pool_; |
| 32 }; | 30 }; |
| 33 #else | 31 #else |
| 34 typedef testing::Test PlatformTest; | 32 typedef testing::Test PlatformTest; |
| 35 #endif // GTEST_OS_MAC | 33 #endif // GTEST_OS_MAC |
| 36 | 34 |
| 37 #endif // TESTING_PLATFORM_TEST_H_ | 35 #endif // TESTING_PLATFORM_TEST_H_ |
| OLD | NEW |