• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
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 #include <objc/objc.h>
12 
13 // The purpose of this class us to provide a hook for platform-specific
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.
18 class PlatformTest : public testing::Test {
19  public:
20   virtual ~PlatformTest();
21 
22  protected:
23   PlatformTest();
24 
25  private:
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_;
30 };
31 #else
32 typedef testing::Test PlatformTest;
33 #endif // GTEST_OS_MAC
34 
35 #endif // TESTING_PLATFORM_TEST_H_
36