1 // Copyright 2006-2008 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef TESTING_PLATFORM_TEST_H_ 6 #define TESTING_PLATFORM_TEST_H_ 7 8 #include <gtest/gtest.h> 9 10 #if defined(GTEST_OS_MAC) 11 // The purpose of this class us to provide a hook for platform-specific 12 // operations across unit tests. For example, on the Mac, it creates and 13 // releases an autorelease pool for each test case. For now, it's only 14 // implemented on the Mac. To enable this for another platform, just adjust 15 // the #ifdefs and add a platform_test_<platform>.cc implementation file. 16 class PlatformTest : public testing::Test { 17 public: 18 ~PlatformTest() override; 19 20 protected: 21 PlatformTest(); 22 23 private: 24 void* autorelease_pool_; 25 }; 26 #else 27 28 using PlatformTest = testing::Test; 29 30 #endif // GTEST_OS_MAC 31 32 #endif // TESTING_PLATFORM_TEST_H_ 33