OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FAKE_SAFE_BROWSING_DATABAS
E_MANAGER_H_ |
| 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FAKE_SAFE_BROWSING_DATABAS
E_MANAGER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "components/safe_browsing_db/test_database_manager.h" |
| 12 #include "content/public/common/resource_type.h" |
| 13 |
| 14 class GURL; |
| 15 |
| 16 // Database manager that allows any URL to be configured as blacklisted for |
| 17 // testing. |
| 18 class FakeSafeBrowsingDatabaseManager |
| 19 : public safe_browsing::TestSafeBrowsingDatabaseManager { |
| 20 public: |
| 21 FakeSafeBrowsingDatabaseManager(); |
| 22 |
| 23 void AddBlacklistedUrl(const GURL& url, |
| 24 safe_browsing::SBThreatType threat_type); |
| 25 |
| 26 void SimulateTimeout(); |
| 27 |
| 28 protected: |
| 29 ~FakeSafeBrowsingDatabaseManager() override; |
| 30 |
| 31 // safe_browsing::TestSafeBrowsingDatabaseManager: |
| 32 bool CheckUrlForSubresourceFilter(const GURL& url, Client* client) override; |
| 33 bool CheckResourceUrl(const GURL& url, Client* client) override; |
| 34 bool IsSupported() const override; |
| 35 void CancelCheck(Client* client) override; |
| 36 bool ChecksAreAlwaysAsync() const override; |
| 37 bool CanCheckResourceType( |
| 38 content::ResourceType /* resource_type */) const override; |
| 39 safe_browsing::ThreatSource GetThreatSource() const override; |
| 40 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, |
| 41 Client* client) override; |
| 42 |
| 43 private: |
| 44 std::map<GURL, safe_browsing::SBThreatType> url_to_threat_type_; |
| 45 bool simulate_timeout_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); |
| 48 }; |
| 49 |
| 50 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FAKE_SAFE_BROWSING_DATA
BASE_MANAGER_H_ |
OLD | NEW |