summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 22:37:59 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 22:37:59 +0000
commitc77043fc18d43d6e858ec0920a5801438eae566f (patch)
tree2b645c87c61e436c5e0aa5827bfd7eb2204b7078 /testing
parent756797e2e4aab2c78ee3fa4bd855447ee62eb9af (diff)
downloadchromium_src-c77043fc18d43d6e858ec0920a5801438eae566f.zip
chromium_src-c77043fc18d43d6e858ec0920a5801438eae566f.tar.gz
chromium_src-c77043fc18d43d6e858ec0920a5801438eae566f.tar.bz2
Move NSAutoreleasePool management into the PlatformTest constructor and
destructor. The pool operations are moving from SetUp and TearDown, which are scoped slightly too narrowly for our needs. Using the constructor and destructor ensures that the pools properly bracket tests. Review URL: http://codereview.chromium.org/174171 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23897 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing')
-rw-r--r--testing/gtest.gyp5
-rw-r--r--testing/platform_test.h12
-rw-r--r--testing/platform_test_mac.mm8
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];
}