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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 // \xb2m\x0e\xe0\xe7\xe9P9\x9b\x1cB"\xf5\xde\x05\xe0d%\xb4\xc9\x95\xe9" 791 // \xb2m\x0e\xe0\xe7\xe9P9\x9b\x1cB"\xf5\xde\x05\xe0d%\xb4\xc9\x95\xe9"
792 792
793 HashPrefixMap prefix_map_old; 793 HashPrefixMap prefix_map_old;
794 EXPECT_EQ(APPLY_UPDATE_SUCCESS, 794 EXPECT_EQ(APPLY_UPDATE_SUCCESS,
795 V4Store::AddUnlumpedHashes(4, "2222", &prefix_map_old)); 795 V4Store::AddUnlumpedHashes(4, "2222", &prefix_map_old));
796 EXPECT_EQ(CHECKSUM_MISMATCH_FAILURE, 796 EXPECT_EQ(CHECKSUM_MISMATCH_FAILURE,
797 V4Store(task_runner_, store_path_) 797 V4Store(task_runner_, store_path_)
798 .MergeUpdate(prefix_map_old, HashPrefixMap(), nullptr, "aawc")); 798 .MergeUpdate(prefix_map_old, HashPrefixMap(), nullptr, "aawc"));
799 } 799 }
800 800
801 TEST_F(V4StoreTest, TestChecksumErrorOnStartup) {
802 HashPrefixMap prefix_map_additions;
803 EXPECT_EQ(APPLY_UPDATE_SUCCESS,
804 V4Store::AddUnlumpedHashes(4, "2222", &prefix_map_additions));
805 V4Store store(task_runner_, store_path_);
806 EXPECT_EQ(APPLY_UPDATE_SUCCESS,
807 store.MergeUpdate(HashPrefixMap(), prefix_map_additions, nullptr,
808 "aawc"));
809 EXPECT_FALSE(store.hash_prefix_map_.empty());
810
811 task_runner_->RunPendingTasks();
812 base::RunLoop().RunUntilIdle();
813
814 EXPECT_TRUE(store.hash_prefix_map_.empty());
815 }
816
801 } // namespace safe_browsing 817 } // namespace safe_browsing
OLDNEW
« 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