util/net: Place death tests into a *DeathTest test case.

Not doing this causes gtest to issue these warnings:

[WARNING] ../../third_party/gtest/gtest/src/gtest-death-test.cc:825::
Death tests use fork(), which is unsafe particularly in a threaded
context. For this test, Google Test detected 4 threads.

The gtest documentation recommends giving the test case a name ending in
DeathTest. Test cases named according to this convention run before all
other tests. Other death tests in Crashpad also follow this convention.

https://code.google.com/p/googletest/wiki/AdvancedGuide#Death_Tests_And_Threads

TEST=util_test HTTPMultipartBuilderDeathTest.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/694963002
This commit is contained in:
Mark Mentovai 2014-10-31 15:39:16 -04:00
parent d88711adfa
commit 486429e4f4

View File

@ -248,7 +248,7 @@ TEST(HTTPMultipartBuilder, SharedFormDataAndAttachmentKeyNamespace) {
EXPECT_EQ(lines.end(), lines_it); EXPECT_EQ(lines.end(), lines_it);
} }
TEST(HTTPMultipartBuilder, AssertUnsafeMIMEType) { TEST(HTTPMultipartBuilderDeathTest, AssertUnsafeMIMEType) {
HTTPMultipartBuilder builder; HTTPMultipartBuilder builder;
// Invalid and potentially dangerous: // Invalid and potentially dangerous:
ASSERT_DEATH(builder.SetFileAttachment("", "", base::FilePath(), "\r\n"), ""); ASSERT_DEATH(builder.SetFileAttachment("", "", base::FilePath(), "\r\n"), "");