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

Unified Diff: client/crash_report_database_test.cc

Issue 867363003: win: Implementation of CrashReportDatabase for Windows (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 10 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 60bcf43bd0812f0c38bb2adc212420239e627ccb..db0b7d1eb7458c4dc97566dfc98a938bb848ea8f 100644
--- a/client/crash_report_database_test.cc
+++ b/client/crash_report_database_test.cc
@@ -30,7 +30,7 @@ bool FileExistsAtPath(const base::FilePath& path) {
return lstat(path.value().c_str(), &st) == 0;
#elif defined(OS_WIN)
struct _stat st;
- return _wstat(path.value().c_str(), &st);
+ return _wstat(path.value().c_str(), &st) == 0;
#else
#error "Not implemented"
#endif
@@ -107,6 +107,12 @@ class CrashReportDatabaseTest : public testing::Test {
EXPECT_EQ(0, report.upload_attempts);
}
+ void RelocateDatabase() {
+ ResetDatabase();
+ temp_dir_.Rename();
+ SetUp();
+ }
+
private:
ScopedTempDir temp_dir_;
scoped_ptr<CrashReportDatabase> db_;
@@ -434,6 +440,24 @@ TEST_F(CrashReportDatabaseTest, DuelingUploads) {
db()->RecordUploadAttempt(upload_report, true, ""));
}
+TEST_F(CrashReportDatabaseTest, MoveDatabase) {
+ CrashReportDatabase::NewReport* new_report;
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->PrepareNewCrashReport(&new_report));
+ EXPECT_TRUE(FileExistsAtPath(new_report->path)) << new_report->path.value();
+ UUID uuid;
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->FinishedWritingCrashReport(new_report, &uuid));
+
+ RelocateDatabase();
+
+ CrashReportDatabase::Report report;
+ EXPECT_EQ(CrashReportDatabase::kNoError,
+ db()->LookUpCrashReport(uuid, &report));
+ ExpectPreparedCrashReport(report);
+ EXPECT_TRUE(FileExistsAtPath(report.file_path)) << report.file_path.value();
+}
+
} // 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