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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 bool ContainsInclusionWhitelistedUrl(const GURL& url) override { | 253 bool ContainsInclusionWhitelistedUrl(const GURL& url) override { |
254 return true; | 254 return true; |
255 } | 255 } |
256 bool ContainsExtensionPrefixes(const std::vector<SBPrefix>& prefixes, | 256 bool ContainsExtensionPrefixes(const std::vector<SBPrefix>& prefixes, |
257 std::vector<SBPrefix>* prefix_hits) override { | 257 std::vector<SBPrefix>* prefix_hits) override { |
258 return false; | 258 return false; |
259 } | 259 } |
260 bool ContainsMalwareIP(const std::string& ip_address) override { | 260 bool ContainsMalwareIP(const std::string& ip_address) override { |
261 return true; | 261 return true; |
262 } | 262 } |
| 263 bool ContainsResourceUrlPrefixes( |
| 264 const std::vector<SBPrefix>& prefixes, |
| 265 std::vector<SBPrefix>* prefix_hits) override { |
| 266 return false; |
| 267 } |
263 bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override { | 268 bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override { |
264 ADD_FAILURE() << "Not implemented."; | 269 ADD_FAILURE() << "Not implemented."; |
265 return false; | 270 return false; |
266 } | 271 } |
267 void InsertChunks( | 272 void InsertChunks( |
268 const std::string& list_name, | 273 const std::string& list_name, |
269 const std::vector<scoped_ptr<SBChunkData>>& chunks) override { | 274 const std::vector<scoped_ptr<SBChunkData>>& chunks) override { |
270 ADD_FAILURE() << "Not implemented."; | 275 ADD_FAILURE() << "Not implemented."; |
271 } | 276 } |
272 void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) override { | 277 void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) override { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 TestSafeBrowsingDatabaseFactory() : db_(NULL) {} | 375 TestSafeBrowsingDatabaseFactory() : db_(NULL) {} |
371 ~TestSafeBrowsingDatabaseFactory() override {} | 376 ~TestSafeBrowsingDatabaseFactory() override {} |
372 | 377 |
373 SafeBrowsingDatabase* CreateSafeBrowsingDatabase( | 378 SafeBrowsingDatabase* CreateSafeBrowsingDatabase( |
374 const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, | 379 const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, |
375 bool enable_download_protection, | 380 bool enable_download_protection, |
376 bool enable_client_side_whitelist, | 381 bool enable_client_side_whitelist, |
377 bool enable_download_whitelist, | 382 bool enable_download_whitelist, |
378 bool enable_extension_blacklist, | 383 bool enable_extension_blacklist, |
379 bool enable_ip_blacklist, | 384 bool enable_ip_blacklist, |
380 bool enabled_unwanted_software_list) override { | 385 bool enabled_unwanted_software_list, |
| 386 bool enable_resource_blacklist) override { |
381 db_ = new TestSafeBrowsingDatabase(); | 387 db_ = new TestSafeBrowsingDatabase(); |
382 return db_; | 388 return db_; |
383 } | 389 } |
384 TestSafeBrowsingDatabase* GetDb() { return db_; } | 390 TestSafeBrowsingDatabase* GetDb() { return db_; } |
385 | 391 |
386 private: | 392 private: |
387 // Owned by the SafebrowsingService. | 393 // Owned by the SafebrowsingService. |
388 TestSafeBrowsingDatabase* db_; | 394 TestSafeBrowsingDatabase* db_; |
389 }; | 395 }; |
390 | 396 |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | 1673 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
1668 content::Source<SafeBrowsingDatabaseManager>( | 1674 content::Source<SafeBrowsingDatabaseManager>( |
1669 sb_service_->database_manager().get())); | 1675 sb_service_->database_manager().get())); |
1670 BrowserThread::PostTask( | 1676 BrowserThread::PostTask( |
1671 BrowserThread::IO, FROM_HERE, | 1677 BrowserThread::IO, FROM_HERE, |
1672 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); | 1678 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); |
1673 observer.Wait(); | 1679 observer.Wait(); |
1674 } | 1680 } |
1675 | 1681 |
1676 } // namespace safe_browsing | 1682 } // namespace safe_browsing |
OLD | NEW |