Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: components/safe_browsing_db/test_database_manager.h

Issue 1843383002: Safe Browsing: CheckApiBlacklist request implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 net { 14 namespace net {
15 class URLRequestContextGetter; 15 class URLRequestContextGetter;
16 } 16 }
17 17
18 namespace safe_browsing { 18 namespace safe_browsing {
19 19
20 struct V4ProtocolConfig; 20 struct V4ProtocolConfig;
21 21
22 // This is a non-pure-virtual implementation of the SafeBrowsingDatabaseManager 22 // This is a non-pure-virtual implementation of the SafeBrowsingDatabaseManager
23 // interface. It's used in tests by overriding only the functions that get 23 // interface. It's used in tests by overriding only the functions that get
24 // called, and it'll complain if you call one that isn't overriden. 24 // called, and it'll complain if you call one that isn't overriden. The
25 // non-abstract methods in the base class are not overridden.
Nathan Parker 2016/04/07 21:33:38 This changes the model a bit, since now tests may
kcarattini 2016/04/11 03:34:31 What I've done seemed like a reasonable solution t
25 class TestSafeBrowsingDatabaseManager 26 class TestSafeBrowsingDatabaseManager
26 : public SafeBrowsingDatabaseManager { 27 : public SafeBrowsingDatabaseManager {
27 public: 28 public:
28 // SafeBrowsingDatabaseManager implementation: 29 // SafeBrowsingDatabaseManager implementation:
29 bool IsSupported() const override; 30 bool IsSupported() const override;
30 safe_browsing::ThreatSource GetThreatSource() const override; 31 safe_browsing::ThreatSource GetThreatSource() const override;
31 bool ChecksAreAlwaysAsync() const override; 32 bool ChecksAreAlwaysAsync() const override;
32 bool CanCheckResourceType(content::ResourceType resource_type) const override; 33 bool CanCheckResourceType(content::ResourceType resource_type) const override;
33 bool CanCheckUrl(const GURL& url) const override; 34 bool CanCheckUrl(const GURL& url) const override;
34 bool download_protection_enabled() const override; 35 bool download_protection_enabled() const override;
35 bool CheckBrowseUrl(const GURL& url, Client* client) override; 36 bool CheckBrowseUrl(const GURL& url, Client* client) override;
36 bool CheckDownloadUrl(const std::vector<GURL>& url_chain, 37 bool CheckDownloadUrl(const std::vector<GURL>& url_chain,
37 Client* client) override; 38 Client* client) override;
38 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, 39 bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
39 Client* client) override; 40 Client* client) override;
40 bool CheckResourceUrl(const GURL& url, Client* client) override; 41 bool CheckResourceUrl(const GURL& url, Client* client) override;
41 bool MatchCsdWhitelistUrl(const GURL& url) override; 42 bool MatchCsdWhitelistUrl(const GURL& url) override;
42 bool MatchMalwareIP(const std::string& ip_address) override; 43 bool MatchMalwareIP(const std::string& ip_address) override;
43 bool MatchDownloadWhitelistUrl(const GURL& url) override; 44 bool MatchDownloadWhitelistUrl(const GURL& url) override;
44 bool MatchDownloadWhitelistString(const std::string& str) override; 45 bool MatchDownloadWhitelistString(const std::string& str) override;
45 bool MatchInclusionWhitelistUrl(const GURL& url) override; 46 bool MatchInclusionWhitelistUrl(const GURL& url) override;
46 bool MatchModuleWhitelistString(const std::string& str) override; 47 bool MatchModuleWhitelistString(const std::string& str) override;
47 bool IsMalwareKillSwitchOn() override; 48 bool IsMalwareKillSwitchOn() override;
48 bool IsCsdWhitelistKillSwitchOn() override; 49 bool IsCsdWhitelistKillSwitchOn() override;
49 void CancelCheck(Client* client) override; 50 void CancelCheck(Client* client) override;
50 void CheckApiBlacklistUrl(const GURL& url, Client* client) override;
51 void StartOnIOThread(
52 net::URLRequestContextGetter* request_context_getter,
53 const V4ProtocolConfig& config) override;
54 void StopOnIOThread(bool shutdown) override;
55 51
56 protected: 52 protected:
57 ~TestSafeBrowsingDatabaseManager() override {}; 53 ~TestSafeBrowsingDatabaseManager() override {};
58 }; 54 };
59 55
60 } // namespace safe_browsing 56 } // namespace safe_browsing
61 57
62 #endif // COMPONENTS_SAFE_BROWSING_DB_TEST_DATABASE_MANAGER_H_ 58 #endif // COMPONENTS_SAFE_BROWSING_DB_TEST_DATABASE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698