Refactor checks to use a copy of the new logging backend.
As a bonus, this shrinks the android release version of libjingle_peerconnection_so.so by ~25k in local tests.
We could try to unify the backend with the logging one, but that turns out to be surprisingly tricky due to dependency loops and chromium overrides.
Bug: webrtc:8982
Change-Id: I66854dd333f568d9b2a5f46bbead14b2e31179be
Reviewed-on: https://webrtc-review.googlesource.com/79623
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23634}
diff --git a/rtc_base/logging_unittest.cc b/rtc_base/logging_unittest.cc
index 1be0b24..f3f0ea5 100644
--- a/rtc_base/logging_unittest.cc
+++ b/rtc_base/logging_unittest.cc
@@ -87,6 +87,37 @@
EXPECT_EQ(sev, LogMessage::GetLogToStream(nullptr));
}
+#if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
+TEST(LogTest, Checks) {
+ EXPECT_DEATH(FATAL() << "message",
+ "\n\n#\n"
+ "# Fatal error in: \\S+, line \\d+\n"
+ "# last system error: \\d+\n"
+ "# Check failed: FATAL\\(\\)\n"
+ "# message"
+ );
+
+ int a = 1, b = 2;
+ EXPECT_DEATH(RTC_CHECK_EQ(a, b) << 1 << 2u,
+ "\n\n#\n"
+ "# Fatal error in: \\S+, line \\d+\n"
+ "# last system error: \\d+\n"
+ "# Check failed: a == b \\(1 vs. 2\\)\n"
+ "# 12"
+ );
+ RTC_CHECK_EQ(5, 5);
+
+ RTC_CHECK(true) << "Shouldn't crash" << 1;
+ EXPECT_DEATH(RTC_CHECK(false) << "Hi there!",
+ "\n\n#\n"
+ "# Fatal error in: \\S+, line \\d+\n"
+ "# last system error: \\d+\n"
+ "# Check failed: false\n"
+ "# Hi there!"
+ );
+}
+#endif
+
// Test using multiple log streams. The INFO stream should get the INFO message,
// the VERBOSE stream should get the INFO and the VERBOSE.
// We should restore the correct global state at the end.