Index: chrome/browser/safe_browsing/safe_browsing_database_unittest.cc |
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc |
index 56df6cb1dbeb3552b7113c2430a4f73ff0120c74..f2f920a415f9bcf7cc0d55db7109e2cc24e52d7a 100644 |
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc |
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc |
@@ -17,7 +17,6 @@ |
#include "base/time/time.h" |
#include "chrome/browser/safe_browsing/chunk.pb.h" |
#include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
-#include "content/public/test/test_browser_thread_bundle.h" |
#include "crypto/sha2.h" |
#include "net/base/net_util.h" |
#include "sql/connection.h" |
@@ -331,11 +330,6 @@ class SafeBrowsingDatabaseTest : public PlatformTest { |
scoped_ptr<SafeBrowsingDatabaseNew> database_; |
base::FilePath database_filename_; |
base::ScopedTempDir temp_dir_; |
- |
- // We expect most checks made on |database_| to be made from the IO thread. |
- // Use this ThreadBundle to fake the IO thread in the main message loop in |
- // these tests. |
- content::TestBrowserThreadBundle thread_bundle_; |
}; |
// Tests retrieving list name information. |
@@ -836,7 +830,8 @@ void SafeBrowsingDatabaseTest::PopulateDatabaseForCacheTest() { |
database_->UpdateFinished(true); |
// Cache should be cleared after updating. |
- EXPECT_TRUE(database_->prefix_gethash_cache_.empty()); |
+ EXPECT_TRUE( |
+ database_->GetUnsynchronizedPrefixGetHashCacheForTesting()->empty()); |
SBFullHashResult full_hash; |
full_hash.list_id = safe_browsing_util::MALWARE; |
@@ -860,7 +855,8 @@ TEST_F(SafeBrowsingDatabaseTest, HashCaching) { |
PopulateDatabaseForCacheTest(); |
// We should have both full hashes in the cache. |
- EXPECT_EQ(2U, database_->prefix_gethash_cache_.size()); |
+ EXPECT_EQ(2U, |
+ database_->GetUnsynchronizedPrefixGetHashCacheForTesting()->size()); |
// Test the cache lookup for the first prefix. |
std::vector<SBPrefix> prefix_hits; |
@@ -916,7 +912,8 @@ TEST_F(SafeBrowsingDatabaseTest, HashCaching) { |
database_->UpdateFinished(true); |
EXPECT_FALSE(database_->ContainsBrowseUrl( |
GURL("http://www.evil.com/malware.html"), &prefix_hits, &cache_hits)); |
- EXPECT_TRUE(database_->prefix_gethash_cache_.empty()); |
+ EXPECT_TRUE( |
+ database_->GetUnsynchronizedPrefixGetHashCacheForTesting()->empty()); |
prefix_hits.clear(); |
cache_hits.clear(); |
@@ -925,13 +922,13 @@ TEST_F(SafeBrowsingDatabaseTest, HashCaching) { |
// cache insert uses Time::Now(). First, store some entries. |
PopulateDatabaseForCacheTest(); |
- std::map<SBPrefix, SBCachedFullHashResult>* hash_cache = |
- &database_->prefix_gethash_cache_; |
+ SafeBrowsingDatabaseNew::PrefixGetHashCache* hash_cache = |
+ database_->GetUnsynchronizedPrefixGetHashCacheForTesting(); |
EXPECT_EQ(2U, hash_cache->size()); |
// Now adjust one of the entries times to be in the past. |
const SBPrefix key = SBPrefixForString("www.evil.com/malware.html"); |
- std::map<SBPrefix, SBCachedFullHashResult>::iterator iter = |
+ SafeBrowsingDatabaseNew::PrefixGetHashCache::iterator iter = |
hash_cache->find(key); |
ASSERT_TRUE(iter != hash_cache->end()); |
iter->second.expire_after = Time::Now() - TimeDelta::FromMinutes(1); |
@@ -1891,7 +1888,8 @@ TEST_F(SafeBrowsingDatabaseTest, BrowseFullHashMatching) { |
database_->UpdateFinished(true); |
// Cache should be cleared after updating. |
- EXPECT_TRUE(database_->prefix_gethash_cache_.empty()); |
+ EXPECT_TRUE( |
+ database_->GetUnsynchronizedPrefixGetHashCacheForTesting()->empty()); |
{ |
// Now the database doesn't contain kFullHash1_1. |
@@ -1928,7 +1926,8 @@ TEST_F(SafeBrowsingDatabaseTest, BrowseFullHashMatching) { |
database_->UpdateFinished(true); |
// Cache should be cleared after updating. |
- EXPECT_TRUE(database_->prefix_gethash_cache_.empty()); |
+ EXPECT_TRUE( |
+ database_->GetUnsynchronizedPrefixGetHashCacheForTesting()->empty()); |
{ |
// None are present. |