license.bot | f003cfe | 2008-08-24 09:55:55 +0900 | [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 |
|
| 5 | #ifndef BASE_PLATFORM_TEST_H_
|
| 6 | #define BASE_PLATFORM_TEST_H_
|
| 7 |
|
| 8 | #include "build/build_config.h"
|
| 9 | #include "testing/gtest/include/gtest/gtest.h"
|
| 10 |
|
| 11 | #if defined(OS_MACOSX)
|
| 12 | #ifdef __OBJC__
|
| 13 | @class NSAutoreleasePool;
|
| 14 | #else
|
| 15 | class NSAutoreleasePool;
|
| 16 | #endif
|
| 17 |
|
| 18 | // The purpose of this class us to provide a hook for platform-specific
|
| 19 | // SetUp and TearDown across unit tests. For example, on the Mac, it
|
| 20 | // creates and releases an outer AutoreleasePool for each test. For now, it's
|
| 21 | // only implemented on the Mac. To enable this for another platform, just
|
| 22 | // adjust the #ifdefs and add a platform_test_<platform>.cc implementation file.
|
| 23 | class PlatformTest : public testing::Test {
|
| 24 | protected:
|
| 25 | virtual void SetUp();
|
| 26 | virtual void TearDown();
|
| 27 |
|
| 28 | private:
|
| 29 | NSAutoreleasePool* pool_;
|
| 30 | };
|
| 31 | #else
|
| 32 | typedef testing::Test PlatformTest;
|
| 33 | #endif // OS_MACOSX
|
| 34 |
|
| 35 | #endif // BASE_PLATFORM_TEST_H_
|
| 36 |
|
| 37 |
|