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

Unified Diff: client/crash_report_database_test.cc

Issue 1492503002: win: Fix debug iterator failure on empty database read/write (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: reading too Created 5 years 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 | « no previous file | 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 54dcdd75e014fcb00f133a30a41f62281dd97e40..ca839f473dde10d415cfb70094fbf0ac923c72ce 100644
--- a/client/crash_report_database_test.cc
+++ b/client/crash_report_database_test.cc
@@ -555,6 +555,36 @@ TEST_F(CrashReportDatabaseTest, DeleteReport) {
db()->LookUpCrashReport(keep_completed.uuid, &keep_completed));
}
+TEST_F(CrashReportDatabaseTest, DeleteReportEmptyingDatabase) {
+ CrashReportDatabase::Report report;
+ CreateCrashReport(&report);
+
+ EXPECT_TRUE(FileExists(report.file_path));
+
+ UploadReport(report.uuid, true, "1");
+
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->LookUpCrashReport(report.uuid, &report));
+
+ EXPECT_TRUE(FileExists(report.file_path));
+
+ // This causes an empty database to be written, make sure this is handled.
+ EXPECT_EQ(CrashReportDatabase::kNoError, db()->DeleteReport(report.uuid));
+ EXPECT_FALSE(FileExists(report.file_path));
+}
+
+TEST_F(CrashReportDatabaseTest, ReadEmptyDatabase) {
+ CrashReportDatabase::Report report;
+ CreateCrashReport(&report);
+ EXPECT_EQ(CrashReportDatabase::kNoError, db()->DeleteReport(report.uuid));
+
+ // Deleting and the creating another report causes an empty database to be
+ // loaded. Make sure this is handled.
+
+ CrashReportDatabase::Report report2;
+ CreateCrashReport(&report2);
+}
+
} // namespace
} // namespace test
} // namespace crashpad
« no previous file with comments | « no previous file | client/crash_report_database_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698