aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Sargeant <tobiasjs@google.com>2016-12-12 13:49:39 +0000
committerTobias Sargeant <tobiasjs@chromium.org>2016-12-12 16:16:22 +0000
commitf78d953511606348173911ae0b62572ebec1bbc4 (patch)
treeca6c965ed5fac03ed948ab9bd90bca8bd2338e1f
parentFix sign-compare compiler warning in MicrodumpWriterTest (diff)
downloadbreakpad-f78d953511606348173911ae0b62572ebec1bbc4.tar.xz
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 <primiano@chromium.org>
-rw-r--r--src/client/linux/microdump_writer/microdump_writer_unittest.cc18
1 files changed, 9 insertions, 9 deletions
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