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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database_unittest.cc

Issue 67243: Reduce the false positive rate for SafeBrowsing gethash requests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_database_bloom.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 898
899 // Prefixes with no full results are misses. 899 // Prefixes with no full results are misses.
900 EXPECT_EQ(database->prefix_miss_cache()->size(), 2U); 900 EXPECT_EQ(database->prefix_miss_cache()->size(), 2U);
901 901
902 // Update the database. 902 // Update the database.
903 PopulateDatabaseForCacheTest(database); 903 PopulateDatabaseForCacheTest(database);
904 904
905 // Prefix miss cache should be cleared. 905 // Prefix miss cache should be cleared.
906 EXPECT_EQ(database->prefix_miss_cache()->size(), 0U); 906 EXPECT_EQ(database->prefix_miss_cache()->size(), 0U);
907 907
908 // Cache a GetHash miss for a particular prefix, and even though the prefix is
909 // in the database, it is flagged as a miss so looking up the associated URL
910 // will not succeed.
911 prefixes.clear();
912 full_hashes.clear();
913 prefix_misses.clear();
914 empty_full_hash.clear();
915 prefix_misses.push_back(Sha256Prefix("www.evil.com/phishing.html"));
916 database->CacheHashResults(prefix_misses, empty_full_hash);
917 EXPECT_FALSE(database->ContainsUrl(GURL("http://www.evil.com/phishing.html"),
918 &listname, &prefixes,
919 &full_hashes, Time::Now()));
920
908 lists.clear(); 921 lists.clear();
909 prefixes.clear(); 922 prefixes.clear();
910 full_hashes.clear(); 923 full_hashes.clear();
911 924
912 // Test receiving a full add chunk. 925 // Test receiving a full add chunk.
913 host.host = Sha256Prefix("www.fullevil.com/"); 926 host.host = Sha256Prefix("www.fullevil.com/");
914 host.entry = SBEntry::Create(SBEntry::ADD_FULL_HASH, 2); 927 host.entry = SBEntry::Create(SBEntry::ADD_FULL_HASH, 2);
915 host.entry->set_chunk_id(20); 928 host.entry->set_chunk_id(20);
916 SBFullHash full_add1; 929 SBFullHash full_add1;
917 base::SHA256HashString("www.fullevil.com/bad1.html", 930 base::SHA256HashString("www.fullevil.com/bad1.html",
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) { 1241 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) {
1229 std::vector<ChunksInfo> chunks; 1242 std::vector<ChunksInfo> chunks;
1230 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>; 1243 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>;
1231 SBChunkDelete del; 1244 SBChunkDelete del;
1232 del.is_sub_del = false; 1245 del.is_sub_del = false;
1233 del.list_name = safe_browsing_util::kMalwareList; 1246 del.list_name = safe_browsing_util::kMalwareList;
1234 del.chunk_del.push_back(ChunkRange(3539, 3579)); 1247 del.chunk_del.push_back(ChunkRange(3539, 3579));
1235 deletes->push_back(del); 1248 deletes->push_back(del);
1236 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); 1249 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes);
1237 } 1250 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_database_bloom.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698