diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 15:59:49 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 15:59:49 +0000 |
commit | ed2f2331443f02b22b1a8051407debf03215b95d (patch) | |
tree | 04c704aa43ee77a4d44c709150495580ca289b8f /base/file_util_unittest.cc | |
parent | 173cb8a00462e07619c3de56e62dcbba56389ccc (diff) | |
download | chromium_src-ed2f2331443f02b22b1a8051407debf03215b95d.zip chromium_src-ed2f2331443f02b22b1a8051407debf03215b95d.tar.gz chromium_src-ed2f2331443f02b22b1a8051407debf03215b95d.tar.bz2 |
Create a gtest test fixture subclass that allows for platform specific setup and teardown hooks. On the Mac use this to create an outer Autorelease pool.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_unittest.cc')
-rw-r--r-- | base/file_util_unittest.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index 9a75cd6..54e2da7 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -43,14 +43,18 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/path_service.h" +#include "base/platform_test.h" #include "base/string_util.h" #include "testing/gtest/include/gtest/gtest.h" namespace { -class FileUtilTest : public testing::Test { +// file_util winds up using autoreleased objects on the Mac, so this needs +// to be a PlatformTest +class FileUtilTest : public PlatformTest { protected: virtual void SetUp() { + PlatformTest::SetUp(); // Name a subdirectory of the temp directory. ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &test_dir_)); file_util::AppendToPath(&test_dir_, L"FileUtilTest"); @@ -60,6 +64,7 @@ class FileUtilTest : public testing::Test { file_util::CreateDirectory(test_dir_.c_str()); } virtual void TearDown() { + PlatformTest::TearDown(); // Clean up test directory ASSERT_TRUE(file_util::Delete(test_dir_, true)); ASSERT_FALSE(file_util::PathExists(test_dir_)); @@ -594,9 +599,11 @@ TEST_F(FileUtilTest, GetFileCreationLocalTime) { } #endif -typedef testing::Test ReadOnlyFileUtilTest; +// file_util winds up using autoreleased objects on the Mac, so this needs +// to be a PlatformTest +typedef PlatformTest ReadOnlyFileUtilTest; -TEST(ReadOnlyFileUtilTest, ContentsEqual) { +TEST_F(ReadOnlyFileUtilTest, ContentsEqual) { std::wstring data_dir; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); file_util::AppendToPath(&data_dir, L"base"); |