OLD | NEW |
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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 EXPECT_EQ(0, _wunlink(report.file_path.value().c_str())); | 490 EXPECT_EQ(0, _wunlink(report.file_path.value().c_str())); |
491 #else | 491 #else |
492 EXPECT_EQ(0, unlink(report.file_path.value().c_str())) | 492 EXPECT_EQ(0, unlink(report.file_path.value().c_str())) |
493 << ErrnoMessage("unlink"); | 493 << ErrnoMessage("unlink"); |
494 #endif | 494 #endif |
495 | 495 |
496 EXPECT_EQ(CrashReportDatabase::kReportNotFound, | 496 EXPECT_EQ(CrashReportDatabase::kReportNotFound, |
497 db()->LookUpCrashReport(uuid, &report)); | 497 db()->LookUpCrashReport(uuid, &report)); |
498 } | 498 } |
499 | 499 |
| 500 TEST_F(CrashReportDatabaseTest, DeleteReport) { |
| 501 CrashReportDatabase::Report keep_pending; |
| 502 CrashReportDatabase::Report delete_pending; |
| 503 CrashReportDatabase::Report keep_completed; |
| 504 CrashReportDatabase::Report delete_completed; |
| 505 |
| 506 CreateCrashReport(&keep_pending); |
| 507 CreateCrashReport(&delete_pending); |
| 508 CreateCrashReport(&keep_completed); |
| 509 CreateCrashReport(&delete_completed); |
| 510 |
| 511 EXPECT_TRUE(FileExists(keep_pending.file_path)); |
| 512 EXPECT_TRUE(FileExists(delete_pending.file_path)); |
| 513 EXPECT_TRUE(FileExists(keep_completed.file_path)); |
| 514 EXPECT_TRUE(FileExists(delete_completed.file_path)); |
| 515 |
| 516 UploadReport(keep_completed.uuid, true, "1"); |
| 517 UploadReport(delete_completed.uuid, true, "2"); |
| 518 |
| 519 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 520 db()->LookUpCrashReport(keep_completed.uuid, &keep_completed)); |
| 521 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 522 db()->LookUpCrashReport(delete_completed.uuid, &delete_completed)); |
| 523 |
| 524 EXPECT_TRUE(FileExists(keep_completed.file_path)); |
| 525 EXPECT_TRUE(FileExists(delete_completed.file_path)); |
| 526 |
| 527 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 528 db()->DeleteReport(delete_pending.uuid)); |
| 529 EXPECT_FALSE(FileExists(delete_pending.file_path)); |
| 530 EXPECT_EQ(CrashReportDatabase::kReportNotFound, |
| 531 db()->LookUpCrashReport(delete_pending.uuid, &delete_pending)); |
| 532 EXPECT_EQ(CrashReportDatabase::kReportNotFound, |
| 533 db()->DeleteReport(delete_pending.uuid)); |
| 534 |
| 535 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 536 db()->DeleteReport(delete_completed.uuid)); |
| 537 EXPECT_FALSE(FileExists(delete_completed.file_path)); |
| 538 EXPECT_EQ(CrashReportDatabase::kReportNotFound, |
| 539 db()->LookUpCrashReport(delete_completed.uuid, &delete_completed)); |
| 540 EXPECT_EQ(CrashReportDatabase::kReportNotFound, |
| 541 db()->DeleteReport(delete_completed.uuid)); |
| 542 |
| 543 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 544 db()->LookUpCrashReport(keep_pending.uuid, &keep_pending)); |
| 545 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 546 db()->LookUpCrashReport(keep_completed.uuid, &keep_completed)); |
| 547 } |
| 548 |
500 } // namespace | 549 } // namespace |
501 } // namespace test | 550 } // namespace test |
502 } // namespace crashpad | 551 } // namespace crashpad |
OLD | NEW |