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

Side by Side Diff: client/crash_report_database_test.cc

Issue 987693004: Mac 10.6 SDK compatibility (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Define __STDC_FORMAT_MACROS Created 5 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
« no previous file with comments | « client/crash_report_database_mac.mm ('k') | client/crash_report_database_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 TEST_F(CrashReportDatabaseTest, Initialize) { 113 TEST_F(CrashReportDatabaseTest, Initialize) {
114 // Initialize the database for the first time, creating it. 114 // Initialize the database for the first time, creating it.
115 EXPECT_TRUE(db()); 115 EXPECT_TRUE(db());
116 116
117 // Close and reopen the database at the same path. 117 // Close and reopen the database at the same path.
118 ResetDatabase(); 118 ResetDatabase();
119 EXPECT_FALSE(db()); 119 EXPECT_FALSE(db());
120 auto db = CrashReportDatabase::Initialize(path()); 120 auto db = CrashReportDatabase::Initialize(path());
121 ASSERT_TRUE(db); 121 ASSERT_TRUE(db);
122 122
123 std::vector<const CrashReportDatabase::Report> reports; 123 std::vector<CrashReportDatabase::Report> reports;
124 EXPECT_EQ(CrashReportDatabase::kNoError, db->GetPendingReports(&reports)); 124 EXPECT_EQ(CrashReportDatabase::kNoError, db->GetPendingReports(&reports));
125 EXPECT_TRUE(reports.empty()); 125 EXPECT_TRUE(reports.empty());
126 reports.clear(); 126 reports.clear();
127 EXPECT_EQ(CrashReportDatabase::kNoError, db->GetCompletedReports(&reports)); 127 EXPECT_EQ(CrashReportDatabase::kNoError, db->GetCompletedReports(&reports));
128 EXPECT_TRUE(reports.empty()); 128 EXPECT_TRUE(reports.empty());
129 } 129 }
130 130
131 TEST_F(CrashReportDatabaseTest, NewCrashReport) { 131 TEST_F(CrashReportDatabaseTest, NewCrashReport) {
132 CrashReportDatabase::NewReport* new_report; 132 CrashReportDatabase::NewReport* new_report;
133 EXPECT_EQ(CrashReportDatabase::kNoError, 133 EXPECT_EQ(CrashReportDatabase::kNoError,
134 db()->PrepareNewCrashReport(&new_report)); 134 db()->PrepareNewCrashReport(&new_report));
135 EXPECT_TRUE(FileExistsAtPath(new_report->path)) << new_report->path.value(); 135 EXPECT_TRUE(FileExistsAtPath(new_report->path)) << new_report->path.value();
136 UUID uuid; 136 UUID uuid;
137 EXPECT_EQ(CrashReportDatabase::kNoError, 137 EXPECT_EQ(CrashReportDatabase::kNoError,
138 db()->FinishedWritingCrashReport(new_report, &uuid)); 138 db()->FinishedWritingCrashReport(new_report, &uuid));
139 139
140 CrashReportDatabase::Report report; 140 CrashReportDatabase::Report report;
141 EXPECT_EQ(CrashReportDatabase::kNoError, 141 EXPECT_EQ(CrashReportDatabase::kNoError,
142 db()->LookUpCrashReport(uuid, &report)); 142 db()->LookUpCrashReport(uuid, &report));
143 ExpectPreparedCrashReport(report); 143 ExpectPreparedCrashReport(report);
144 144
145 std::vector<const CrashReportDatabase::Report> reports; 145 std::vector<CrashReportDatabase::Report> reports;
146 EXPECT_EQ(CrashReportDatabase::kNoError, 146 EXPECT_EQ(CrashReportDatabase::kNoError,
147 db()->GetPendingReports(&reports)); 147 db()->GetPendingReports(&reports));
148 ASSERT_EQ(1u, reports.size()); 148 ASSERT_EQ(1u, reports.size());
149 EXPECT_EQ(report.uuid, reports[0].uuid); 149 EXPECT_EQ(report.uuid, reports[0].uuid);
150 150
151 reports.clear(); 151 reports.clear();
152 EXPECT_EQ(CrashReportDatabase::kNoError, 152 EXPECT_EQ(CrashReportDatabase::kNoError,
153 db()->GetCompletedReports(&reports)); 153 db()->GetCompletedReports(&reports));
154 EXPECT_TRUE(reports.empty()); 154 EXPECT_TRUE(reports.empty());
155 } 155 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 CreateCrashReport(&reports[2]); 292 CreateCrashReport(&reports[2]);
293 CreateCrashReport(&reports[3]); 293 CreateCrashReport(&reports[3]);
294 CreateCrashReport(&reports[4]); 294 CreateCrashReport(&reports[4]);
295 295
296 const UUID& report_0_uuid = reports[0].uuid; 296 const UUID& report_0_uuid = reports[0].uuid;
297 const UUID& report_1_uuid = reports[1].uuid; 297 const UUID& report_1_uuid = reports[1].uuid;
298 const UUID& report_2_uuid = reports[2].uuid; 298 const UUID& report_2_uuid = reports[2].uuid;
299 const UUID& report_3_uuid = reports[3].uuid; 299 const UUID& report_3_uuid = reports[3].uuid;
300 const UUID& report_4_uuid = reports[4].uuid; 300 const UUID& report_4_uuid = reports[4].uuid;
301 301
302 std::vector<const CrashReportDatabase::Report> pending; 302 std::vector<CrashReportDatabase::Report> pending;
303 EXPECT_EQ(CrashReportDatabase::kNoError, 303 EXPECT_EQ(CrashReportDatabase::kNoError,
304 db()->GetPendingReports(&pending)); 304 db()->GetPendingReports(&pending));
305 305
306 std::vector<const CrashReportDatabase::Report> completed; 306 std::vector<CrashReportDatabase::Report> completed;
307 EXPECT_EQ(CrashReportDatabase::kNoError, 307 EXPECT_EQ(CrashReportDatabase::kNoError,
308 db()->GetCompletedReports(&completed)); 308 db()->GetCompletedReports(&completed));
309 309
310 EXPECT_EQ(reports.size(), pending.size()); 310 EXPECT_EQ(reports.size(), pending.size());
311 EXPECT_EQ(0u, completed.size()); 311 EXPECT_EQ(0u, completed.size());
312 312
313 // Upload one report successfully. 313 // Upload one report successfully.
314 UploadReport(report_1_uuid, true, "report1"); 314 UploadReport(report_1_uuid, true, "report1");
315 315
316 pending.clear(); 316 pending.clear();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 << ErrnoMessage("unlink"); 468 << ErrnoMessage("unlink");
469 #endif 469 #endif
470 470
471 EXPECT_EQ(CrashReportDatabase::kReportNotFound, 471 EXPECT_EQ(CrashReportDatabase::kReportNotFound,
472 db()->LookUpCrashReport(uuid, &report)); 472 db()->LookUpCrashReport(uuid, &report));
473 } 473 }
474 474
475 } // namespace 475 } // namespace
476 } // namespace test 476 } // namespace test
477 } // namespace crashpad 477 } // namespace crashpad
OLDNEW
« 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