Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: user_collector_test.cc

Issue 6673002: crash-reporter: keep ignoring chrome crashes even on dev builds (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crash-reporter.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « user_collector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <unistd.h> 5 #include <unistd.h>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chromeos/syslog_logging.h" 8 #include "chromeos/syslog_logging.h"
9 #include "chromeos/test_helpers.h" 9 #include "chromeos/test_helpers.h"
10 #include "crash-reporter/user_collector.h" 10 #include "crash-reporter/user_collector.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 EXPECT_FALSE(collector_.ParseCrashAttributes("12345p:11:foobar", 115 EXPECT_FALSE(collector_.ParseCrashAttributes("12345p:11:foobar",
116 &pid, &signal, &exec_name)); 116 &pid, &signal, &exec_name));
117 117
118 EXPECT_FALSE(collector_.ParseCrashAttributes("123456:1 :foobar", 118 EXPECT_FALSE(collector_.ParseCrashAttributes("123456:1 :foobar",
119 &pid, &signal, &exec_name)); 119 &pid, &signal, &exec_name));
120 120
121 EXPECT_FALSE(collector_.ParseCrashAttributes("123456::foobar", 121 EXPECT_FALSE(collector_.ParseCrashAttributes("123456::foobar",
122 &pid, &signal, &exec_name)); 122 &pid, &signal, &exec_name));
123 } 123 }
124 124
125 TEST_F(UserCollectorTest, HandleCrashWithoutMetrics) { 125 TEST_F(UserCollectorTest, ShouldDumpDeveloperImageOverridesConsent) {
126 std::string reason;
127 EXPECT_TRUE(collector_.ShouldDump(false, true, false,
128 "chrome-wm", &reason));
129 EXPECT_EQ("developer build - not testing - always dumping", reason);
130
131 // When running a crash test, behave as normal.
132 EXPECT_FALSE(collector_.ShouldDump(false, true, true,
133 "chrome-wm", &reason));
134 EXPECT_EQ("ignoring - no consent", reason);
135 }
136
137 TEST_F(UserCollectorTest, ShouldDumpChromeOverridesDeveloperImage) {
138 std::string reason;
139 EXPECT_FALSE(collector_.ShouldDump(false, true, false,
140 "chrome", &reason));
141 EXPECT_EQ("ignoring - chrome crash", reason);
142 }
143
144 TEST_F(UserCollectorTest, ShouldDumpUseConsentProductionImage) {
145 std::string result;
146 EXPECT_FALSE(collector_.ShouldDump(false, false, false,
147 "chrome-wm", &result));
148 EXPECT_EQ("ignoring - no consent", result);
149
150 EXPECT_TRUE(collector_.ShouldDump(true, false, false,
151 "chrome-wm", &result));
152 EXPECT_EQ("handling", result);
153 }
154
155 TEST_F(UserCollectorTest, HandleCrashWithoutConsent) {
126 s_metrics = false; 156 s_metrics = false;
127 collector_.HandleCrash("20:10:ignored", "foobar"); 157 collector_.HandleCrash("20:10:ignored", "foobar");
128 EXPECT_TRUE(FindLog( 158 EXPECT_TRUE(FindLog(
129 "Received crash notification for foobar[20] sig 10")); 159 "Received crash notification for foobar[20] sig 10"));
130 ASSERT_EQ(s_crashes, 0); 160 ASSERT_EQ(s_crashes, 0);
131 } 161 }
132 162
133 TEST_F(UserCollectorTest, HandleNonChromeCrashWithMetrics) { 163 TEST_F(UserCollectorTest, HandleNonChromeCrashWithConsent) {
134 s_metrics = true; 164 s_metrics = true;
135 collector_.HandleCrash("5:2:ignored", "chromeos-wm"); 165 collector_.HandleCrash("5:2:ignored", "chromeos-wm");
136 EXPECT_TRUE(FindLog( 166 EXPECT_TRUE(FindLog(
137 "Received crash notification for chromeos-wm[5] sig 2")); 167 "Received crash notification for chromeos-wm[5] sig 2"));
138 ASSERT_EQ(s_crashes, 1); 168 ASSERT_EQ(s_crashes, 1);
139 } 169 }
140 170
141 TEST_F(UserCollectorTest, HandleChromeCrashWithMetrics) { 171 TEST_F(UserCollectorTest, HandleChromeCrashWithConsent) {
142 s_metrics = true; 172 s_metrics = true;
143 collector_.HandleCrash("5:2:ignored", "chrome"); 173 collector_.HandleCrash("5:2:ignored", "chrome");
144 EXPECT_TRUE(FindLog( 174 EXPECT_TRUE(FindLog(
145 "Received crash notification for chrome[5] sig 2")); 175 "Received crash notification for chrome[5] sig 2"));
146 EXPECT_TRUE(FindLog("(ignoring - chrome crash)")); 176 EXPECT_TRUE(FindLog("(ignoring - chrome crash)"));
147 ASSERT_EQ(s_crashes, 0); 177 ASSERT_EQ(s_crashes, 0);
148 } 178 }
149 179
150 TEST_F(UserCollectorTest, HandleSuppliedChromeCrashWithMetrics) { 180 TEST_F(UserCollectorTest, HandleSuppliedChromeCrashWithConsent) {
151 s_metrics = true; 181 s_metrics = true;
152 collector_.HandleCrash("0:2:chrome", NULL); 182 collector_.HandleCrash("0:2:chrome", NULL);
153 EXPECT_TRUE(FindLog( 183 EXPECT_TRUE(FindLog(
154 "Received crash notification for supplied_chrome[0] sig 2")); 184 "Received crash notification for supplied_chrome[0] sig 2"));
155 EXPECT_TRUE(FindLog("(ignoring - chrome crash)")); 185 EXPECT_TRUE(FindLog("(ignoring - chrome crash)"));
156 ASSERT_EQ(s_crashes, 0); 186 ASSERT_EQ(s_crashes, 0);
157 } 187 }
158 188
159 TEST_F(UserCollectorTest, GetProcessPath) { 189 TEST_F(UserCollectorTest, GetProcessPath) {
160 FilePath path = collector_.GetProcessPath(100); 190 FilePath path = collector_.GetProcessPath(100);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 EXPECT_EQ(expectations[i].exists, 342 EXPECT_EQ(expectations[i].exists,
313 file_util::PathExists( 343 file_util::PathExists(
314 container_path.Append(expectations[i].name))); 344 container_path.Append(expectations[i].name)));
315 } 345 }
316 } 346 }
317 347
318 int main(int argc, char **argv) { 348 int main(int argc, char **argv) {
319 SetUpTests(&argc, argv, false); 349 SetUpTests(&argc, argv, false);
320 return RUN_ALL_TESTS(); 350 return RUN_ALL_TESTS();
321 } 351 }
OLDNEW
« no previous file with comments | « user_collector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698