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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database_impl_unittest.cc

Issue 6268: Port some more parts of browser/... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_database_impl_unittest.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_database_impl_unittest.cc (revision 3500)
+++ chrome/browser/safe_browsing/safe_browsing_database_impl_unittest.cc (working copy)
@@ -89,7 +89,7 @@
PathService::Get(base::DIR_TEMP, &filename);
filename.push_back(file_util::kPathSeparator);
filename.append(L"SafeBrowsingTestDatabase");
- DeleteFile(filename.c_str()); // In case it existed from a previous run.
+ file_util::Delete(filename, false); // In case it existed from a previous run.
SafeBrowsingDatabaseImpl database;
database.SetSynchronous();
@@ -98,7 +98,7 @@
PopulateDatabaseForCacheTest(&database);
// We should have both full hashes in the cache.
- EXPECT_EQ(database.hash_cache_.size(), 2);
+ EXPECT_EQ(database.hash_cache_.size(), 2U);
// Test the cache lookup for the first prefix.
std::string list;
@@ -106,7 +106,7 @@
std::vector<SBFullHashResult> full_hashes;
database.ContainsUrl(GURL("http://www.evil.com/phishing.html"),
&list, &prefixes, &full_hashes, Time::Now());
- EXPECT_EQ(full_hashes.size(), 1);
+ EXPECT_EQ(full_hashes.size(), 1U);
SBFullHashResult full_hash;
base::SHA256HashString("www.evil.com/phishing.html",
@@ -120,7 +120,7 @@
// Test the cache lookup for the second prefix.
database.ContainsUrl(GURL("http://www.evil.com/malware.html"),
&list, &prefixes, &full_hashes, Time::Now());
- EXPECT_EQ(full_hashes.size(), 1);
+ EXPECT_EQ(full_hashes.size(), 1U);
base::SHA256HashString("www.evil.com/malware.html",
&full_hash.hash, sizeof(SBFullHash));
EXPECT_EQ(memcmp(&full_hashes[0].hash,
@@ -149,7 +149,7 @@
// This prefix should still be there.
database.ContainsUrl(GURL("http://www.evil.com/malware.html"),
&list, &prefixes, &full_hashes, Time::Now());
- EXPECT_EQ(full_hashes.size(), 1);
+ EXPECT_EQ(full_hashes.size(), 1U);
base::SHA256HashString("www.evil.com/malware.html",
&full_hash.hash, sizeof(SBFullHash));
EXPECT_EQ(memcmp(&full_hashes[0].hash,
@@ -161,7 +161,7 @@
// This prefix should be gone.
database.ContainsUrl(GURL("http://www.evil.com/phishing.html"),
&list, &prefixes, &full_hashes, Time::Now());
- EXPECT_EQ(full_hashes.size(), 0);
+ EXPECT_EQ(full_hashes.size(), 0U);
prefixes.clear();
full_hashes.clear();
@@ -170,8 +170,8 @@
AddDelChunk(&database, "goog-malware-shavar", 1);
database.ContainsUrl(GURL("http://www.evil.com/malware.html"),
&list, &prefixes, &full_hashes, Time::Now());
- EXPECT_EQ(full_hashes.size(), 0);
- EXPECT_EQ(database.hash_cache_.size(), 0);
+ EXPECT_EQ(full_hashes.size(), 0U);
+ EXPECT_EQ(database.hash_cache_.size(), 0U);
prefixes.clear();
full_hashes.clear();
@@ -180,7 +180,7 @@
// the cached entries' received time to make them older, since the database
// cache insert uses Time::Now(). First, store some entries.
PopulateDatabaseForCacheTest(&database);
- EXPECT_EQ(database.hash_cache_.size(), 2);
+ EXPECT_EQ(database.hash_cache_.size(), 2U);
// Now adjust one of the entries times to be in the past.
Time expired = Time::Now() - TimeDelta::FromMinutes(60);
@@ -194,15 +194,15 @@
database.ContainsUrl(GURL("http://www.evil.com/malware.html"),
&list, &prefixes, &full_hashes, expired);
- EXPECT_EQ(full_hashes.size(), 0);
+ EXPECT_EQ(full_hashes.size(), 0U);
// Expired entry was dumped.
- EXPECT_EQ(database.hash_cache_.size(), 1);
+ EXPECT_EQ(database.hash_cache_.size(), 1U);
// This entry should still exist.
database.ContainsUrl(GURL("http://www.evil.com/phishing.html"),
&list, &prefixes, &full_hashes, expired);
- EXPECT_EQ(full_hashes.size(), 1);
+ EXPECT_EQ(full_hashes.size(), 1U);
// Testing prefix miss caching. First, we clear out the existing database,
@@ -217,11 +217,11 @@
database.CacheHashResults(prefix_misses, empty_full_hash);
// Prefixes with no full results are misses.
- EXPECT_EQ(database.prefix_miss_cache_.size(), 2);
+ EXPECT_EQ(database.prefix_miss_cache_.size(), 2U);
// Update the database.
PopulateDatabaseForCacheTest(&database);
// Prefix miss cache should be cleared.
- EXPECT_EQ(database.prefix_miss_cache_.size(), 0);
+ EXPECT_EQ(database.prefix_miss_cache_.size(), 0U);
}

Powered by Google App Engine
This is Rietveld 408576698