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

Unified Diff: client/crash_report_database_test.cc

Issue 1392653002: Add functionality to prune old crash reports from the database. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/crash_report_database_mac.mm ('k') | client/crash_report_database_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/crash_report_database_test.cc
diff --git a/client/crash_report_database_test.cc b/client/crash_report_database_test.cc
index 9ed7fe9837abeb98eb2f1155202c1b6f886dbc0e..83b0de0fc4156258258e6f8ec8994f2ff54431e4 100644
--- a/client/crash_report_database_test.cc
+++ b/client/crash_report_database_test.cc
@@ -497,6 +497,55 @@ TEST_F(CrashReportDatabaseTest, ReportRemoved) {
db()->LookUpCrashReport(uuid, &report));
}
+TEST_F(CrashReportDatabaseTest, DeleteReport) {
+ CrashReportDatabase::Report keep_pending;
+ CrashReportDatabase::Report delete_pending;
+ CrashReportDatabase::Report keep_completed;
+ CrashReportDatabase::Report delete_completed;
+
+ CreateCrashReport(&keep_pending);
+ CreateCrashReport(&delete_pending);
+ CreateCrashReport(&keep_completed);
+ CreateCrashReport(&delete_completed);
+
+ EXPECT_TRUE(FileExists(keep_pending.file_path));
+ EXPECT_TRUE(FileExists(delete_pending.file_path));
+ EXPECT_TRUE(FileExists(keep_completed.file_path));
+ EXPECT_TRUE(FileExists(delete_completed.file_path));
+
+ UploadReport(keep_completed.uuid, true, "1");
+ UploadReport(delete_completed.uuid, true, "2");
+
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->LookUpCrashReport(keep_completed.uuid, &keep_completed));
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->LookUpCrashReport(delete_completed.uuid, &delete_completed));
+
+ EXPECT_TRUE(FileExists(keep_completed.file_path));
+ EXPECT_TRUE(FileExists(delete_completed.file_path));
+
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->DeleteReport(delete_pending.uuid));
+ EXPECT_FALSE(FileExists(delete_pending.file_path));
+ EXPECT_EQ(CrashReportDatabase::kReportNotFound,
+ db()->LookUpCrashReport(delete_pending.uuid, &delete_pending));
+ EXPECT_EQ(CrashReportDatabase::kReportNotFound,
+ db()->DeleteReport(delete_pending.uuid));
+
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->DeleteReport(delete_completed.uuid));
+ EXPECT_FALSE(FileExists(delete_completed.file_path));
+ EXPECT_EQ(CrashReportDatabase::kReportNotFound,
+ db()->LookUpCrashReport(delete_completed.uuid, &delete_completed));
+ EXPECT_EQ(CrashReportDatabase::kReportNotFound,
+ db()->DeleteReport(delete_completed.uuid));
+
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->LookUpCrashReport(keep_pending.uuid, &keep_pending));
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->LookUpCrashReport(keep_completed.uuid, &keep_completed));
+}
+
} // namespace
} // namespace test
} // namespace crashpad
« no previous file with comments | « client/crash_report_database_mac.mm ('k') | client/crash_report_database_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698