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

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: shess@ feedback 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..a7d6eb9eae328b66b5da0e66e8edbac47c5bfbbb 100644
--- a/components/safe_browsing_db/v4_store_unittest.cc
+++ b/components/safe_browsing_db/v4_store_unittest.cc
@@ -800,4 +800,23 @@ 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(
+ std::string(crypto::kSHA256Length, 0));
+ 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.
Nathan Parker 2016/10/07 23:24:29 Is there a database here? I'm confused by the comm
vakh (use Gerrit instead) 2016/10/10 17:42:34 Done.
+}
+
} // namespace safe_browsing
« components/safe_browsing_db/v4_store.cc ('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