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

Unified Diff: components/safe_browsing_db/v4_store_unittest.cc

Issue 2384893002: PVer4: Test checksum on startup outside the hotpath of DB load (Closed)
Patch Set: go: design-doc-v4store-verifychecksum -- VerifyChecksum in a way that avoids race conditions betwee… Created 4 years, 2 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
Index: components/safe_browsing_db/v4_store_unittest.cc
diff --git a/components/safe_browsing_db/v4_store_unittest.cc b/components/safe_browsing_db/v4_store_unittest.cc
index 90c6525fa88ca316d0051a6fabf0e73147e51e6f..108f188dd17f80577a87c2fc4b09b4018f0f71f9 100644
--- a/components/safe_browsing_db/v4_store_unittest.cc
+++ b/components/safe_browsing_db/v4_store_unittest.cc
@@ -800,4 +800,22 @@ TEST_F(V4StoreTest, TestMergeUpdatesFailsChecksum) {
.MergeUpdate(prefix_map_old, HashPrefixMap(), nullptr, "aawc"));
}
+TEST_F(V4StoreTest, TestChecksumErrorOnStartup) {
+ ListUpdateResponse list_update_response;
+ list_update_response.set_new_client_state("test_client_state");
+ list_update_response.set_platform_type(LINUX_PLATFORM);
+ list_update_response.set_response_type(ListUpdateResponse::FULL_UPDATE);
+ list_update_response.mutable_checksum()->set_sha256("checksum");
+ WriteFileFormatProtoToFile(0x600D71FE, 9, &list_update_response);
+ V4Store store(task_runner_, store_path_);
+ EXPECT_TRUE(store.expected_checksum_.empty());
+
+ EXPECT_EQ(READ_SUCCESS, store.ReadFromDisk());
+ EXPECT_TRUE(!store.expected_checksum_.empty());
+ EXPECT_EQ("test_client_state", store.state());
+
+ EXPECT_FALSE(store.VerifyChecksum());
+ // The database schedules the checksum verification.
+}
+
} // namespace safe_browsing
« components/safe_browsing_db/v4_database.h ('K') | « components/safe_browsing_db/v4_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698