OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Unit tests for the SafeBrowsing storage system. | 5 // Unit tests for the SafeBrowsing storage system. |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 | 902 |
903 // Prefix miss cache should be cleared. | 903 // Prefix miss cache should be cleared. |
904 EXPECT_EQ(database->prefix_miss_cache()->size(), 0U); | 904 EXPECT_EQ(database->prefix_miss_cache()->size(), 0U); |
905 | 905 |
906 lists.clear(); | 906 lists.clear(); |
907 prefixes.clear(); | 907 prefixes.clear(); |
908 full_hashes.clear(); | 908 full_hashes.clear(); |
909 | 909 |
910 // Test receiving a full add chunk. The old implementation doesn't support | 910 // Test receiving a full add chunk. The old implementation doesn't support |
911 // this test, so we bail here. | 911 // this test, so we bail here. |
912 if (CommandLine().HasSwitch(switches::kUseOldSafeBrowsing)) { | 912 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 913 switches::kUseOldSafeBrowsing)) { |
913 TearDownTestDatabase(database); | 914 TearDownTestDatabase(database); |
914 return; | 915 return; |
915 } | 916 } |
916 | 917 |
917 host.host = Sha256Prefix("www.fullevil.com/"); | 918 host.host = Sha256Prefix("www.fullevil.com/"); |
918 host.entry = SBEntry::Create(SBEntry::ADD_FULL_HASH, 2); | 919 host.entry = SBEntry::Create(SBEntry::ADD_FULL_HASH, 2); |
919 host.entry->set_chunk_id(20); | 920 host.entry->set_chunk_id(20); |
920 SBFullHash full_add1; | 921 SBFullHash full_add1; |
921 base::SHA256HashString("www.fullevil.com/bad1.html", | 922 base::SHA256HashString("www.fullevil.com/bad1.html", |
922 &full_add1.full_hash, sizeof(SBFullHash)); | 923 &full_add1.full_hash, sizeof(SBFullHash)); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) { | 1239 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) { |
1239 std::vector<ChunksInfo> chunks; | 1240 std::vector<ChunksInfo> chunks; |
1240 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>; | 1241 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>; |
1241 SBChunkDelete del; | 1242 SBChunkDelete del; |
1242 del.is_sub_del = false; | 1243 del.is_sub_del = false; |
1243 del.list_name = safe_browsing_util::kMalwareList; | 1244 del.list_name = safe_browsing_util::kMalwareList; |
1244 del.chunk_del.push_back(ChunkRange(3539, 3579)); | 1245 del.chunk_del.push_back(ChunkRange(3539, 3579)); |
1245 deletes->push_back(del); | 1246 deletes->push_back(del); |
1246 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); | 1247 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); |
1247 } | 1248 } |
OLD | NEW |