From f78d953511606348173911ae0b62572ebec1bbc4 Mon Sep 17 00:00:00 2001 From: Tobias Sargeant Date: Mon, 12 Dec 2016 13:49:39 +0000 Subject: Fix unit tests expecting no output when a microdump is suppressed. BUG= Change-Id: Ie4d190c68ecbd8709874a3f1ceb872b94b36914f Reviewed-on: https://chromium-review.googlesource.com/419036 Reviewed-by: Primiano Tucci --- .../microdump_writer/microdump_writer_unittest.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/client') diff --git a/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/src/client/linux/microdump_writer/microdump_writer_unittest.cc index b6dc69e3..42677852 100644 --- a/src/client/linux/microdump_writer/microdump_writer_unittest.cc +++ b/src/client/linux/microdump_writer/microdump_writer_unittest.cc @@ -75,9 +75,9 @@ MicrodumpExtraInfo MakeMicrodumpExtraInfo( return info; } -void AssertContainsMicrodump(const std::string& buf) { - ASSERT_NE(std::string::npos, buf.find("-----BEGIN BREAKPAD MICRODUMP-----")); - ASSERT_NE(std::string::npos, buf.find("-----END BREAKPAD MICRODUMP-----")); +bool ContainsMicrodump(const std::string& buf) { + return std::string::npos != buf.find("-----BEGIN BREAKPAD MICRODUMP-----") && + std::string::npos != buf.find("-----END BREAKPAD MICRODUMP-----"); } void CrashAndGetMicrodump(const MappingList& mappings, @@ -213,7 +213,7 @@ TEST(MicrodumpWriterTest, BasicWithMappings) { std::string buf; CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf); - AssertContainsMicrodump(buf); + ASSERT_TRUE(ContainsMicrodump(buf)); #ifdef __LP64__ ASSERT_NE(std::string::npos, @@ -246,7 +246,7 @@ TEST(MicrodumpWriterTest, NoOutputIfUninteresting) { MappingList no_mappings; CrashAndGetMicrodump(no_mappings, kMicrodumpExtraInfo, &buf); - ASSERT_EQ(0U, buf.size()); + ASSERT_FALSE(ContainsMicrodump(buf)); } // Ensure that output occurs if the interest region is set, and @@ -268,7 +268,7 @@ TEST(MicrodumpWriterTest, OutputIfInteresting) { MappingList no_mappings; CrashAndGetMicrodump(no_mappings, kMicrodumpExtraInfo, &buf); - ASSERT_LT(0U, buf.size()); + ASSERT_TRUE(ContainsMicrodump(buf)); } // Ensure that the product info and build fingerprint metadata show up in the @@ -285,7 +285,7 @@ TEST(MicrodumpWriterTest, BuildFingerprintAndProductInfo) { MappingList no_mappings; CrashAndGetMicrodump(no_mappings, kMicrodumpExtraInfo, &buf); - AssertContainsMicrodump(buf); + ASSERT_TRUE(ContainsMicrodump(buf)); CheckMicrodumpContents(buf, kMicrodumpExtraInfo); } @@ -299,7 +299,7 @@ TEST(MicrodumpWriterTest, NoProductInfo) { MakeMicrodumpExtraInfo(kBuildFingerprint, NULL, kGPUFingerprint)); CrashAndGetMicrodump(no_mappings, kMicrodumpExtraInfoNoProductInfo, &buf); - AssertContainsMicrodump(buf); + ASSERT_TRUE(ContainsMicrodump(buf)); CheckMicrodumpContents(buf, kBuildFingerprint, "UNKNOWN:0.0.0.0", kGPUFingerprint); } @@ -314,7 +314,7 @@ TEST(MicrodumpWriterTest, NoGPUInfo) { MakeMicrodumpExtraInfo(kBuildFingerprint, kProductInfo, NULL)); CrashAndGetMicrodump(no_mappings, kMicrodumpExtraInfoNoGPUInfo, &buf); - AssertContainsMicrodump(buf); + ASSERT_TRUE(ContainsMicrodump(buf)); CheckMicrodumpContents(buf, kBuildFingerprint, kProductInfo, "UNKNOWN"); } } // namespace -- cgit v1.2.1