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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« 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