| 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 #ifndef __OBJC__ |
| 12 typedef void* id; | 12 typedef struct objc_object* id; |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 // The purpose of this class us to provide a hook for platform-specific | 15 // 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 | 16 // 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 | 17 // 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 | 18 // implemented on the Mac. To enable this for another platform, just adjust |
| 19 // the #ifdefs and add a platform_test_<platform>.cc implementation file. | 19 // the #ifdefs and add a platform_test_<platform>.cc implementation file. |
| 20 class PlatformTest : public testing::Test { | 20 class PlatformTest : public testing::Test { |
| 21 public: | 21 public: |
| 22 virtual ~PlatformTest(); | 22 virtual ~PlatformTest(); |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 PlatformTest(); | 25 PlatformTest(); |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 // |pool_| is a NSAutoreleasePool, but since this header may be imported from | 28 // |pool_| is a NSAutoreleasePool, but since this header may be imported from |
| 29 // files built with Objective-C ARC that forbids explicit usage of | 29 // files built with Objective-C ARC that forbids explicit usage of |
| 30 // NSAutoreleasePools, it is declared as id here. | 30 // NSAutoreleasePools, it is declared as id here. |
| 31 id pool_; | 31 id pool_; |
| 32 }; | 32 }; |
| 33 #else | 33 #else |
| 34 typedef testing::Test PlatformTest; | 34 typedef testing::Test PlatformTest; |
| 35 #endif // GTEST_OS_MAC | 35 #endif // GTEST_OS_MAC |
| 36 | 36 |
| 37 #endif // TESTING_PLATFORM_TEST_H_ | 37 #endif // TESTING_PLATFORM_TEST_H_ |
| OLD | NEW |