summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-22 19:31:07 +0000
committermmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-22 19:31:07 +0000
commita87a2e31535c8db76e9f62f80b39df1c11f301c4 (patch)
treef31e173bdb785a3521102ddb1cfd8f9e6a73150f /net
parentd8d90fcb555a2228ee8f64ddf4f844e75848fd45 (diff)
downloadchromium_src-a87a2e31535c8db76e9f62f80b39df1c11f301c4.zip
chromium_src-a87a2e31535c8db76e9f62f80b39df1c11f301c4.tar.gz
chromium_src-a87a2e31535c8db76e9f62f80b39df1c11f301c4.tar.bz2
Use PlatformTest to manage autorelease pools in net tests that use the path service
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1233 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/bzip2_filter_unittest.cc11
-rw-r--r--net/base/gzip_filter_unittest.cc11
-rw-r--r--net/net.xcodeproj/project.pbxproj4
3 files changed, 22 insertions, 4 deletions
diff --git a/net/base/bzip2_filter_unittest.cc b/net/base/bzip2_filter_unittest.cc
index a9a124f..eb225fe 100644
--- a/net/base/bzip2_filter_unittest.cc
+++ b/net/base/bzip2_filter_unittest.cc
@@ -32,6 +32,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/platform_test.h"
#include "base/scoped_ptr.h"
#include "net/base/bzip2_filter.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -47,9 +48,13 @@ const int kMaxBufferSize = 1048576; // 1048576 == 2^20 == 1 MB
const char kApplicationOctetStream[] = "application/octet-stream";
-class BZip2FilterUnitTest : public testing::Test {
+// These tests use the path service, which uses autoreleased objects on the
+// Mac, so this needs to be a PlatformTest.
+class BZip2FilterUnitTest : public PlatformTest {
protected:
virtual void SetUp() {
+ PlatformTest::SetUp();
+
bzip2_encode_buffer_ = NULL;
// Get the path of source data file.
@@ -102,6 +107,8 @@ class BZip2FilterUnitTest : public testing::Test {
virtual void TearDown() {
delete[] bzip2_encode_buffer_;
bzip2_encode_buffer_ = NULL;
+
+ PlatformTest::TearDown();
}
// Use filter to decode compressed data, and compare the decoding result with
@@ -195,7 +202,7 @@ class BZip2FilterUnitTest : public testing::Test {
int bzip2_encode_len_;
};
-}; // namespace
+} // namespace
// Basic scenario: decoding bzip2 data with big enough buffer.
TEST_F(BZip2FilterUnitTest, DecodeBZip2) {
diff --git a/net/base/gzip_filter_unittest.cc b/net/base/gzip_filter_unittest.cc
index 11fd9d2..272bf3e 100644
--- a/net/base/gzip_filter_unittest.cc
+++ b/net/base/gzip_filter_unittest.cc
@@ -32,6 +32,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/platform_test.h"
#include "base/scoped_ptr.h"
#include "net/base/gzip_filter.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -69,9 +70,13 @@ enum EncodeMode {
ENCODE_DEFLATE // Raw deflate.
};
-class GZipUnitTest : public testing::Test {
+// These tests use the path service, which uses autoreleased objects on the
+// Mac, so this needs to be a PlatformTest.
+class GZipUnitTest : public PlatformTest {
protected:
virtual void SetUp() {
+ PlatformTest::SetUp();
+
deflate_encode_buffer_ = NULL;
gzip_encode_buffer_ = NULL;
@@ -115,6 +120,8 @@ class GZipUnitTest : public testing::Test {
delete[] gzip_encode_buffer_;
gzip_encode_buffer_ = NULL;
+
+ PlatformTest::TearDown();
}
// Compress the data in source with deflate encoding and write output to the
@@ -243,7 +250,7 @@ class GZipUnitTest : public testing::Test {
int gzip_encode_len_;
};
-}; // namespace
+} // namespace
// Basic scenario: decoding deflate data with big enough buffer.
TEST_F(GZipUnitTest, DecodeDeflate) {
diff --git a/net/net.xcodeproj/project.pbxproj b/net/net.xcodeproj/project.pbxproj
index cd1bbfd..66f264e 100644
--- a/net/net.xcodeproj/project.pbxproj
+++ b/net/net.xcodeproj/project.pbxproj
@@ -27,6 +27,7 @@
048268090E5B3B4800A30786 /* mime_util_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED325E0E5A181C00A747DB /* mime_util_unittest.cc */; };
0482692A0E5B624D00A30786 /* http_cache.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED334C0E5A194700A747DB /* http_cache.cc */; };
533102E70E5E3EBF00FF8E32 /* net_util_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = 533102E60E5E3EBF00FF8E32 /* net_util_posix.cc */; };
+ 7B466C470E5E732900C91F63 /* platform_test_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7B466C460E5E732900C91F63 /* platform_test_mac.mm */; };
7B4DF64A0E5B98DF004D7619 /* client_socket_pool_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED326A0E5A181C00A747DB /* client_socket_pool_unittest.cc */; };
7B4DF6A90E5B98E7004D7619 /* data_url_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED325F0E5A181C00A747DB /* data_url_unittest.cc */; };
7B4DF6B10E5B98ED004D7619 /* escape_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED32BF0E5A181C00A747DB /* escape_unittest.cc */; };
@@ -300,6 +301,7 @@
/* Begin PBXFileReference section */
533102E60E5E3EBF00FF8E32 /* net_util_posix.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = net_util_posix.cc; sourceTree = "<group>"; };
+ 7B466C460E5E732900C91F63 /* platform_test_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = platform_test_mac.mm; sourceTree = "<group>"; };
7B8501F10E5A372500730B43 /* googleurl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = googleurl.xcodeproj; path = build/googleurl.xcodeproj; sourceTree = "<group>"; };
7B8502620E5A38BB00730B43 /* modp_b64.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = modp_b64.xcodeproj; path = third_party/modp_b64/modp_b64.xcodeproj; sourceTree = "<group>"; };
7BA015570E5A1C3E00044150 /* icu.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = icu.xcodeproj; path = third_party/icu38/build/icu.xcodeproj; sourceTree = "<group>"; };
@@ -667,6 +669,7 @@
7BED32150E5A172D00A747DB /* base */ = {
isa = PBXGroup;
children = (
+ 7B466C460E5E732900C91F63 /* platform_test_mac.mm */,
E4AFA6420E5241B400201347 /* run_all_unittests.cc */,
);
name = base;
@@ -1257,6 +1260,7 @@
7B4DF9AC0E5C906A004D7619 /* mime_sniffer_unittest.cc in Sources */,
048268090E5B3B4800A30786 /* mime_util_unittest.cc in Sources */,
BAA46E3B0E5CE99A00E77460 /* net_util_unittest.cc in Sources */,
+ 7B466C470E5E732900C91F63 /* platform_test_mac.mm in Sources */,
7B8B5B9E0E5D188E002F9A97 /* registry_controlled_domain_unittest.cc in Sources */,
E4AFA6430E5241B400201347 /* run_all_unittests.cc in Sources */,
);