crash-reporter: Ignore Chrome crashes, relying on Chrome breakpad
Change-Id: I08e44d2c8b6be839d18efd2fe6e8b612a61ae723
BUG=8841
TEST=bvts
Review URL: http://codereview.chromium.org/4499006
diff --git a/crash_reporter/user_collector.cc b/crash_reporter/user_collector.cc
index 6fa368d..f15c578 100644
--- a/crash_reporter/user_collector.cc
+++ b/crash_reporter/user_collector.cc
@@ -382,9 +382,21 @@
}
bool feedback = is_feedback_allowed_function_();
+ const char *handling_string = "handling";
+ if (!feedback) {
+ handling_string = "ignoring - no consent";
+ }
+
+ // Treat Chrome crashes as if the user opted-out. We stop counting Chrome
+ // crashes towards user crashes, so user crashes really mean non-Chrome
+ // user-space crashes.
+ if (exec == "chrome") {
+ feedback = false;
+ handling_string = "ignoring - chrome crash";
+ }
+
logger_->LogWarning("Received crash notification for %s[%d] sig %d (%s)",
- exec.c_str(), pid, signal,
- feedback ? "handling" : "ignoring - no consent");
+ exec.c_str(), pid, signal, handling_string);
if (feedback) {
count_crash_function_();
diff --git a/crash_reporter/user_collector_test.cc b/crash_reporter/user_collector_test.cc
index 06ba9b8..faa1689 100644
--- a/crash_reporter/user_collector_test.cc
+++ b/crash_reporter/user_collector_test.cc
@@ -89,19 +89,30 @@
TEST_F(UserCollectorTest, HandleCrashWithoutMetrics) {
s_metrics = false;
collector_.HandleCrash(10, 20, "foobar");
- ASSERT_NE(logging_.log().find(
- "Received crash notification for foobar[20] sig 10"),
- std::string::npos);
+ ASSERT_NE(std::string::npos,
+ logging_.log().find(
+ "Received crash notification for foobar[20] sig 10"));
ASSERT_EQ(s_crashes, 0);
}
-TEST_F(UserCollectorTest, HandleCrashWithMetrics) {
+TEST_F(UserCollectorTest, HandleNonChromeCrashWithMetrics) {
+ s_metrics = true;
+ collector_.HandleCrash(2, 5, "chromeos-wm");
+ ASSERT_NE(std::string::npos,
+ logging_.log().find(
+ "Received crash notification for chromeos-wm[5] sig 2"));
+ ASSERT_EQ(s_crashes, 1);
+}
+
+TEST_F(UserCollectorTest, HandleChromeCrashWithMetrics) {
s_metrics = true;
collector_.HandleCrash(2, 5, "chrome");
- ASSERT_NE(logging_.log().find(
- "Received crash notification for chrome[5] sig 2"),
- std::string::npos);
- ASSERT_EQ(s_crashes, 1);
+ ASSERT_NE(std::string::npos,
+ logging_.log().find(
+ "Received crash notification for chrome[5] sig 2"));
+ ASSERT_NE(std::string::npos,
+ logging_.log().find("(ignoring - chrome crash)"));
+ ASSERT_EQ(s_crashes, 0);
}
TEST_F(UserCollectorTest, GetProcessPath) {