diff options
-rw-r--r-- | testing/gtest.gyp | 5 | ||||
-rw-r--r-- | testing/platform_test.h | 12 | ||||
-rw-r--r-- | testing/platform_test_mac.mm | 8 |
3 files changed, 15 insertions, 10 deletions
diff --git a/testing/gtest.gyp b/testing/gtest.gyp index 581d37a..6d45e9a 100644 --- a/testing/gtest.gyp +++ b/testing/gtest.gyp @@ -56,6 +56,11 @@ 'sources': [ 'platform_test_mac.mm' ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', + ], + }, }], ['OS == "mac" or OS == "linux"', { 'defines': [ diff --git a/testing/platform_test.h b/testing/platform_test.h index 888be74..f10a938 100644 --- a/testing/platform_test.h +++ b/testing/platform_test.h @@ -15,14 +15,14 @@ class NSAutoreleasePool; #endif // The purpose of this class us to provide a hook for platform-specific -// SetUp and TearDown across unit tests. For example, on the Mac, it -// creates and releases an outer AutoreleasePool for each test. For now, it's -// only implemented on the Mac. To enable this for another platform, just -// adjust the #ifdefs and add a platform_test_<platform>.cc implementation file. +// operations across unit tests. For example, on the Mac, it creates and +// releases an outer NSAutoreleasePool for each test case. For now, it's only +// implemented on the Mac. To enable this for another platform, just adjust +// the #ifdefs and add a platform_test_<platform>.cc implementation file. class PlatformTest : public testing::Test { protected: - virtual void SetUp(); - virtual void TearDown(); + PlatformTest(); + virtual ~PlatformTest(); private: NSAutoreleasePool* pool_; diff --git a/testing/platform_test_mac.mm b/testing/platform_test_mac.mm index e4aaeab..bd22cd5 100644 --- a/testing/platform_test_mac.mm +++ b/testing/platform_test_mac.mm @@ -6,10 +6,10 @@ #import <Foundation/Foundation.h> -void PlatformTest::SetUp() { - pool_ = [[NSAutoreleasePool alloc] init]; +PlatformTest::PlatformTest() + : pool_([[NSAutoreleasePool alloc] init]) { } -void PlatformTest::TearDown() { - [pool_ drain]; +PlatformTest::~PlatformTest() { + [pool_ release]; } |