| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This test creates a safebrowsing service using test safebrowsing database | 5 // This test creates a safebrowsing service using test safebrowsing database |
| 6 // and a test protocol manager. It is used to test logics in safebrowsing | 6 // and a test protocol manager. It is used to test logics in safebrowsing |
| 7 // service. | 7 // service. |
| 8 | 8 |
| 9 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 9 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 10 | 10 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 std::vector<SBPrefix>* prefix_hits) { | 290 std::vector<SBPrefix>* prefix_hits) { |
| 291 bool hit = false; | 291 bool hit = false; |
| 292 for (const GURL& url : urls) { | 292 for (const GURL& url : urls) { |
| 293 base::hash_map<std::string, Hits>::const_iterator badurls_it = | 293 base::hash_map<std::string, Hits>::const_iterator badurls_it = |
| 294 badurls_.find(url.spec()); | 294 badurls_.find(url.spec()); |
| 295 | 295 |
| 296 if (badurls_it == badurls_.end()) | 296 if (badurls_it == badurls_.end()) |
| 297 continue; | 297 continue; |
| 298 | 298 |
| 299 std::vector<int> list_ids_for_url = badurls_it->second.list_ids; | 299 std::vector<int> list_ids_for_url = badurls_it->second.list_ids; |
| 300 if (ContainsValue(list_ids_for_url, list_id0) || | 300 if (base::ContainsValue(list_ids_for_url, list_id0) || |
| 301 ContainsValue(list_ids_for_url, list_id1)) { | 301 base::ContainsValue(list_ids_for_url, list_id1)) { |
| 302 prefix_hits->insert(prefix_hits->end(), | 302 prefix_hits->insert(prefix_hits->end(), |
| 303 badurls_it->second.prefix_hits.begin(), | 303 badurls_it->second.prefix_hits.begin(), |
| 304 badurls_it->second.prefix_hits.end()); | 304 badurls_it->second.prefix_hits.end()); |
| 305 hit = true; | 305 hit = true; |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 return hit; | 308 return hit; |
| 309 } | 309 } |
| 310 | 310 |
| 311 std::vector<GURL> UrlsForHashes(const std::vector<SBFullHash>& full_hashes) { | 311 std::vector<GURL> UrlsForHashes(const std::vector<SBFullHash>& full_hashes) { |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 content::Source<SafeBrowsingDatabaseManager>( | 1757 content::Source<SafeBrowsingDatabaseManager>( |
| 1758 sb_factory_->test_safe_browsing_service()->database_manager().get())); | 1758 sb_factory_->test_safe_browsing_service()->database_manager().get())); |
| 1759 BrowserThread::PostTask( | 1759 BrowserThread::PostTask( |
| 1760 BrowserThread::IO, FROM_HERE, | 1760 BrowserThread::IO, FROM_HERE, |
| 1761 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, | 1761 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, |
| 1762 base::Unretained(this))); | 1762 base::Unretained(this))); |
| 1763 observer.Wait(); | 1763 observer.Wait(); |
| 1764 } | 1764 } |
| 1765 | 1765 |
| 1766 } // namespace safe_browsing | 1766 } // namespace safe_browsing |
| OLD | NEW |