| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_SAFE_BROWSING_DB_TEST_DATABASE_MANAGER_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_TEST_DATABASE_MANAGER_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_DB_TEST_DATABASE_MANAGER_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_TEST_DATABASE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "components/safe_browsing_db/database_manager.h" | 12 #include "components/safe_browsing_db/database_manager.h" |
| 13 | 13 |
| 14 namespace safe_browsing { | 14 namespace safe_browsing { |
| 15 | 15 |
| 16 // This is a non-pure-virtual implementation of the SafeBrowsingDatabaseManager | 16 // This is a non-pure-virtual implementation of the SafeBrowsingDatabaseManager |
| 17 // interface. It's used in tests by overriding only the functions that get | 17 // interface. It's used in tests by overriding only the functions that get |
| 18 // called, and it'll complain if you call one that isn't overriden. The | 18 // called, and it'll complain if you call one that isn't overriden. The |
| 19 // non-abstract methods in the base class are not overridden. | 19 // non-abstract methods in the base class are not overridden. |
| 20 class TestSafeBrowsingDatabaseManager | 20 class TestSafeBrowsingDatabaseManager |
| 21 : public SafeBrowsingDatabaseManager { | 21 : public SafeBrowsingDatabaseManager { |
| 22 public: | 22 public: |
| 23 // SafeBrowsingDatabaseManager implementation: | 23 // SafeBrowsingDatabaseManager implementation: |
| 24 void CancelCheck(Client* client) override; | 24 void CancelCheck(Client* client) override; |
| 25 bool CanCheckResourceType(content::ResourceType resource_type) const override; | 25 bool CanCheckResourceType(content::ResourceType resource_type) const override; |
| 26 bool CanCheckUrl(const GURL& url) const override; | 26 bool CanCheckUrl(const GURL& url) const override; |
| 27 bool ChecksAreAlwaysAsync() const override; | 27 bool ChecksAreAlwaysAsync() const override; |
| 28 bool CheckBrowseUrl(const GURL& url, Client* client) override; | 28 bool CheckBrowseUrl(const GURL& url, Client* client) override; |
| 29 AsyncMatch CheckCsdWhitelistUrl(const GURL& url, Client* client) override; |
| 29 bool CheckDownloadUrl(const std::vector<GURL>& url_chain, | 30 bool CheckDownloadUrl(const std::vector<GURL>& url_chain, |
| 30 Client* client) override; | 31 Client* client) override; |
| 31 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, | 32 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, |
| 32 Client* client) override; | 33 Client* client) override; |
| 33 bool CheckResourceUrl(const GURL& url, Client* client) override; | 34 bool CheckResourceUrl(const GURL& url, Client* client) override; |
| 34 bool CheckUrlForSubresourceFilter(const GURL& url, Client* client) override; | 35 bool CheckUrlForSubresourceFilter(const GURL& url, Client* client) override; |
| 35 bool MatchCsdWhitelistUrl(const GURL& url) override; | 36 bool MatchCsdWhitelistUrl(const GURL& url) override; |
| 36 bool MatchDownloadWhitelistString(const std::string& str) override; | 37 bool MatchDownloadWhitelistString(const std::string& str) override; |
| 37 bool MatchDownloadWhitelistUrl(const GURL& url) override; | 38 bool MatchDownloadWhitelistUrl(const GURL& url) override; |
| 38 bool MatchMalwareIP(const std::string& ip_address) override; | 39 bool MatchMalwareIP(const std::string& ip_address) override; |
| 39 bool MatchModuleWhitelistString(const std::string& str) override; | 40 bool MatchModuleWhitelistString(const std::string& str) override; |
| 40 safe_browsing::ThreatSource GetThreatSource() const override; | 41 safe_browsing::ThreatSource GetThreatSource() const override; |
| 41 bool IsCsdWhitelistKillSwitchOn() override; | 42 bool IsCsdWhitelistKillSwitchOn() override; |
| 42 bool IsDownloadProtectionEnabled() const override; | 43 bool IsDownloadProtectionEnabled() const override; |
| 43 bool IsMalwareKillSwitchOn() override; | 44 bool IsMalwareKillSwitchOn() override; |
| 44 bool IsSupported() const override; | 45 bool IsSupported() const override; |
| 45 void StartOnIOThread(net::URLRequestContextGetter* request_context_getter, | 46 void StartOnIOThread(net::URLRequestContextGetter* request_context_getter, |
| 46 const V4ProtocolConfig& config) override; | 47 const V4ProtocolConfig& config) override; |
| 47 void StopOnIOThread(bool shutdown) override; | 48 void StopOnIOThread(bool shutdown) override; |
| 48 | 49 |
| 49 protected: | 50 protected: |
| 50 ~TestSafeBrowsingDatabaseManager() override {}; | 51 ~TestSafeBrowsingDatabaseManager() override {}; |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace safe_browsing | 54 } // namespace safe_browsing |
| 54 | 55 |
| 55 #endif // COMPONENTS_SAFE_BROWSING_DB_TEST_DATABASE_MANAGER_H_ | 56 #endif // COMPONENTS_SAFE_BROWSING_DB_TEST_DATABASE_MANAGER_H_ |
| OLD | NEW |