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