[email protected] | b2e9729 | 2008-09-02 18:20:34 | [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 | |||||
[email protected] | 23887f04f | 2008-12-02 19:20:15 | [diff] [blame] | 5 | #ifndef TESTING_PLATFORM_TEST_H_ |
6 | #define TESTING_PLATFORM_TEST_H_ | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 7 | |
[email protected] | 23887f04f | 2008-12-02 19:20:15 | [diff] [blame] | 8 | #include <gtest/gtest.h> |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 9 | |
[email protected] | 23887f04f | 2008-12-02 19:20:15 | [diff] [blame] | 10 | #if defined(GTEST_OS_MAC) |
patricialor | df7b70bc | 2017-03-14 02:51:27 | [diff] [blame] | 11 | #include <objc/objc.h> |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 12 | |
13 | // The purpose of this class us to provide a hook for platform-specific | ||||
[email protected] | c77043fc | 2009-08-20 22:37:59 | [diff] [blame] | 14 | // operations across unit tests. For example, on the Mac, it creates and |
15 | // releases an outer NSAutoreleasePool for each test case. For now, it's only | ||||
16 | // implemented on the Mac. To enable this for another platform, just adjust | ||||
17 | // the #ifdefs and add a platform_test_<platform>.cc implementation file. | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 18 | class PlatformTest : public testing::Test { |
[email protected] | 22d68da | 2012-10-11 16:08:07 | [diff] [blame] | 19 | public: |
Victor Costan | 6370b7f0 | 2020-01-08 15:18:30 | [diff] [blame] | 20 | ~PlatformTest() override; |
[email protected] | 22d68da | 2012-10-11 16:08:07 | [diff] [blame] | 21 | |
[email protected] | f0a51fb5 | 2009-03-05 12:46:38 | [diff] [blame] | 22 | protected: |
[email protected] | c77043fc | 2009-08-20 22:37:59 | [diff] [blame] | 23 | PlatformTest(); |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 24 | |
25 | private: | ||||
stkhapugin | b80a345 | 2016-08-22 17:23:45 | [diff] [blame] | 26 | // |pool_| is a NSAutoreleasePool, but since this header may be imported from |
27 | // files built with Objective-C ARC that forbids explicit usage of | ||||
28 | // NSAutoreleasePools, it is declared as id here. | ||||
29 | id pool_; | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 30 | }; |
31 | #else | ||||
32 | typedef testing::Test PlatformTest; | ||||
[email protected] | 23887f04f | 2008-12-02 19:20:15 | [diff] [blame] | 33 | #endif // GTEST_OS_MAC |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 34 | |
[email protected] | 23887f04f | 2008-12-02 19:20:15 | [diff] [blame] | 35 | #endif // TESTING_PLATFORM_TEST_H_ |