blob: 15782b061b952398876a3931c53ef407248915e3 [file] [log] [blame]
[email protected]b2e97292008-09-02 18:20:341// 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]23887f04f2008-12-02 19:20:155#ifndef TESTING_PLATFORM_TEST_H_
6#define TESTING_PLATFORM_TEST_H_
[email protected]b2e97292008-09-02 18:20:347
[email protected]23887f04f2008-12-02 19:20:158#include <gtest/gtest.h>
[email protected]b2e97292008-09-02 18:20:349
[email protected]23887f04f2008-12-02 19:20:1510#if defined(GTEST_OS_MAC)
patricialordf7b70bc2017-03-14 02:51:2711#include <objc/objc.h>
[email protected]b2e97292008-09-02 18:20:3412
13// The purpose of this class us to provide a hook for platform-specific
[email protected]c77043fc2009-08-20 22:37:5914// 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]b2e97292008-09-02 18:20:3418class PlatformTest : public testing::Test {
[email protected]22d68da2012-10-11 16:08:0719 public:
Victor Costan6370b7f02020-01-08 15:18:3020 ~PlatformTest() override;
[email protected]22d68da2012-10-11 16:08:0721
[email protected]f0a51fb52009-03-05 12:46:3822 protected:
[email protected]c77043fc2009-08-20 22:37:5923 PlatformTest();
[email protected]b2e97292008-09-02 18:20:3424
25 private:
stkhapuginb80a3452016-08-22 17:23:4526 // |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]b2e97292008-09-02 18:20:3430};
31#else
32typedef testing::Test PlatformTest;
[email protected]23887f04f2008-12-02 19:20:1533#endif // GTEST_OS_MAC
[email protected]b2e97292008-09-02 18:20:3434
[email protected]23887f04f2008-12-02 19:20:1535#endif // TESTING_PLATFORM_TEST_H_