OLD | NEW |
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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 // \xb2m\x0e\xe0\xe7\xe9P9\x9b\x1cB"\xf5\xde\x05\xe0d%\xb4\xc9\x95\xe9" | 793 // \xb2m\x0e\xe0\xe7\xe9P9\x9b\x1cB"\xf5\xde\x05\xe0d%\xb4\xc9\x95\xe9" |
794 | 794 |
795 HashPrefixMap prefix_map_old; | 795 HashPrefixMap prefix_map_old; |
796 EXPECT_EQ(APPLY_UPDATE_SUCCESS, | 796 EXPECT_EQ(APPLY_UPDATE_SUCCESS, |
797 V4Store::AddUnlumpedHashes(4, "2222", &prefix_map_old)); | 797 V4Store::AddUnlumpedHashes(4, "2222", &prefix_map_old)); |
798 EXPECT_EQ(CHECKSUM_MISMATCH_FAILURE, | 798 EXPECT_EQ(CHECKSUM_MISMATCH_FAILURE, |
799 V4Store(task_runner_, store_path_) | 799 V4Store(task_runner_, store_path_) |
800 .MergeUpdate(prefix_map_old, HashPrefixMap(), nullptr, "aawc")); | 800 .MergeUpdate(prefix_map_old, HashPrefixMap(), nullptr, "aawc")); |
801 } | 801 } |
802 | 802 |
| 803 TEST_F(V4StoreTest, TestChecksumErrorOnStartup) { |
| 804 HashPrefixMap prefix_map_additions; |
| 805 EXPECT_EQ(APPLY_UPDATE_SUCCESS, |
| 806 V4Store::AddUnlumpedHashes(4, "2222", &prefix_map_additions)); |
| 807 V4Store store(task_runner_, store_path_); |
| 808 EXPECT_EQ(APPLY_UPDATE_SUCCESS, |
| 809 store.MergeUpdate(HashPrefixMap(), prefix_map_additions, nullptr, |
| 810 "aawc")); |
| 811 EXPECT_FALSE(store.hash_prefix_map_.empty()); |
| 812 |
| 813 task_runner_->RunPendingTasks(); |
| 814 base::RunLoop().RunUntilIdle(); |
| 815 |
| 816 EXPECT_TRUE(store.hash_prefix_map_.empty()); |
| 817 } |
| 818 |
803 } // namespace safe_browsing | 819 } // namespace safe_browsing |
OLD | NEW |