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 ListUpdateResponse list_update_response; | |
805 list_update_response.set_new_client_state("test_client_state"); | |
806 list_update_response.set_platform_type(LINUX_PLATFORM); | |
807 list_update_response.set_response_type(ListUpdateResponse::FULL_UPDATE); | |
808 list_update_response.mutable_checksum()->set_sha256( | |
809 std::string(crypto::kSHA256Length, 0)); | |
810 WriteFileFormatProtoToFile(0x600D71FE, 9, &list_update_response); | |
811 V4Store store(task_runner_, store_path_); | |
812 EXPECT_TRUE(store.expected_checksum_.empty()); | |
813 | |
814 EXPECT_EQ(READ_SUCCESS, store.ReadFromDisk()); | |
815 EXPECT_TRUE(!store.expected_checksum_.empty()); | |
816 EXPECT_EQ("test_client_state", store.state()); | |
817 | |
818 EXPECT_FALSE(store.VerifyChecksum()); | |
819 // 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.
| |
820 } | |
821 | |
803 } // namespace safe_browsing | 822 } // namespace safe_browsing |
OLD | NEW |