| 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 db()->LookUpCrashReport(delete_completed.uuid, &delete_completed)); | 548 db()->LookUpCrashReport(delete_completed.uuid, &delete_completed)); |
| 549 EXPECT_EQ(CrashReportDatabase::kReportNotFound, | 549 EXPECT_EQ(CrashReportDatabase::kReportNotFound, |
| 550 db()->DeleteReport(delete_completed.uuid)); | 550 db()->DeleteReport(delete_completed.uuid)); |
| 551 | 551 |
| 552 EXPECT_EQ(CrashReportDatabase::kNoError, | 552 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 553 db()->LookUpCrashReport(keep_pending.uuid, &keep_pending)); | 553 db()->LookUpCrashReport(keep_pending.uuid, &keep_pending)); |
| 554 EXPECT_EQ(CrashReportDatabase::kNoError, | 554 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 555 db()->LookUpCrashReport(keep_completed.uuid, &keep_completed)); | 555 db()->LookUpCrashReport(keep_completed.uuid, &keep_completed)); |
| 556 } | 556 } |
| 557 | 557 |
| 558 TEST_F(CrashReportDatabaseTest, DeleteReportEmptyingDatabase) { |
| 559 CrashReportDatabase::Report report; |
| 560 CreateCrashReport(&report); |
| 561 |
| 562 EXPECT_TRUE(FileExists(report.file_path)); |
| 563 |
| 564 UploadReport(report.uuid, true, "1"); |
| 565 |
| 566 EXPECT_EQ(CrashReportDatabase::kNoError, |
| 567 db()->LookUpCrashReport(report.uuid, &report)); |
| 568 |
| 569 EXPECT_TRUE(FileExists(report.file_path)); |
| 570 |
| 571 // This causes an empty database to be written, make sure this is handled. |
| 572 EXPECT_EQ(CrashReportDatabase::kNoError, db()->DeleteReport(report.uuid)); |
| 573 EXPECT_FALSE(FileExists(report.file_path)); |
| 574 } |
| 575 |
| 576 TEST_F(CrashReportDatabaseTest, ReadEmptyDatabase) { |
| 577 CrashReportDatabase::Report report; |
| 578 CreateCrashReport(&report); |
| 579 EXPECT_EQ(CrashReportDatabase::kNoError, db()->DeleteReport(report.uuid)); |
| 580 |
| 581 // Deleting and the creating another report causes an empty database to be |
| 582 // loaded. Make sure this is handled. |
| 583 |
| 584 CrashReportDatabase::Report report2; |
| 585 CreateCrashReport(&report2); |
| 586 } |
| 587 |
| 558 } // namespace | 588 } // namespace |
| 559 } // namespace test | 589 } // namespace test |
| 560 } // namespace crashpad | 590 } // namespace crashpad |
| OLD | NEW |